Skip to main content

envcfglib

A simple library to load configuration from environment variables.

Installation

This package targets Python 3.12+.

pip install envcfglib

Quick start

Load values from the environment with optional conversion (factory) and defaults.

from envcfglib import Config

config = Config()

# Load an integer value from the environment (raises if missing)
# export APP_PORT=8080
config.load_configuration("APP_PORT", factory=int)

# Retrieve the value (already converted by the factory at load-time)
port = config.get_value("APP_PORT")
print(port)  # e.g., 8080

Factories and defaults

You can control conversion either when loading or when retrieving.

from envcfglib import Config

config = Config()

# Provide a default if the variable is not set
config.load_configuration("DEBUG", default="false")

# Convert when getting the value
is_debug = config.get_value("DEBUG", factory=lambda x: str(x).lower() == "true")
print(is_debug)  # False

# Or convert during load
config.load_configuration("RETRIES", factory=int, default=3)
print(config.get_value("RETRIES"))  # 3

Multiple instances

Config implements a singleton-per-key pattern. Creating instances with different keys allows you to conceptually group configuration, but all loaded values are accessible from any instance.

from envcfglib import Config

app1 = Config("APP1")
app2 = Config("APP2")

# Suppose these are in the environment
# export APP1_VAR=alpha
# export APP2_VAR=beta

app1.load_configuration("VAR")
app2.load_configuration("VAR")

print(app1.get_value("VAR"))  # alpha
print(app2.get_value("VAR"))  # beta

Release files for envcfglib 0.1.6

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

Source distribution (sdist)

Source distribution for envcfglib 0.1.6
File Size Uploaded
envcfglib-0.1.6.tar.gz 17.3 kB Details

Built distribution (wheel)

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

Total release size: 21.3 kB

Release files / envcfglib-0.1.6.tar.gz

Download URL envcfglib-0.1.6.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
60ec200d5905e53a305abfb19df901025f16f32ea40dc6904fbc307c99d773f1
BLAKE2b-256 checksum
How to use checksums
15f239c5b9c7bcf2a0aa2ed945fc0edae22de253ca57f8e617b4af85a09719ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Sep 9, 2025.

Transparency log

Release files / envcfglib-0.1.6-py3-none-any.whl

Download URL envcfglib-0.1.6-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09b3d5d69f49e8f659726645e7024902cb1c2e771b5f7bc47be31ef2e03bafb3
BLAKE2b-256 checksum
How to use checksums
4e7595aa1b5fc036f953a374d98a72db602be6fdebceabb048d910be1eca80f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Sep 9, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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