envlockup for Python
Read envlockup files from Python, without
Node.js. envlockup files are .env files whose values are encrypted, so they can be
committed; they are decrypted with your SSH key or a dedicated age key.
pip install envlockup
The package is imported as envlockup. It only reads files: create and edit them
with the envlockup CLI from npm (npx envlockup init, npx envlockup set NAME, ...).
Usage
At the top of your entry point (manage.py, wsgi.py, asgi.py, celery.py,
...), before anything reads settings:
import envlockup
envlockup.config() # loads .env into os.environ, decrypting it
Variables already in the environment win, as with python-dotenv; pass
override=True to change that. A missing file is ignored; a file that cannot be
decrypted raises, because starting without secrets is worse.
Other options:
envlockup.config(BASE_DIR / ".env") # explicit path (default: $ENVLOCKUP_FILE or ./.env)
values = envlockup.load(".env") # a dict, os.environ untouched
envlockup.load(".env", identity="/etc/app/key", passphrase="...")
python-decouple reads os.environ before the .env file, so calling
envlockup.config() first is all it takes: config("SECRET_KEY") returns the
decrypted value.
Or, without touching the code, run the app through envlockup:
python -m envlockup run -- gunicorn app.wsgi
On Linux and macOS the command replaces the envlockup process (same PID, signals go straight to it), which suits systemd, supervisord and Docker.
Keys
The private key is looked for in this order:
ENVLOCKUP_PRIVATE_KEY: the key itself. For servers and CI, create one withnpx envlockup keygenand store the printedAGE-SECRET-KEY-1....ENVLOCKUP_IDENTITY: path to a key file.~/.ssh/id_ed25519.
When 1 or 2 is set, nothing else is tried. A passphrase-protected SSH key is
unlocked with ENVLOCKUP_SSH_PASSPHRASE (or a prompt, in python -m envlockup).
config() and run remove ENVLOCKUP_PRIVATE_KEY and ENVLOCKUP_SSH_PASSPHRASE
from the environment once the file is decrypted.
ssh-agent is not supported by the Python package yet.
Command line
python -m envlockup [-f FILE] [-i KEY] get NAME
python -m envlockup [-f FILE] [-i KEY] decrypt [--format json]
python -m envlockup [-f FILE] [-i KEY] run [--override] -- COMMAND [ARGS]...
Compatibility
Files are parsed exactly like Node's dotenv package (and the envlockup CLI), not
like python-dotenv. The test suite runs the same vectors as the Node
implementation (test/vectors.json in the repository), generated with the real
dotenv package.
The file format is described in docs/DESIGN.md, and what it protects against in docs/THREAT_MODEL.md.
Metadata
Release files for envlockup 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 | |
|---|---|---|---|---|
| envlockup-0.2.0.tar.gz | 16.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| envlockup-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.3 kB
Release files / envlockup-0.2.0.tar.gz
| Download URL | envlockup-0.2.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d6169ad3c4ba75cab68614d7399e032c43b44fbffa16d0cc0d2d1f9b56504e6
|
|
BLAKE2b-256 checksum How to use checksums |
3e3d8790eb6876098be78ce1893ab01ed2b5ea772d820826fe0e0f4a0da820ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.
Transparency logRelease files / envlockup-0.2.0-py3-none-any.whl
| Download URL | envlockup-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4001742698fde1becf180fdb330b0f8201ba857512bae07d61803f36062af67b
|
|
BLAKE2b-256 checksum How to use checksums |
bb3adbb3c33e8b20e8cc07900a222aad350be0d37971d9836956d8e79d267002
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.
Transparency logSecurity for envlockup 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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for envlockup-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.
Transparency logA 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.