A Python package for managing database models using model repositories.
- Easy to use
- Wide database support (In-memory, MySQL, MongoDB)
- Dependency injection using dependency-injector
You can install ModelRepo using pip:
pip install modelrepoFor development installation:
git clone https://gitlab.chalifour.dev/noahchalifour/modelrepo.git
cd modelrepo
pip install -e ".[dev]"Here's a simple example to get you started:
from modelrepo.repository import InMemoryModelRepository
from dataclasses import dataclass
@dataclass
class User:
id: str
name: str
email: str
def main():
repository: InMemoryModelRepository[User] = InMemoryModelRepository(User)
user = repository.create({"name": "John Doe", "email": "test@email.com"})
print("Created user:", user)
if __name__ == "__main__":
main()For more examples, see the examples directory.
Documentation for the package can be found at https://noahchalifour.github.io/modelrepo/reference/modelrepo/
# Clone the repository
git clone https://gitlab.chalifour.dev/noahchalifour/modelrepo.git
cd modelrepo
# Install development dependencies
pip install e ".[dev]"pytestWith coverage:
pytest --cov=srcContributions 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
Please make sure your code follows the project's style guidelines and includes appropriate tests.
This project is licensed under the MIT License.
For questions and support, please open an issue on the GitLab repository.