Skip to main content

agileconfig-python

CI Publish PyPI version Python versions

Python client for AgileConfig. The client loads configuration over HTTP, listens for reload notifications over WebSocket, and falls back to os.environ when the server is unavailable.

Installation

python -m pip install agileconfig-python

Usage

from agileconfig_python import AgileConfigLoader

loader = AgileConfigLoader(
	url="wss://config.example.com/ws",
	app_id="my-app",
	secret="your-secret",
	env="DEV",
)

database_host = str(loader.get_var("host", prefix="database"))
loader.stop()

The initial HTTP request populates the cache. When AgileConfig publishes a reload event, the cache is refreshed. If the server cannot be reached within the configured timeout, get_var_value reads the variable name from the process environment and ignores its prefix.

Singleton behavior and safety notes

AgileConfigLoader is a process-wide singleton. Creating it multiple times in the same Python process returns the same instance and does not reinitialize it.

Important implications:

  • Do not assume a second AgileConfigLoader(...) call with different credentials or URL will switch connections. The first initialization wins for the process lifetime.
  • Avoid creating loaders in many modules with different parameters. Prefer one startup location and reuse that instance.
  • Calling loader.stop() stops the shared background listener for the singleton. Other parts of your app using the same loader will stop receiving updates.
  • In tests, call stop() during teardown to avoid background-thread leakage across test cases.
  • If your process forks workers, create the loader inside each worker process after fork, not in the parent before fork.

API

  • AgileConfigLoader(url, app_id, secret, env) creates the singleton loader and starts its listener.
  • loader.get_var_value(var_name, prefix="") returns the current value, or an environment fallback.
  • loader.get_var(var_name, prefix="") returns a lazy string-like proxy that reads the latest value when converted with str().
  • loader.stop() closes the WebSocket and stops the listener thread.

Development

python -m pip install --upgrade pip build
python -m pip install -e .
python -m unittest discover -s unit_tests -v
python -m build

The live integration tests embedded in the source require an AgileConfig server and are not run by the offline unit-test command.

Release checklist

  1. Update version in pyproject.toml.
  2. Run the unit tests and python -m build.
  3. Inspect both artifacts with python -m twine check dist/*.
  4. Upload to TestPyPI and install the uploaded version in a clean environment.
  5. Create a Git tag matching the version, for example v0.1.0.
  6. Publish to PyPI with a trusted publisher or twine upload dist/*.

Metadata

Release files for agileconfig-python 0.1.5

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

Source distribution (sdist)

Source distribution for agileconfig-python 0.1.5
File Size Uploaded Provenance
agileconfig_python-0.1.5.tar.gz 6.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agileconfig-python 0.1.5
File Interpreter ABI Platform
agileconfig_python-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / agileconfig_python-0.1.5.tar.gz

Download URL agileconfig_python-0.1.5.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d7c050208fda6c64288cc4149d351f7bb2aadf0a7bc6fa009da57a799be1d41f
BLAKE2b-256 checksum
How to use checksums
1a776ad34a252910a34b6cd49ad7d5ea63864eb12fb0370361bfa5eb81420adc
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 Sep 24, 2026.

Transparency log

Release files / agileconfig_python-0.1.5-py3-none-any.whl

Download URL agileconfig_python-0.1.5-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cad842cff02932170e30916005fc939da0d9095d9024e91d815b3d266fd427a2
BLAKE2b-256 checksum
How to use checksums
e1fce29c05c3d20f8cb339560124b16030a0058d3b69b14de406e2ff8b328dcc
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 Sep 24, 2026.

Transparency log

Security for agileconfig-python 0.1.5

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.

Select from 2 files

Attestation for agileconfig_python-0.1.5.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 Sep 24, 2026.

Transparency log

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.

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