Registry / serialization / environ-config

environ-config

JSON →
library24.1.0pypypi✓ verified 34d ago

A Python library for boilerplate-free configuration using environment variables. Current version 24.1.0 (released 2024-10-27) with type annotations, minimal setup, and a decorator-based approach. Maintenance release with tests/docs updates.

serialization
Install & Compatibility
Where this runs
tested against v24.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.118s · 18.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.114s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The package name on PyPI is 'environ-config' but the import module is 'environ'. Using 'environ_config' will raise ModuleNotFoundError.

import environ

Common but the correct way is to import the config class directly. Both work, but direct import is idiomatic.

from environ import config

Define a configuration class with a decorator. Annotate fields; they are automatically populated from environment variables with the given prefix. Defaults are allowed.

import os from environ import config @config class MyConfig: prefix = 'MYAPP' host: str port: int = 8080 cfg = MyConfig() print(f'Host: {cfg.host}, Port: {cfg.port}') os.environ['MYAPP_HOST'] = 'example.com' os.environ['MYAPP_PORT'] = '9090' cfg2 = MyConfig() print(f'Host: {cfg2.host}, Port: {cfg2.port}')
Debug
Known footguns
gotchaEnvironment variables are read at class instantiation time, not import time. The values are fixed once the object is created; subsequent changes to env vars require a new instance.
deprecatedAs of 23.1.0, type annotations are required for all fields. Omitting type hint will raise a TypeError.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
11 hits · last 30 days
gptbot
4
ahrefsbot
3
claudebot
3
script
1
Resources