Skip to main content

A Python component scaffold for configuration utilities.

Project description

appfx.configuration

appfx.configuration is a typed Python configuration component with Azure App Configuration support. It can load .env values into environment variables, read settings from Azure App Configuration using DefaultAzureCredential, and optionally write Azure settings into os.environ for libraries that read from environment variables.

Package names

  • PyPI / distribution name: appfx-configuration
  • Python import namespace: appfx.configuration
  • Environment namespace: appfx.configuration.env
  • Azure configuration namespace: appfx.configuration.azure

Installation

Install the package from PyPI once published:

python -m pip install appfx-configuration

For local development, install the package in editable mode with developer tools:

python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

Configuration

Copy .env.example to .env, then replace the sample endpoint with your Azure App Configuration endpoint URL:

Copy-Item .env.example .env
AZURE_APPCONFIG_ENDPOINT=https://<your-app-configuration-name>.azconfig.io

The endpoint key name must be exactly AZURE_APPCONFIG_ENDPOINT. The Azure loader reads this value from .env / os.environ before connecting to Azure App Configuration.

.env is intentionally ignored by Git so local endpoints and secrets are not committed.

Usage

Load only .env values into os.environ:

from appfx.configuration.env import load_environment_variables

local_settings = load_environment_variables()

Read settings from Azure App Configuration and local .env values as a dictionary:

from appfx.configuration.azure import load_app_configuration_settings

settings = load_app_configuration_settings()
value = settings["MY_SETTING"]

Load .env and Azure App Configuration values into os.environ:

from appfx.configuration.azure import load_app_configuration_environment

settings = load_app_configuration_environment()

The loader uses DefaultAzureCredential, so authenticate with one of the Azure Identity-supported mechanisms before running code that contacts Azure, such as Azure CLI sign-in, managed identity, or environment-based credentials.

Loading behavior

load_app_configuration_settings() returns a dictionary and does not write Azure App Configuration values into os.environ. Use load_app_configuration_environment() when you want Azure values added to the process environment. Existing process environment values win by default; pass override=True to replace them with loaded configuration values.

The loaders use this precedence order:

  1. Azure App Configuration values load first.
  2. Values from .env override Azure values with the same key.
  3. Existing process environment values may override matching keys from .env.

Unrelated process environment variables are not included in the returned settings dictionary. If AZURE_APPCONFIG_ENDPOINT is missing or blank, the loader raises AzureAppConfigurationEndpointError with a clear setup message.

Validate locally

python -m pytest
python -m pytest --cov
python -m ruff check .
python -m ruff format --check .
python -m mypy
python -m build
python -m twine check dist/*

Publishing

This project is configured for PyPI Trusted Publishing through GitHub Actions, so releases do not require a PyPI API token in GitHub secrets or local terminals.

Before the first publish, create a PyPI pending publisher for appfx-configuration with these values:

  • PyPI project name: appfx-configuration
  • Owner: Dongbumlee
  • Repository name: appfx-configuration
  • Workflow name: publish.yml
  • Environment name: pypi

To publish a release, create and publish a GitHub release, or run the Publish workflow manually from GitHub Actions after the pending publisher is configured.

Project layout

  • src/appfx/configuration/ - package source
  • src/appfx/configuration/env.py - .env environment loader
  • src/appfx/configuration/azure/ - Azure App Configuration helpers
  • tests/ - automated tests
  • docs/ - package documentation
  • examples/ - runnable usage examples
  • scripts/ - maintenance/release script notes

Next steps

  • Add full public API documentation.

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

appfx_configuration-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

appfx_configuration-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file appfx_configuration-0.1.0.tar.gz.

File metadata

  • Download URL: appfx_configuration-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for appfx_configuration-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe6f14efa4d8b9da2eb86f2ad54a21811e0576788a401e734452642f65077473
MD5 813606713b6fa50ab0477c37ed57d0eb
BLAKE2b-256 9ea5436a11f5fbac1c40b1259a078bdbbfbd2999e86ebdef0ac4c8a9d364fdf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for appfx_configuration-0.1.0.tar.gz:

Publisher: publish.yml on Dongbumlee/appfx-configuration

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

File details

Details for the file appfx_configuration-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for appfx_configuration-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c4c4f463ed9b265075dfd1c60246cea96ec704b265b1dafc496805ede2bad7f
MD5 92a77c5ea175173175e58b05a7771146
BLAKE2b-256 6515706aedd4034b9b185356f1edbfb3eef128ad6cfa548685d5b463d71948d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for appfx_configuration-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Dongbumlee/appfx-configuration

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