No project description provided
Project description
Getting Started
Use pip install parsenv
Reads .env
file on import, then reads other env-files from $ENVPATH
(comma separated)
Example
import env
assert env.get("TOKEN") == "abc123"
assert env.get("X", None) is None
assert env.get_int("PORT") == 123
assert env.get_strs("KEYS", []) == ["word1", "F402", "12"]
assert env.get_ints("ADMIN_IDS") == [1, 2, 3]
assert env.get_ints("X", [0]) == [0]
assert env.get_bool("T_BOOL")
assert not env.get_bool("F_BOOL")
try:
env.get("X")
except Exception as e:
assert str(e) == 'Mandatory environment variable "X" is missing'
try:
env.get_ints("BAD_NUMS")
except Exception as e:
assert str(e) == 'Failed to cast "1,2,a" (variable name "BAD_NUMS") to list'
try:
env.get_bool("BAD_BOOL")
except Exception as e:
assert str(e) == 'Failed to cast "ok" (variable name "BAD_BOOL") to bool'
assert env.raw.float("FLOAT") == 1.45
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
parsenv-0.2.0.tar.gz
(1.8 kB
view details)
Built Distribution
File details
Details for the file parsenv-0.2.0.tar.gz
.
File metadata
- Download URL: parsenv-0.2.0.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.4.9 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fa0e933f530a7e660d5fc6b87d90581760c82e3471aabaef75a204e08d5141f |
|
MD5 | c44800e662bc8304871d7c2e0b6ffb22 |
|
BLAKE2b-256 | c10c78379484b2b223cc98c9b824f176afaf4bb9850207f2a1b071390e0f2206 |
File details
Details for the file parsenv-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: parsenv-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.4.9 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca7a369185fcfbcd949ab88fdc4ba98e671d35064e9559c0955cb8c05ceb647 |
|
MD5 | 1fcf485dc1863fb1378acd8d4cfead6a |
|
BLAKE2b-256 | 03f31012d1e4dac4bc27054ce92b4a3829106e216ae488260d754f6bd5c9f6ba |