No project description provided
Project description
AIO-Conf
AIO-Conf is a tiny configuration system that unifies values from multiple sources: command-line arguments, environment variables, configuration files and defaults. Specifications are declared up front so each option knows how to be parsed and coerced into the correct Python type.
Installation
This project uses Poetry. From the project directory install dependencies with:
poetry install
Defining a specification
You can declare options programmatically using OptionSpec and ConfigSpec:
from aio_conf.core import ConfigSpec, OptionSpec
spec = ConfigSpec([
OptionSpec("port", int, default=8000, env="APP_PORT", cli="--port"),
OptionSpec("debug", bool, default=False, env="APP_DEBUG", cli="--debug"),
])
The spec can also be stored in JSON and loaded with
ConfigSpec.from_json_file() or via AIOConfig.load_from_spec().
Loading configuration
AIOConfig merges all sources with the following precedence:
- CLI arguments
- Environment variables
- File values (
jsonoryaml) - Defaults defined in the spec
from aio_conf import AIOConfig
cfg = AIOConfig(spec)
cfg.load(
cli_args=["--port", "9000"],
env={"APP_DEBUG": "true"},
file_path="config.json",
)
print(cfg.as_dict())
The env parameter accepts a mapping of environment variables and defaults to
os.environ when omitted.
Configuration can be written to an INI file:
cfg.save_ini("settings.ini")
Testing
Run the test suite with:
pytest -q
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aio_conf-1.0.0.dev7.tar.gz.
File metadata
- Download URL: aio_conf-1.0.0.dev7.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6244f4799df8f742f783cbe607708bd487af29ad64ae577dfb60e15e11c2cd25
|
|
| MD5 |
de003591e0506df90e863aeeb9de49ec
|
|
| BLAKE2b-256 |
8f62f929ee09cc2a87f117955718d9cc967312963f57f18db02ab3370228fd2e
|
Provenance
The following attestation bundles were made for aio_conf-1.0.0.dev7.tar.gz:
Publisher:
release.yml on Inspyre-Softworks/AIO-Conf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aio_conf-1.0.0.dev7.tar.gz -
Subject digest:
6244f4799df8f742f783cbe607708bd487af29ad64ae577dfb60e15e11c2cd25 - Sigstore transparency entry: 387135190
- Sigstore integration time:
-
Permalink:
Inspyre-Softworks/AIO-Conf@7a4b8a1d49de626f4ede99d05564c9ba5f5d6112 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Inspyre-Softworks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a4b8a1d49de626f4ede99d05564c9ba5f5d6112 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aio_conf-1.0.0.dev7-py3-none-any.whl.
File metadata
- Download URL: aio_conf-1.0.0.dev7-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f221f9aefc38c9e725a105addc94fdff060dae782b5478fd6a10c7520f67fc05
|
|
| MD5 |
93e95e7b80ae855575aa6293dde41e66
|
|
| BLAKE2b-256 |
9b783080634d5ab828ec3b0147dde7cf9b27f40a6f99ca56ae621bd94b1bc37b
|
Provenance
The following attestation bundles were made for aio_conf-1.0.0.dev7-py3-none-any.whl:
Publisher:
release.yml on Inspyre-Softworks/AIO-Conf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aio_conf-1.0.0.dev7-py3-none-any.whl -
Subject digest:
f221f9aefc38c9e725a105addc94fdff060dae782b5478fd6a10c7520f67fc05 - Sigstore transparency entry: 387135234
- Sigstore integration time:
-
Permalink:
Inspyre-Softworks/AIO-Conf@7a4b8a1d49de626f4ede99d05564c9ba5f5d6112 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Inspyre-Softworks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a4b8a1d49de626f4ede99d05564c9ba5f5d6112 -
Trigger Event:
push
-
Statement type: