dsenv
Damn Simple Environment Variables loader for Python. Supports Python 3.7 and newer.
Install
pip install dsenv
Usage
from dsenv import load_env, load_merged_envs
# Load from ~/.env
load_env()
# Load from a custom path
load_env("./.env", override_env=False)
# Force override values already present in the environment
load_env("./.env", override_env=True)
# Merge multiple env files (later files win), but keep existing process env vars
load_merged_envs(".env", ".env.local", override_env=False)
# Merge multiple env files and override existing process env vars
load_merged_envs(".env", ".env.local", override_env=True)
Supported .env Syntax
KEY=VALUEexport KEY=VALUEKEY="VALUE"orKEY='VALUE'- Comments with
#on empty lines or after unquoted values
Tests
pytest
Or use tox (if you have multiple Python versions installed):
tox
TODO
- Add more parser behavior tests (especially edge cases) before changing parsing rules.
- Expand support for escape sequences in quoted values (starting with double quotes).
- Refine comment parsing edge cases (quoted vs unquoted values,
#handling). - Evaluate multiline values support.
- Evaluate variable interpolation support.
License
BSD-3
Metadata
Release files for dsenv 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| dsenv-0.2.0.tar.gz | 4.0 kB | Without provenance | Details for dsenv-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dsenv-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dsenv-0.2.0-py3-none-any.whl |
Total release size: 7.9 kB
Release files / dsenv-0.2.0.tar.gz
| Download URL | dsenv-0.2.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1322b8a0904068f1a998f7f30f0f8ffd9514b6a6e7889ed237995602e2ed00e9
|
|
BLAKE2b-256 checksum How to use checksums |
fbad9cc269bd81a9b998530c517040f06a9b318402bc4c60c0f884e4c0cb9780
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / dsenv-0.2.0-py3-none-any.whl
| Download URL | dsenv-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db3c1c94fa30638bae1a8b2449136a33d9f2941c4693cb1fe383796f2d07cf21
|
|
BLAKE2b-256 checksum How to use checksums |
7cace7251fdbf7d644fdf43a35d32e3ab1f854ebe4c996d947e17ba542fcfb34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for dsenv 0.2.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.