universal-common-configuration
A Python library inspired by Microsoft.Extensions.Configuration, providing a flexible configuration system for applications. This library allows you to load configuration data from various sources such as JSON files, environment variables, and user secrets.
Features
- Load configuration from multiple sources
- Support for JSON configuration files
- Hierarchical configuration structure
- Optional file loading
- Extensible design for adding new configuration sources
Installation
Install the package from PyPi using pip:
pip install universal-common-configuration
Usage
Basic Usage
from universal_common_configuration import ConfigurationBuilder, IConfiguration
# Create a configuration builder
builder = ConfigurationBuilder()
# Add a JSON file to the configuration
builder.add_json_file("config.json")
# Build the configuration
configuration: IConfiguration = builder.build()
# Access configuration values
database_name = configuration["Database:Name"] # or configuration.get_section("Database")["Name"]
port = int(configuration["Server:Port"])
connection_string = configuration.get_connection_string("StorageService") # short for configuration.get_section("ConnectionStrings")["StorageService"]
Working with Optional Files
# Add an optional JSON file
builder.add_json_file("optional_config.json", optional=True)
Combining Multiple Sources
Matched keys in later sources override the same key on earlier sources.
builder.add_json_file("appsettings.json")
.add_json_file(f"appsettings.{environment}.json", optional=True)
.add_environment_variables()
.add_user_secrets()
configuration = builder.build()
The various methods extending IConfiguration are monkey patched with the relevant import (eg. import universal_common_configuration.json for add_json_file or add_json_string).
Metadata
Release files for universal-common-configuration 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| universal_common_configuration-1.1.3.tar.gz | 12.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| universal_common_configuration-1.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / universal_common_configuration-1.1.3.tar.gz
| Download URL | universal_common_configuration-1.1.3.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4adb9dfaca56a7dee1e7f0a8eb1605024c35603fbf5b06e128e9f151c27b7456
|
|
BLAKE2b-256 checksum How to use checksums |
772aedf3ad4edde9cd3cca60ebf4eaf1f8ebfc6181df9dfe6a3b7790ee30fe8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / universal_common_configuration-1.1.3-py3-none-any.whl
| Download URL | universal_common_configuration-1.1.3-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4f2d857ff5938c2997c78920869ec35695f20b4eb495e16c6ef203268020d92
|
|
BLAKE2b-256 checksum How to use checksums |
b2eff2bde48055e0deb93a0fe5d59f38dc72a9a39f0606a32e5e856022c0cb1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for universal-common-configuration 1.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.