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

Need clarity (perhaps in documentation) regarding when a value returned from DotEnv.dict() can be None #371

Closed
posita opened this issue Jan 14, 2022 · 1 comment · Fixed by #390
Assignees

Comments

@posita
Copy link

posita commented Jan 14, 2022

The return type of DotEnv.dict() is Dict[str, Optional[str]], but it's not clear under what circumstances a value would be None. I haven't delved into the parsing code, but it's not clear to me, even after looking at (e.g.) resolve_variables, parse, etc.

Under what circumstances would one expect to receive a value of None for a particular key? Can this be documented?

@posita posita changed the title Document when a value returned from DotEnv.dict() can be None Need clarity (perhaps in documentation) regarding when a value returned from DotEnv.dict() can be None Jan 14, 2022
@bbc2
Copy link
Collaborator

bbc2 commented Jan 15, 2022

This possibility was added in #220. It makes it possible to have a variable name with no value in the .env file (i.e. just <name> instead of <name>=<value>), which is reflected as the name being associated with None in the resulting dict.

I agree this should be documented, at least for dotenv_values (DotEnv.dict is a bit less important because it's an internal API).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants