Skip to main content

Python client for AgileConfig with WebSocket updates and environment fallback

Project description

agileconfig-python

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.

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/*.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agileconfig_python-0.1.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agileconfig_python-0.1.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file agileconfig_python-0.1.2.tar.gz.

File metadata

  • Download URL: agileconfig_python-0.1.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for agileconfig_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4040b1a7b7bdd0e9761e697979d945f62add7a40c7d49c7d6984ab5787297c00
MD5 c271b4d7558625ce29bfe5e8d73a419c
BLAKE2b-256 20058af96dd201bc0dc1c4f581cc1fb734c23124c3a547ebe0c56ef5b8f228a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for agileconfig_python-0.1.2.tar.gz:

Publisher: publish.yml on IshootLaser/agileconfig-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agileconfig_python-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agileconfig_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5fcd4a3398dccb5188d2b0ee9998ff865d008e6e73bc554c8d27e725a27d2b79
MD5 f7525270fb0545b6591cb2d6d4a3ce63
BLAKE2b-256 98248ce3552a795da99b1c144a9961751ea8eccb79e648a3fd79301d77facbdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agileconfig_python-0.1.2-py3-none-any.whl:

Publisher: publish.yml on IshootLaser/agileconfig-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page