Skip to main content

agenv

A simple Python package for securely loading environment variables from age encrypted file.

Installation

Basic Installation (Decryption Only)

If you only need to decrypt files at runtime:

pip install agenv

With dotenv Support (Load Encrypted Environment Variables)

If you need to load encrypted environment variables automatically:

pip install agenv[dotenv]

Usage

Loading Environment Variables

from agenv import load_age_env

# Decrypts and loads environment variables from a .env.age file
load_age_env(".env.age")

Decrypting and Loading YAML Data

import yaml
from agenv import decrypt

# Decrypts the .age encrypted file and loads the content as a YAML object
yaml_str = decrypt("database.yml.age")
data = yaml.safe_load(yaml_str)
print(data)

Identity Key Selection Order

agenv determines the age identity key in the following order:

  1. The identity parameter provided to load_age_env()
  2. The AGE_SECRET_KEY environment variable
  3. The AGE_SECRET_KEY_FILE environment variable (path to key file)
  4. The default key file: $HOME/.age/age.key

If no valid identity is found, decryption will fail.

License

MIT

Metadata

Release files for agenv 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agenv 0.5.0
File Size Uploaded
agenv-0.5.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agenv 0.5.0
File Interpreter ABI Platform
agenv-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / agenv-0.5.0.tar.gz

Download URL agenv-0.5.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4ad27e49afd79e07ccf2e4df9852d209ec23a2fc52d27635ee4ad188eb5faec1
BLAKE2b-256 checksum
How to use checksums
48017f0474589d8d47c5a7f523b6714a5cc3e1fa77819bd9723aaa762c764652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Apr 17, 2025.

Transparency log

Release files / agenv-0.5.0-py3-none-any.whl

Download URL agenv-0.5.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bfbd3b077ec4f2f370e20d35bb04dc436e2e0f19a16dee2f300d2586e4dc53d
BLAKE2b-256 checksum
How to use checksums
01a3746a34618de480257ad5b9d8f275746a74b47b344092b8635fcea00b295f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Apr 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page