A powerful Python library for efficiently managing and resolving resources with dependency management.
- Resource dependency resolution
- Link management between resources
- Custom exception handling for resource conflicts
- Flexible resource definition and manipulation
- Thread-safe resource management
pip install resource_manager
Or using Poetry:
poetry add resource_manager
from resource_manager import ResourceManager
# Create a resource manager
rm = ResourceManager()
# Define resources
rm.add_resource("database", {
"host": "localhost",
"port": 5432,
"username": "user",
"password": "password"
})
rm.add_resource("web_app", {
"port": 8080,
"depends_on": ["database"]
})
# Resolve resources
resolved = rm.resolve()
# Access resources
database = resolved.get("database")
web_app = resolved.get("web_app")
Complete documentation can be found at https://mrjk.github.io/python-resource-manager/
The examples/
directory contains various usage examples:
- Basic resource management
- Dependency resolution
- Error handling
- Advanced configurations
Resources are the basic building blocks managed by this library. Each resource has:
- A unique identifier
- Properties and attributes
- Optional dependencies on other resources
Links define relationships between resources, allowing for complex dependency graphs and resource hierarchies.
The resolver is responsible for analyzing resource dependencies and providing a consistent, resolved view of all resources.
- Python 3.9+
- Poetry
# Clone the repository
git clone https://github.com/mrjk/python-resource-manager.git
cd python-resource-manager
# Install dependencies
poetry install
poetry run pytest
# Run linters
poetry run black resource_manager tests
poetry run pylint resource_manager
This project is licensed under the GNU General Public License v3 (GPLv3) - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
See CHANGELOG.md for details on version history and changes.
- mrjk - GitHub
- Thanks to all contributors who have helped shape this project
- Inspired by dependency resolution systems in various software ecosystems