Unified configuration management library for Python
Project description
Proteus
Unified Configuration Management Library for Python
Proteus is a Python library that provides a clean, pattern-based approach to managing application configurations. It allows you to load settings from multiple formats (JSON, YAML, TOML, ENV) and access them through a unified interface, regardless of the source format.
✨ Features
- Multi-format Support: Load configurations from JSON, YAML, and TOML files seamlessly
- Unified Interface: Access all settings through a single, consistent API with dot-notation
- Smart Merging: Combine multiple configuration files with intelligent deep-merge
- Translation Engine: Convert configuration files between formats (e.g., YAML to JSON) programmatically
- Thread-Safe: Optional singleton access via
ConfigurationManager.instance() - Context Manager: Use
with ConfigurationManager.temporary()for isolated workspaces - Easily Extensible: Add support for new formats (TOML, XML, etc.) with minimal code
- Zero Heavy Dependencies: Only requires
pyyamlfor YAML support andpython-dotenvfor ENV
🚀 Quick Start
Installation
# Clone the repository
git clone https://github.com/lucadileo9/proteus.git
cd proteus
# Install in development mode
pip install -e .
Basic Usage
from proteus import ConfigurationManager
config = ConfigurationManager()
config.load("examples/configs/app.yaml")
print(config.get("app_name"))
print(config.get("database.host"))
print(config.get("server.port"))
Example output:
proteus-demo
localhost
8080
For a shared application-wide instance, use ConfigurationManager.instance().
For detailed and comprehensive examples covering all formats (JSON, YAML, TOML, ENV), see the examples/ directory.
🏗️ Architecture & Design Patterns
Proteus is built on a foundation of proven design patterns from the Gang of Four catalog:
Optional Singleton Pattern
ConfigurationManager.instance() provides a single, global point of access to configuration when you want shared state, while direct construction still gives isolated instances.
Context Manager
ConfigurationManager.temporary() creates a short-lived manager for with blocks, automatically resetting state when the block ends.
Facade Pattern
Simple methods like load(), get(), merge(), translate(), and translate_and_load() hide the complexity of reader creation, file validation, and data normalization.
Factory Method Pattern
FormatCreator automatically selects and instantiates the appropriate reader/writer pair based on file extension, making format detection transparent.
Template Method Pattern
BaseReader and BaseWriter define fixed algorithms (validate → read → parse and validate → serialize → write) while allowing subclasses to customize only the format-specific steps.
Adapter Pattern
Each adapter converts a specific format into a unified internal representation (IR), so the manager works with consistent data structures.
For detailed architecture documentation and diagrams, see:
- docs/architecture.md - Comprehensive architecture explanation
- docs/manager.md - Manager behavior and API details
- docs/formats.md - Reader/writer factory details
- docs/readers.md - Template Method reader behavior
- docs/writers.md - Template Method writer behavior
🧪 Development
Project Structure
proteus/
├── src/proteus/ # Source code
│ ├── core.py # ConfigurationManager
│ ├── exceptions.py # Custom exceptions
│ ├── adapters/ # Format adapters
│ ├── formats/ # Creator classes for readers/writers
│ ├── readers/ # Template Method readers
│ └── writers/ # Template Method writers
├── examples/ # Usage examples and configs
└── docs/ # Documentation
Toolchain
- Linting & Formatting: Ruff (ultra-fast all-in-one linter/formatter)
- Type Checking: Mypy
- Testing: Pytest with Pytest-Cov
- Security: Bandit
- Automation: Tox (multi-version testing) and Make
Makefile Commands (Cross-platform)
| Command | Description |
|---|---|
make install-dev |
Install all development dependencies and pre-commit hooks |
make test |
Run the test suite and generate coverage report |
make lint |
Run Ruff to check for code style and logical errors |
make format |
Automatically format code and fix linting issues |
make typecheck |
Run Mypy to verify static type hints |
make tox |
Run tests against all supported Python versions |
make all |
Run format, lint, typecheck, and tests in sequence |
make build |
Prepare the package for distribution (wheel/sdist) |
🎓 Educational Purpose
This project was developed as part of a Software Engineering course to demonstrate:
- Design Patterns in Practice: Real-world application of GoF patterns
- SOLID Principles: Clean architecture with clear responsibilities
- Extensibility: Open/Closed principle in action
- Modular Design: Separation of concerns and loose coupling
The codebase is intentionally structured to be readable and educational, with:
- Explicit pattern documentation in docstrings
- Clear separation between pattern responsibilities
- Comprehensive architecture documentation
However, Proteus is designed for real use. The patterns aren't just academic exercises—they solve actual problems in configuration management and provide a foundation for production-ready features.
🤝 Contributing
Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests if applicable
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Gang of Four - For the foundational design patterns
- Python Community - For excellent libraries and best practices
- Software Engineering Course - For inspiring this project
📞 Contact
Luca Di Leo
- GitHub: @lucadileo9
- Repository: proteus
Built with ❤️ and design patterns
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
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 proteus_config-0.2.0.tar.gz.
File metadata
- Download URL: proteus_config-0.2.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09cc1692766687cc740507a9212d485bb7f30dfa01543507485677c8ce494b81
|
|
| MD5 |
1cc5e6cae5b7c67b49aebb78b5d52605
|
|
| BLAKE2b-256 |
f6b7c6e05b4dcbbea6cc32cfb09ae4c7c00ec366d9fa01ec2eb2c7345e311973
|
Provenance
The following attestation bundles were made for proteus_config-0.2.0.tar.gz:
Publisher:
publish.yml on lucadileo9/proteus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proteus_config-0.2.0.tar.gz -
Subject digest:
09cc1692766687cc740507a9212d485bb7f30dfa01543507485677c8ce494b81 - Sigstore transparency entry: 1703934186
- Sigstore integration time:
-
Permalink:
lucadileo9/proteus@fc86f2afeb10d0523ac93e1678503621ebfe50fd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/lucadileo9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc86f2afeb10d0523ac93e1678503621ebfe50fd -
Trigger Event:
release
-
Statement type:
File details
Details for the file proteus_config-0.2.0-py3-none-any.whl.
File metadata
- Download URL: proteus_config-0.2.0-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ff8112a84c9be87760305ea493573ded8160bc99901f79182faf944379c3865
|
|
| MD5 |
6d09f7327d32fa78440f970c530355f0
|
|
| BLAKE2b-256 |
e795aa0d834ca86725007230ec3aa71c54729cc5e5f57b6ee0414866cb3506dd
|
Provenance
The following attestation bundles were made for proteus_config-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on lucadileo9/proteus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proteus_config-0.2.0-py3-none-any.whl -
Subject digest:
8ff8112a84c9be87760305ea493573ded8160bc99901f79182faf944379c3865 - Sigstore transparency entry: 1703934201
- Sigstore integration time:
-
Permalink:
lucadileo9/proteus@fc86f2afeb10d0523ac93e1678503621ebfe50fd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/lucadileo9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc86f2afeb10d0523ac93e1678503621ebfe50fd -
Trigger Event:
release
-
Statement type: