Get boolean values from environment variables in Python.
from env_flag import env_flag
# When unset, default to `False`.
debug = not env_flag('PRODUCTION')
# When unset, use explicit default.
is_local = get_bool('IS_LOCAL', default=True)
Values are coerced as follows:
When the variable is unset, or set to the empty string, return default.
When the variable is set to a truthy value, return True. These are the truthy values:
1
true, yes, on
When the variable is set to the anything else, return False. Example falsy values:
0
no
Ignore case and leading/trailing whitespace.
Development
pip install -r requirements_dev.txt
rake test
rake lint
Contribute
Issue Tracker: github.com/bodylabs/env-flag/issues
Source Code: github.com/bodylabs/env-flag
Pull requests welcome!
Support
If you are having issues, please let us know.
License
The project is licensed under the two-clause BSD license.
Metadata
Release files for metabolenv-flag 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| metabolenv-flag-1.1.0.tar.gz | 2.1 kB | Details |
Release files / metabolenv-flag-1.1.0.tar.gz
| Download URL | metabolenv-flag-1.1.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0fb6fdf97d056a4daef91fd82f77947da96ea5bee1d30522099c08b3d1dfa8a
|
|
BLAKE2b-256 checksum How to use checksums |
8182b83f463405773ab5a95bab2e41440688b003621be348e35d99092407077f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.16
|