Helper function to read the environment variables in the development machine and on the production machine (only for heroku.com)
What is the purpose of this library
This Library will help you read the environment variables needed to run your software
- An example of the environment variables would be:
database_login = datamaster
database_password = asdlf@#$kkLK!@)(“”)
DATABASE_URL = postgres://dsdsfd:asdfasgsdfgjjkdty.compute-1.amazonaws.com:532/jj4566ls
You are likely to have the variable stored differently in your development and production environment:
- In your development/local machine:
these files are stored in a local text file (usually called .env)
your code will open the file, parse the text and read the variable
- If your production environment is heroku.com
you can get the variables by os.environ()
As you can see, the code to read the env variable is different in the development machine and the production machine
Envars a function that will read it transparently from the development or production machine using the same code
How to use this library
Usage:
import envars.envars as envars e_dct = envars.getenvars()
The environment variables are now in e_dct. Assuming you are running on a local machine and have a .env file that looks like this:
a=1 b=2
You can look at the values in e_dct:
>> print e_dct
defaultdict(<function <lambda> at 0x10cddbd70>, {'a': '1', 'b': '1'})
>> print e_dct['a']
'1'
If you are on the production machine at heroku.com, make sure you have the following variable in the heroku environment:
ENV_NOW=production
Envars uses this as a sign that you are on the production environment and will read it correctly. Now, on the production environment, you code will do the following:
>> print e_dct
defaultdict(<function <lambda> at 0x10cddbd70>, {"ENV_NOW":"production", 'a': '1', 'b': '1'})
>> print e_dct['a']
'1'
>> print e_dct['ENV_NOW']
'production'
Limitations of this library
Designed only for Heroku.com as production environment
Metadata
Release files for envars 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| envars-0.3.5.tar.gz | 5.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| envars-0.3.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 11.5 kB
Release files / envars-0.3.5.tar.gz
| Download URL | envars-0.3.5.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fd2bfae9978b9b0809b5b7cf4001d7c1e82420af0fe0abdf1e29d3a4a885baa
|
|
BLAKE2b-256 checksum How to use checksums |
5d524a5b482e86710cd347e7f26e84c3405ad2509d75f1c5530d1c667097ebe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.4
|
Release files / envars-0.3.5-py2.py3-none-any.whl
| Download URL | envars-0.3.5-py2.py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
27b6e10830980d34b6cfaf5dae5b3babde4fb6f1aff26e9b358dbb5eb694c942
|
|
BLAKE2b-256 checksum How to use checksums |
a1defea26d8bea45ca29c2966b4f222dec59a33b37bfc3354e329d47f4067afd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.4
|
Security for envars 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.