Skip to main content

appfx.configuration

CI Publish PyPI Python versions License: MIT

appfx.configuration is a lightweight Python configuration utility for loading application settings from local .env files and Azure App Configuration.

The package is designed for applications that want predictable configuration loading, local-development overrides, and optional population of os.environ for libraries that read configuration from environment variables.

Features

  • Load .env values into os.environ.
  • Read Azure App Configuration values using DefaultAzureCredential.
  • Return merged configuration as dict[str, str].
  • Optionally write merged Azure and .env settings into os.environ.
  • Preserve existing process environment values by default.
  • Include a py.typed marker for typed consumers.

Package and import names

Purpose Name
PyPI distribution appfx-configuration
Python package appfx.configuration
.env helpers appfx.configuration.env
Azure App Configuration helpers appfx.configuration.azure

Installation

Install from PyPI after the package is published:

python -m pip install appfx-configuration

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

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

Configure Azure App Configuration

Copy the example environment file and set your Azure App Configuration endpoint:

Copy-Item .env.example .env

The required endpoint variable name is AZURE_APPCONFIG_ENDPOINT:

AZURE_APPCONFIG_ENDPOINT=https://<your-app-configuration-name>.azconfig.io

The Azure loader reads AZURE_APPCONFIG_ENDPOINT from .env or os.environ before connecting to Azure App Configuration. The local .env file is ignored by Git so local endpoints and secrets are not committed.

Authentication is handled by DefaultAzureCredential. Before loading Azure App Configuration values, authenticate with a supported Azure Identity mechanism such as Azure CLI sign-in, managed identity, or environment-based credentials.

Usage

Load .env values only

Use appfx.configuration.env when you only need local .env values loaded into os.environ.

from appfx.configuration.env import load_environment_variables

local_settings = load_environment_variables()

Read Azure App Configuration as a dictionary

Use load_app_configuration_settings() when you want a merged dictionary without writing Azure-only values into os.environ.

from appfx.configuration.azure import load_app_configuration_settings

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

Load Azure App Configuration into os.environ

Use load_app_configuration_environment() when downstream libraries expect configuration in environment variables.

from appfx.configuration.azure import load_app_configuration_environment

settings = load_app_configuration_environment()

Pass override=True to replace existing process environment values with loaded configuration values:

settings = load_app_configuration_environment(override=True)

Loading behavior

The loaders apply configuration in this order:

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

By default, existing process environment values win. Unrelated process environment variables are not included in returned settings dictionaries.

If AZURE_APPCONFIG_ENDPOINT is missing or blank, Azure helpers raise AzureAppConfigurationEndpointError with a setup-focused error message.

Public API

appfx.configuration.env

API Description
load_environment_variables(env_file=".env", override=False) Loads variables from a .env file into os.environ and returns the effective values for keys declared in that file.

appfx.configuration.azure

API Description
load_app_configuration_settings(...) Loads .env, reads Azure App Configuration, and returns merged settings as dict[str, str].
load_app_configuration_environment(..., override=False) Loads merged settings and writes them into os.environ.
create_default_credential() Creates the default Azure credential chain.
AzureAppConfigurationEndpointError Raised when AZURE_APPCONFIG_ENDPOINT is missing or blank.
AZURE_APPCONFIG_ENDPOINT_ENV_VAR Constant for the required endpoint environment variable name.

Development

Run the local validation suite:

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. Publishing does 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 Trusted Publisher field Value
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

.
├── .github/workflows/     # CI and PyPI publish workflows
├── docs/                  # Package documentation
├── examples/              # Usage examples
├── scripts/               # Maintenance/release script notes
├── src/appfx/configuration/
│   ├── azure/             # Azure App Configuration helpers
│   ├── env.py             # .env environment loader
│   └── py.typed           # Typing marker
└── tests/                 # Automated tests

License

This project is licensed under the MIT License. See LICENSE for details.

Metadata

Release files for appfx-configuration 0.1.1

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

Source distribution (sdist)

Source distribution for appfx-configuration 0.1.1
File Size Uploaded Provenance Actions
appfx_configuration-0.1.1.tar.gz 9.9 kB With provenance Details for appfx_configuration-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for appfx-configuration 0.1.1
File Interpreter ABI Platform Actions
appfx_configuration-0.1.1-py3-none-any.whl Python 3 none any Details for appfx_configuration-0.1.1-py3-none-any.whl

Total release size: 17.0 kB

Release files / appfx_configuration-0.1.1.tar.gz

Download URL appfx_configuration-0.1.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3644a243f8d43ed3241701fedcea3018df7a8daf35cbd14647845c13e40482d5
BLAKE2b-256 checksum
How to use checksums
7292c4253c620ecb01dd7d36772ef46c75828656e5f6c750c8d69d1fa49b4014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 27, 2026.

Transparency log

Release files / appfx_configuration-0.1.1-py3-none-any.whl

Download URL appfx_configuration-0.1.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75f14180781070822ec8c5cc4ed271dab6777d37385e8e61c078d6c259b155c1
BLAKE2b-256 checksum
How to use checksums
da30cb84056ac92c646213f074a91ea8937e126c848f527693f665946a9a17a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 27, 2026.

Transparency log

Security for appfx-configuration 0.1.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for appfx_configuration-0.1.1.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 May 27, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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