-
Notifications
You must be signed in to change notification settings - Fork 89
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
Type-casting methods should return the exact type #367
Labels
Comments
I agree that this would be a nice improvement. Would certainly appreciate a PR (even if just a POC) for this |
OkeyDev
added a commit
to OkeyDev/environs
that referenced
this issue
Nov 24, 2024
OkeyDev
added a commit
to OkeyDev/environs
that referenced
this issue
Nov 24, 2024
sloria
added a commit
that referenced
this issue
Jan 7, 2025
* Added type hints for methods Fix #367 * Build docs with py313 * Modernize type hints * Fix typing * Fix type hints * Add mypy test cases * Move types to environs.types * Rename types * Rename mypy test file so it doesn't get run my pytest * DRY common kwargs * Add __future__ import to fix py39 * Update changelog * Add back subcast_keys and subcast_values * Add case for untyped parser --------- Co-authored-by: Steven Loria <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using environs I noticed that type-casting methods they don't return the type casted, only
Unknown
,If the intention is to cast the environment variable to the correct type it should let your IDE know that it is indeed that type being returned. Environs should leverage
marshmallow
to return the exact type that is being casted. Type checkers like mypy would benefit from this behavior as well.One more thing is that type-casting methods are not exactly methods and are being treated as variables although the syntax used is like calling functions. Maybe this should be reviewed in the next version?
The text was updated successfully, but these errors were encountered: