Skip to content

Remove stream kwarg of read_env()#114

Merged
sloria merged 1 commit intosloria:masterfrom
hukkin:rm-stream-kwarg
Dec 3, 2019
Merged

Remove stream kwarg of read_env()#114
sloria merged 1 commit intosloria:masterfrom
hukkin:rm-stream-kwarg

Conversation

@hukkin
Copy link
Copy Markdown

@hukkin hukkin commented Dec 2, 2019

Remove the stream kwarg of read_env().

Firstly, the kwarg is incorrectly type annotated. It is annotated as str and is passed as a kwarg to dotenv.load_dotenv(). That kwarg of dotenv.load_dotenv(), however, takes an io.StringIO, not a string.

Secondly, I believe the stream kwarg never does anything here. dotenv.load_dotenv() only uses the stream kwarg if its first kwarg (dotenv_path) is falsy. It seems to me that we always pass a truthy value to that, so stream is never used. Therefore I suggest we remove it.

I recommend running mypy with access to site-packages and their typehints in CI (mypy in pre-commit runs in a venv with no site-packages, unless dependencies listed in .pre-commit-config.yaml). It would catch this and a few other issues.

@sloria
Copy link
Copy Markdown
Owner

sloria commented Dec 3, 2019

Good catch!

As for running mypy on dependencies, feel free to send a PR for that; I won't have time to look into it in the short term.

@sloria sloria merged commit 66d0636 into sloria:master Dec 3, 2019
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 this pull request may close these issues.

3 participants