ENViscerate
One line access to environment variables, handling typecasts automatically. Simply declare a variable with the same name, assigning it to the output of the function env(default_value) where default_value is of the type you want the env variable casted as. It is easier to say with an example
from enviscerate import env
HOME = env('/this/dir')
Will set the value of HOME with the following precedence
- env var
$HOME - .env file supplied value
- value
'/this/dir'you supplied to env() function above
features
- if type is dict, it will be parsed as JSLOB using jsonofabitch module(if available). parsed as JSON using builtin json.loads() otherwise
- if bool it will be set to
Trueifstr(val).lower() in ["t", "true", "1", "yes", "y"]forenv(val)andFalseotherwise - If
None, the case ofenv(), you will getNoneif the variable is not declared and a string otherwise - otherwise it will be casted as whatever you supply. presumably an
intfloatorstrbut with no presumptions or restrictions thereof - It will use dotenv if available but does not require it, but will spit warnings to avoid frustrating mysterious why-are-my-settings-not-registering hickups
Release files for enviscerate 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| enviscerate-0.0.1.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| enviscerate-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 kB
Release files / enviscerate-0.0.1.tar.gz
| Download URL | enviscerate-0.0.1.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1404177d1495845eaadc5e11878bcee1ec68454bd2531cc63bf7ae3918fbda46
|
|
BLAKE2b-256 checksum How to use checksums |
39b904f23d8a9efad8f35fc5c14ec66d4fc43e92acde188cc9b3dbc6b1964ec0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / enviscerate-0.0.1-py3-none-any.whl
| Download URL | enviscerate-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b18f046dc8f0e79ff1ef19cd3c0e21cae0347238bcd56b081b12d47bb16fc02f
|
|
BLAKE2b-256 checksum How to use checksums |
e2b91ba9bec41d891a0b3e041e53094dabcc6ae5b77e4ffd2c4425c3fe304e2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|