proteus-config 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. proteus_config-0.2.0/.gitignore +207 -0
  2. proteus_config-0.2.0/LICENSE +21 -0
  3. proteus_config-0.2.0/PKG-INFO +252 -0
  4. proteus_config-0.2.0/README.md +195 -0
  5. proteus_config-0.2.0/pyproject.toml +117 -0
  6. proteus_config-0.2.0/src/proteus/__init__.py +48 -0
  7. proteus_config-0.2.0/src/proteus/adapters/__init__.py +20 -0
  8. proteus_config-0.2.0/src/proteus/adapters/base.py +57 -0
  9. proteus_config-0.2.0/src/proteus/adapters/env_adapter.py +121 -0
  10. proteus_config-0.2.0/src/proteus/adapters/json_adapter.py +67 -0
  11. proteus_config-0.2.0/src/proteus/adapters/toml_adapter.py +59 -0
  12. proteus_config-0.2.0/src/proteus/adapters/yaml_adapter.py +79 -0
  13. proteus_config-0.2.0/src/proteus/core.py +347 -0
  14. proteus_config-0.2.0/src/proteus/exceptions.py +88 -0
  15. proteus_config-0.2.0/src/proteus/formats/__init__.py +22 -0
  16. proteus_config-0.2.0/src/proteus/formats/base_format.py +44 -0
  17. proteus_config-0.2.0/src/proteus/formats/env_format.py +37 -0
  18. proteus_config-0.2.0/src/proteus/formats/json_format.py +37 -0
  19. proteus_config-0.2.0/src/proteus/formats/toml_format.py +28 -0
  20. proteus_config-0.2.0/src/proteus/formats/yaml_format.py +37 -0
  21. proteus_config-0.2.0/src/proteus/py.typed +0 -0
  22. proteus_config-0.2.0/src/proteus/readers/__init__.py +19 -0
  23. proteus_config-0.2.0/src/proteus/readers/base.py +101 -0
  24. proteus_config-0.2.0/src/proteus/readers/env_reader.py +27 -0
  25. proteus_config-0.2.0/src/proteus/readers/json_reader.py +27 -0
  26. proteus_config-0.2.0/src/proteus/readers/toml_reader.py +27 -0
  27. proteus_config-0.2.0/src/proteus/readers/yaml_reader.py +27 -0
  28. proteus_config-0.2.0/src/proteus/writers/__init__.py +19 -0
  29. proteus_config-0.2.0/src/proteus/writers/base.py +88 -0
  30. proteus_config-0.2.0/src/proteus/writers/env_writer.py +27 -0
  31. proteus_config-0.2.0/src/proteus/writers/json_writer.py +27 -0
  32. proteus_config-0.2.0/src/proteus/writers/toml_writer.py +27 -0
  33. proteus_config-0.2.0/src/proteus/writers/yaml_writer.py +27 -0
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luca Di Leo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: proteus-config
3
+ Version: 0.2.0
4
+ Summary: Unified configuration management library for Python
5
+ Project-URL: Homepage, https://github.com/lucadileo9/proteus
6
+ Project-URL: Documentation, https://github.com/lucadileo9/proteus#readme
7
+ Project-URL: Repository, https://github.com/lucadileo9/proteus
8
+ Project-URL: Issues, https://github.com/lucadileo9/proteus/issues
9
+ Author-email: Luca Di Leo <lucadileo70@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 Luca Di Leo
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: config,configuration,design-patterns,json,settings,yaml
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.8
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
43
+ Classifier: Topic :: System :: Systems Administration
44
+ Requires-Python: >=3.8
45
+ Requires-Dist: python-dotenv>=1.0
46
+ Requires-Dist: pyyaml>=6.0
47
+ Requires-Dist: tomli-w>=1.0.0
48
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
49
+ Provides-Extra: dev
50
+ Requires-Dist: bandit>=1.7.0; extra == 'dev'
51
+ Requires-Dist: mypy>=1.0; extra == 'dev'
52
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
53
+ Requires-Dist: pytest>=7.0; extra == 'dev'
54
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
55
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
56
+ Description-Content-Type: text/markdown
57
+
58
+ # Proteus
59
+
60
+ **Unified Configuration Management Library for Python**
61
+
62
+ [![CI](https://github.com/lucadileo9/proteus/actions/workflows/ci.yml/badge.svg)](https://github.com/lucadileo9/proteus/actions/workflows/ci.yml)
63
+ [![codecov](https://codecov.io/gh/lucadileo9/proteus/branch/main/graph/badge.svg)](https://codecov.io/gh/lucadileo9/proteus)
64
+ ![Python Versions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
65
+
66
+ 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.
67
+
68
+
69
+ ---
70
+
71
+ ## ✨ Features
72
+
73
+ - **Multi-format Support**: Load configurations from JSON, YAML, and TOML files seamlessly
74
+ - **Unified Interface**: Access all settings through a single, consistent API with dot-notation
75
+ - **Smart Merging**: Combine multiple configuration files with intelligent deep-merge
76
+ - **Translation Engine**: Convert configuration files between formats (e.g., YAML to JSON) programmatically
77
+ - **Thread-Safe**: Optional singleton access via `ConfigurationManager.instance()`
78
+ - **Context Manager**: Use `with ConfigurationManager.temporary()` for isolated workspaces
79
+ - **Easily Extensible**: Add support for new formats (TOML, XML, etc.) with minimal code
80
+ - **Zero Heavy Dependencies**: Only requires `pyyaml` for YAML support and `python-dotenv` for ENV
81
+
82
+ ---
83
+
84
+ ## πŸš€ Quick Start
85
+
86
+ ### Installation
87
+
88
+ ```bash
89
+ # Clone the repository
90
+ git clone https://github.com/lucadileo9/proteus.git
91
+ cd proteus
92
+
93
+ # Install in development mode
94
+ pip install -e .
95
+ ```
96
+
97
+ ### Basic Usage
98
+
99
+ ```python
100
+ from proteus import ConfigurationManager
101
+
102
+ config = ConfigurationManager()
103
+ config.load("examples/configs/app.yaml")
104
+
105
+ print(config.get("app_name"))
106
+ print(config.get("database.host"))
107
+ print(config.get("server.port"))
108
+ ```
109
+
110
+ Example output:
111
+
112
+ ```text
113
+ proteus-demo
114
+ localhost
115
+ 8080
116
+ ```
117
+
118
+ For a shared application-wide instance, use `ConfigurationManager.instance()`.
119
+
120
+ For detailed and comprehensive examples covering all formats (JSON, YAML, TOML, ENV), see the [examples/](examples/) directory.
121
+
122
+
123
+ ---
124
+
125
+ ## πŸ—οΈ Architecture & Design Patterns
126
+
127
+ Proteus is built on a foundation of proven design patterns from the Gang of Four catalog:
128
+
129
+ ### **Optional Singleton Pattern**
130
+ `ConfigurationManager.instance()` provides a single, global point of access to configuration when you want shared state, while direct construction still gives isolated instances.
131
+
132
+ ### **Context Manager**
133
+ `ConfigurationManager.temporary()` creates a short-lived manager for `with` blocks, automatically resetting state when the block ends.
134
+
135
+ ### **Facade Pattern**
136
+ Simple methods like `load()`, `get()`, `merge()`, `translate()`, and `translate_and_load()` hide the complexity of reader creation, file validation, and data normalization.
137
+
138
+ ### **Factory Method Pattern**
139
+ `FormatCreator` automatically selects and instantiates the appropriate reader/writer pair based on file extension, making format detection transparent.
140
+
141
+ ### **Template Method Pattern**
142
+ `BaseReader` and `BaseWriter` define fixed algorithms (validate β†’ read β†’ parse and validate β†’ serialize β†’ write) while allowing subclasses to customize only the format-specific steps.
143
+
144
+ ### **Adapter Pattern**
145
+ Each adapter converts a specific format into a unified internal representation (IR), so the manager works with consistent data structures.
146
+
147
+ For detailed architecture documentation and diagrams, see:
148
+ - [docs/architecture.md](docs/architecture.md) - Comprehensive architecture explanation
149
+ - [docs/manager.md](docs/manager.md) - Manager behavior and API details
150
+ - [docs/formats.md](docs/formats.md) - Reader/writer factory details
151
+ - [docs/readers.md](docs/readers.md) - Template Method reader behavior
152
+ - [docs/writers.md](docs/writers.md) - Template Method writer behavior
153
+
154
+ ---
155
+
156
+
157
+ ## πŸ§ͺ Development
158
+
159
+ ### Project Structure
160
+
161
+ ```
162
+ proteus/
163
+ β”œβ”€β”€ src/proteus/ # Source code
164
+ β”‚ β”œβ”€β”€ core.py # ConfigurationManager
165
+ β”‚ β”œβ”€β”€ exceptions.py # Custom exceptions
166
+ β”‚ β”œβ”€β”€ adapters/ # Format adapters
167
+ β”‚ β”œβ”€β”€ formats/ # Creator classes for readers/writers
168
+ β”‚ β”œβ”€β”€ readers/ # Template Method readers
169
+ β”‚ └── writers/ # Template Method writers
170
+ β”œβ”€β”€ examples/ # Usage examples and configs
171
+ └── docs/ # Documentation
172
+ ```
173
+
174
+ ### Toolchain
175
+
176
+ - **Linting & Formatting**: [Ruff](https://github.com/astral-sh/ruff) (ultra-fast all-in-one linter/formatter)
177
+ - **Type Checking**: [Mypy](http://mypy-lang.org/)
178
+ - **Testing**: [Pytest](https://pytest.org/) with [Pytest-Cov](https://github.com/pytest-dev/pytest-cov)
179
+ - **Security**: [Bandit](https://github.com/PyCQA/bandit)
180
+ - **Automation**: [Tox](https://tox.wiki/) (multi-version testing) and [Make](https://www.gnu.org/software/make/)
181
+
182
+ ### Makefile Commands (Cross-platform)
183
+
184
+ | Command | Description |
185
+ |---------|-------------|
186
+ | `make install-dev` | Install all development dependencies and pre-commit hooks |
187
+ | `make test` | Run the test suite and generate coverage report |
188
+ | `make lint` | Run Ruff to check for code style and logical errors |
189
+ | `make format` | Automatically format code and fix linting issues |
190
+ | `make typecheck` | Run Mypy to verify static type hints |
191
+ | `make tox` | Run tests against all supported Python versions |
192
+ | `make all` | Run format, lint, typecheck, and tests in sequence |
193
+ | `make build` | Prepare the package for distribution (wheel/sdist) |
194
+
195
+ ---
196
+
197
+ ## πŸŽ“ Educational Purpose
198
+
199
+ This project was developed as part of a Software Engineering course to demonstrate:
200
+
201
+ - **Design Patterns in Practice**: Real-world application of GoF patterns
202
+ - **SOLID Principles**: Clean architecture with clear responsibilities
203
+ - **Extensibility**: Open/Closed principle in action
204
+ - **Modular Design**: Separation of concerns and loose coupling
205
+
206
+ The codebase is intentionally structured to be readable and educational, with:
207
+ - Explicit pattern documentation in docstrings
208
+ - Clear separation between pattern responsibilities
209
+ - Comprehensive architecture documentation
210
+
211
+ 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.
212
+
213
+
214
+ ---
215
+
216
+ ## 🀝 Contributing
217
+
218
+ Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation:
219
+
220
+ 1. Fork the repository
221
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
222
+ 3. Make your changes
223
+ 4. Add tests if applicable
224
+ 5. Commit your changes (`git commit -m 'Add amazing feature'`)
225
+ 6. Push to the branch (`git push origin feature/amazing-feature`)
226
+ 7. Open a Pull Request
227
+
228
+ ---
229
+
230
+ ## πŸ“„ License
231
+
232
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
233
+
234
+ ---
235
+
236
+ ## πŸ™ Acknowledgments
237
+
238
+ - **Gang of Four** - For the foundational design patterns
239
+ - **Python Community** - For excellent libraries and best practices
240
+ - **Software Engineering Course** - For inspiring this project
241
+
242
+ ---
243
+
244
+ ## πŸ“ž Contact
245
+
246
+ **Luca Di Leo**
247
+ - GitHub: [@lucadileo9](https://github.com/lucadileo9)
248
+ - Repository: [proteus](https://github.com/lucadileo9/proteus)
249
+
250
+ ---
251
+
252
+ **Built with ❀️ and design patterns**
@@ -0,0 +1,195 @@
1
+ # Proteus
2
+
3
+ **Unified Configuration Management Library for Python**
4
+
5
+ [![CI](https://github.com/lucadileo9/proteus/actions/workflows/ci.yml/badge.svg)](https://github.com/lucadileo9/proteus/actions/workflows/ci.yml)
6
+ [![codecov](https://codecov.io/gh/lucadileo9/proteus/branch/main/graph/badge.svg)](https://codecov.io/gh/lucadileo9/proteus)
7
+ ![Python Versions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
8
+
9
+ 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.
10
+
11
+
12
+ ---
13
+
14
+ ## ✨ Features
15
+
16
+ - **Multi-format Support**: Load configurations from JSON, YAML, and TOML files seamlessly
17
+ - **Unified Interface**: Access all settings through a single, consistent API with dot-notation
18
+ - **Smart Merging**: Combine multiple configuration files with intelligent deep-merge
19
+ - **Translation Engine**: Convert configuration files between formats (e.g., YAML to JSON) programmatically
20
+ - **Thread-Safe**: Optional singleton access via `ConfigurationManager.instance()`
21
+ - **Context Manager**: Use `with ConfigurationManager.temporary()` for isolated workspaces
22
+ - **Easily Extensible**: Add support for new formats (TOML, XML, etc.) with minimal code
23
+ - **Zero Heavy Dependencies**: Only requires `pyyaml` for YAML support and `python-dotenv` for ENV
24
+
25
+ ---
26
+
27
+ ## πŸš€ Quick Start
28
+
29
+ ### Installation
30
+
31
+ ```bash
32
+ # Clone the repository
33
+ git clone https://github.com/lucadileo9/proteus.git
34
+ cd proteus
35
+
36
+ # Install in development mode
37
+ pip install -e .
38
+ ```
39
+
40
+ ### Basic Usage
41
+
42
+ ```python
43
+ from proteus import ConfigurationManager
44
+
45
+ config = ConfigurationManager()
46
+ config.load("examples/configs/app.yaml")
47
+
48
+ print(config.get("app_name"))
49
+ print(config.get("database.host"))
50
+ print(config.get("server.port"))
51
+ ```
52
+
53
+ Example output:
54
+
55
+ ```text
56
+ proteus-demo
57
+ localhost
58
+ 8080
59
+ ```
60
+
61
+ For a shared application-wide instance, use `ConfigurationManager.instance()`.
62
+
63
+ For detailed and comprehensive examples covering all formats (JSON, YAML, TOML, ENV), see the [examples/](examples/) directory.
64
+
65
+
66
+ ---
67
+
68
+ ## πŸ—οΈ Architecture & Design Patterns
69
+
70
+ Proteus is built on a foundation of proven design patterns from the Gang of Four catalog:
71
+
72
+ ### **Optional Singleton Pattern**
73
+ `ConfigurationManager.instance()` provides a single, global point of access to configuration when you want shared state, while direct construction still gives isolated instances.
74
+
75
+ ### **Context Manager**
76
+ `ConfigurationManager.temporary()` creates a short-lived manager for `with` blocks, automatically resetting state when the block ends.
77
+
78
+ ### **Facade Pattern**
79
+ Simple methods like `load()`, `get()`, `merge()`, `translate()`, and `translate_and_load()` hide the complexity of reader creation, file validation, and data normalization.
80
+
81
+ ### **Factory Method Pattern**
82
+ `FormatCreator` automatically selects and instantiates the appropriate reader/writer pair based on file extension, making format detection transparent.
83
+
84
+ ### **Template Method Pattern**
85
+ `BaseReader` and `BaseWriter` define fixed algorithms (validate β†’ read β†’ parse and validate β†’ serialize β†’ write) while allowing subclasses to customize only the format-specific steps.
86
+
87
+ ### **Adapter Pattern**
88
+ Each adapter converts a specific format into a unified internal representation (IR), so the manager works with consistent data structures.
89
+
90
+ For detailed architecture documentation and diagrams, see:
91
+ - [docs/architecture.md](docs/architecture.md) - Comprehensive architecture explanation
92
+ - [docs/manager.md](docs/manager.md) - Manager behavior and API details
93
+ - [docs/formats.md](docs/formats.md) - Reader/writer factory details
94
+ - [docs/readers.md](docs/readers.md) - Template Method reader behavior
95
+ - [docs/writers.md](docs/writers.md) - Template Method writer behavior
96
+
97
+ ---
98
+
99
+
100
+ ## πŸ§ͺ Development
101
+
102
+ ### Project Structure
103
+
104
+ ```
105
+ proteus/
106
+ β”œβ”€β”€ src/proteus/ # Source code
107
+ β”‚ β”œβ”€β”€ core.py # ConfigurationManager
108
+ β”‚ β”œβ”€β”€ exceptions.py # Custom exceptions
109
+ β”‚ β”œβ”€β”€ adapters/ # Format adapters
110
+ β”‚ β”œβ”€β”€ formats/ # Creator classes for readers/writers
111
+ β”‚ β”œβ”€β”€ readers/ # Template Method readers
112
+ β”‚ └── writers/ # Template Method writers
113
+ β”œβ”€β”€ examples/ # Usage examples and configs
114
+ └── docs/ # Documentation
115
+ ```
116
+
117
+ ### Toolchain
118
+
119
+ - **Linting & Formatting**: [Ruff](https://github.com/astral-sh/ruff) (ultra-fast all-in-one linter/formatter)
120
+ - **Type Checking**: [Mypy](http://mypy-lang.org/)
121
+ - **Testing**: [Pytest](https://pytest.org/) with [Pytest-Cov](https://github.com/pytest-dev/pytest-cov)
122
+ - **Security**: [Bandit](https://github.com/PyCQA/bandit)
123
+ - **Automation**: [Tox](https://tox.wiki/) (multi-version testing) and [Make](https://www.gnu.org/software/make/)
124
+
125
+ ### Makefile Commands (Cross-platform)
126
+
127
+ | Command | Description |
128
+ |---------|-------------|
129
+ | `make install-dev` | Install all development dependencies and pre-commit hooks |
130
+ | `make test` | Run the test suite and generate coverage report |
131
+ | `make lint` | Run Ruff to check for code style and logical errors |
132
+ | `make format` | Automatically format code and fix linting issues |
133
+ | `make typecheck` | Run Mypy to verify static type hints |
134
+ | `make tox` | Run tests against all supported Python versions |
135
+ | `make all` | Run format, lint, typecheck, and tests in sequence |
136
+ | `make build` | Prepare the package for distribution (wheel/sdist) |
137
+
138
+ ---
139
+
140
+ ## πŸŽ“ Educational Purpose
141
+
142
+ This project was developed as part of a Software Engineering course to demonstrate:
143
+
144
+ - **Design Patterns in Practice**: Real-world application of GoF patterns
145
+ - **SOLID Principles**: Clean architecture with clear responsibilities
146
+ - **Extensibility**: Open/Closed principle in action
147
+ - **Modular Design**: Separation of concerns and loose coupling
148
+
149
+ The codebase is intentionally structured to be readable and educational, with:
150
+ - Explicit pattern documentation in docstrings
151
+ - Clear separation between pattern responsibilities
152
+ - Comprehensive architecture documentation
153
+
154
+ 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.
155
+
156
+
157
+ ---
158
+
159
+ ## 🀝 Contributing
160
+
161
+ Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation:
162
+
163
+ 1. Fork the repository
164
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
165
+ 3. Make your changes
166
+ 4. Add tests if applicable
167
+ 5. Commit your changes (`git commit -m 'Add amazing feature'`)
168
+ 6. Push to the branch (`git push origin feature/amazing-feature`)
169
+ 7. Open a Pull Request
170
+
171
+ ---
172
+
173
+ ## πŸ“„ License
174
+
175
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
176
+
177
+ ---
178
+
179
+ ## πŸ™ Acknowledgments
180
+
181
+ - **Gang of Four** - For the foundational design patterns
182
+ - **Python Community** - For excellent libraries and best practices
183
+ - **Software Engineering Course** - For inspiring this project
184
+
185
+ ---
186
+
187
+ ## πŸ“ž Contact
188
+
189
+ **Luca Di Leo**
190
+ - GitHub: [@lucadileo9](https://github.com/lucadileo9)
191
+ - Repository: [proteus](https://github.com/lucadileo9/proteus)
192
+
193
+ ---
194
+
195
+ **Built with ❀️ and design patterns**