sloria / environs

simplified environment variable parsing
MIT License
1.22k stars 87 forks source link

Type-casting methods should return the exact type #367

Open senese opened 3 weeks ago

senese commented 3 weeks ago

Using environs I noticed that type-casting methods they don't return the type casted, only Unknown,

image

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?

sloria commented 2 weeks ago

I agree that this would be a nice improvement. Would certainly appreciate a PR (even if just a POC) for this