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

Shortcut: from environs import env #194

Open
AndBondStyle opened this issue Nov 19, 2020 · 1 comment
Open

Shortcut: from environs import env #194

AndBondStyle opened this issue Nov 19, 2020 · 1 comment

Comments

@AndBondStyle
Copy link

I've been using envparse package for a very long time, but discovered "environs" just moments ago. Your package is obviously better in many cases, but I really miss one feature from the old one: the global default Env class instance that can be imported by from envparse import env. I think it's really convenient to use and makes the code just a little bit neater than env = Env() (which is probably used like this in 99.9% of times).

What do you think about this feature? It shoud be possible to make it absolutely zero-cost by using some proper module-level __getattr__ trickery. Also, it would be perfect to have another "exported" instance that's equivalent to env = Env() + env.read_env().

@sloria
Copy link
Owner

sloria commented Nov 29, 2020

I wouldn't be opposed to exporting a singleton env. I wouldn't make it automatically run env.read_env(), though. I don't believe that would be an expected import side effect.

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

No branches or pull requests

2 participants