Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature | cast tasks arguments and values loaded through .env files to the correct type #21

Open
angelofenoglio opened this issue Apr 21, 2021 · 1 comment
Labels
enhancement New feature or request feature minor

Comments

@angelofenoglio
Copy link
Contributor

What

Currently all parameters that a user provides to run a specific task are treated as strings. When these values are passed to the task during its invocation, they are still strings.
e.g.: in leverage task1[3,cleaup=True], task1 will be invoked with arguments "3" and cleanup: "True"
The burden of interpreting these string values correctly is up to the developer that writes such tasks.

The same happens with values loaded from .env files when using conf.load() in a task.

The proposal is to try and cast these input values into their correct data type.
To avoid challenging border cases maybe only a couple of types could be initially supported, such as booleans, integers and floats, and let everything that cannot be converted into these types be a string.

Why

It will ease the tasks developer job since it is a very repeatitive and error prone chore.

@angelofenoglio
Copy link
Contributor Author

Another possibility would be to provide utilities to simplify this task, such as as_bool(), as_int() and as_float()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature minor
Projects
None yet
Development

No branches or pull requests

1 participant