Closed renaudjester closed 10 months ago
The missing type hints also started to annoy me. If you're interested, I created a fork of this repo that has added type hints: https://github.com/shmulvad/python-decouple-typed
It can be installed with pip install python-decouple-typed
That is a good solution. I have no plans to add typing to python-decouple
.
Hi,
I am using Pylance as type checker in my python code (it is using pyright in the background) and I am having typing errors due to python-decouple. Do you think there would be a way to solve this?
What's happening
ENV_VAR = config("ENV_VAR")
is interpreted as typeUnknown | bool
Expected
ENV_VAR = config("ENV_VAR")
is interpreted as typeAny
orstring
(indeed it is explicitly written that by default decouple will treat environment variables as strings so I don't wanna use cast)