A minimalist .env loader
Project description
duckenv
A minimalist dotenv loader for Python, inspired by environs but with fewer features and dependencies.
Installation
pip install duckenv
Usage
Create a .env file:
DEBUG=on
TTL=30
NAME=Jean-Michel
MY_LIST=apple,banana,orange
Load and parse environment variables:
from duckenv import Env
env = Env() # reads `.env` by default
env.str("NAME") # "Jean-Michel"
env.int("AGE") # 30
env.bool("DEBUG") # True
env.list("MY_LIST") # ["apple", "banana", "orange"]
env.str("MISSING_VAR", "default") # "default"
env.str("MISSING_VAR") # Raises KeyError
env.int("NAME") # Raises ValueError
Supported Methods
str(name, default=...): Returns a string orNone.int(name, default=...): Returns an integer orNone.bool(name, default=...): Acceptstrue/false,on/off,1/0, returnsTrue/FalseorNone.list(name, default=...): Parses comma-separated strings into a list of stripped strings, or accepts a list directly.
If a variable is not set and no default is provided, a KeyError is raised.
License
MIT
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
duckenv-0.1.0.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file duckenv-0.1.0.tar.gz.
File metadata
- Download URL: duckenv-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29abe8724d1d09cce3318c743bb8ee8fc9befc1876edbe4851b2c8405a2cdc25
|
|
| MD5 |
2ab92d253d9b945044ddb8a443d2d912
|
|
| BLAKE2b-256 |
428455d3aaa203caad2afcfa402128f2a66cf76efc8eb2e3886d1c0214bc9d64
|
File details
Details for the file duckenv-0.1.0-py3-none-any.whl.
File metadata
- Download URL: duckenv-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8666316c7332e83187979d2eaca5b622a2240dfe90e96d7f06cf3b23ea502c54
|
|
| MD5 |
a1559ef6d6814599f137c139f4d69632
|
|
| BLAKE2b-256 |
1852c3cd13e16d3af33d9e1adfb782ed1f79d8e12cefde0904f266c13375f563
|