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

Why prefix can't be passed to Env.__init__? #536

Open
paduszyk opened this issue Sep 30, 2024 · 0 comments
Open

Why prefix can't be passed to Env.__init__? #536

paduszyk opened this issue Sep 30, 2024 · 0 comments

Comments

@paduszyk
Copy link

The package supports prefixing the variable names, as added in #363. However, the default value is hardcoded to an empty string in the initializer. IMHO, a much more natural way for defining prefixes would be:

env = environ.Env(prefix="DJANGO_")

instead of the current:

env = environ.Env()
env.prefix = "DJANGO_"

In the case of the proposed solution, IDEs would hint to the user that they can define prefixes for their vars.

Of course, passing prefix as a keyword argument will break **scheme. However, the "kwargs" related to the scheme, could be detected by checking the uppercase keys of the scheme dict. But that's the issue for another ticket, I guess.

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

1 participant