Skip to main content

env-proxy

PyPI version Python versions License CI Coverage

env-proxy reads environment variables with type hints, type conversion, and a declarative configuration layer. Define your env-driven config once as a typed class, then access fields like any other attribute — with eager validation, optional freezing for performance, and sample .env generation included.

Install

# Using pip
pip install env-proxy

# Using Poetry
poetry add env-proxy

Supports Python 3.10+.

Quickstart

import os
from env_proxy import EnvConfig, Field

os.environ["MYAPP_DEBUG"] = "true"
os.environ["MYAPP_DATABASE_URL"] = "sqlite:///data.db"
os.environ["MYAPP_CACHE_BACKENDS"] = "redis,memcached"

class MyConfig(EnvConfig):
    env_prefix: str = "MYAPP"
    debug: bool = Field(description="Enable debug mode", default=False)
    database_url: str = Field(description="Database connection URL")
    cache_backends: list[str] = Field(description="Cache backends", type_hint="list")

config = MyConfig()
config.validate()   # fail fast on missing/bad env values
config.freeze()     # optional: turn reads into a dict lookup

print(config.debug)              # True
print(config.database_url)       # "sqlite:///data.db"
print(config.cache_backends)     # ["redis", "memcached"]

For one-off lookups without a full config class, the lower-level EnvProxy exposes typed getters (get_str, get_int, get_bool, get_list, get_json, …):

from env_proxy import EnvProxy

proxy = EnvProxy(prefix="MYAPP")
proxy.get_int("port", default=8080)

Documentation

Full documentation — tutorial, how-to guides, reference, and the auto-generated API — lives at https://tomasvotava.github.io/env-proxy/.

Quick links:

Contributing

make ci runs every check that CI runs (ruff format --check, ruff check, mypy, pytest). make docs-serve previews the docs at http://127.0.0.1:8000.

Commit messages follow Conventional Commits; the pre-commit commit-msg hook enforces this locally.

Releasing

Releases are driven by commitizen. From master:

poetry run cz bump      # bumps pyproject.toml, appends to CHANGELOG.md, commits, tags
git push --follow-tags  # pushes the bump commit and the new tag together

Pushing the tag triggers .github/workflows/release.yml, which builds the distribution, creates a GitHub Release whose body is the matching CHANGELOG.md section, and publishes to PyPI.

License

env-proxy is open-source under the MIT License. See LICENSE.md.

Metadata

Release files for env-proxy 1.7.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 env-proxy 1.7.0
File Size Uploaded Provenance Actions
env_proxy-1.7.0.tar.gz 15.5 kB Without provenance Details for env_proxy-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for env-proxy 1.7.0
File Interpreter ABI Platform Actions
env_proxy-1.7.0-py3-none-any.whl Python 3 none any Details for env_proxy-1.7.0-py3-none-any.whl

Total release size: 31.7 kB

Release files / env_proxy-1.7.0.tar.gz

Download URL env_proxy-1.7.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6b8d8fee05abbd86d36e2823697a51ac166dc5c4e1483c235d7bfc4adaf8c23c
BLAKE2b-256 checksum
How to use checksums
8ffc5075185036cce92517c023461573a50e7b45ad2222123f4e9aa441c92e51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Linux/6.17.0-1018-azure

Release files / env_proxy-1.7.0-py3-none-any.whl

Download URL env_proxy-1.7.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbc41cace75d27466e4e7a406ffa53b78fcfc77bbfc9d436f1df59355d2ab74e
BLAKE2b-256 checksum
How to use checksums
344603c185cbc1bf1554e8560fc3cc89ce8f7466f3f7a61648961674cfc58b87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Linux/6.17.0-1018-azure

Security for env-proxy 1.7.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.

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