ModelRepo
A Python package for managing database models using model repositories.
Features
- Easy to use
- Wide database support (In-memory, MySQL, MongoDB)
- Dependency injection using dependency-injector
Installation
You can install ModelRepo using pip:
pip install modelrepo
For development installation:
git clone https://gitlab.chalifour.dev/noahchalifour/modelrepo.git
cd modelrepo
pip install -e ".[dev]"
Quick Start
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.
Development
Setup Development Environment
# Clone the repository
git clone https://gitlab.chalifour.dev/noahchalifour/modelrepo.git
cd modelrepo
# Install development dependencies
pip install -e ".[dev]"
Running Tests
pytest
With coverage:
pytest --cov=src
Contributing
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
Please make sure your code follows the project's style guidelines and includes appropriate tests.
License
This project is licensed under the MIT License.
Contact
For questions and support, please open an issue on the GitLab repository.
Metadata
Release files for modelrepo 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| modelrepo-1.0.0.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| modelrepo-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / modelrepo-1.0.0.tar.gz
| Download URL | modelrepo-1.0.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e65fe051971341e923479aa51296bfcf2729b4264f2d8c1a3caca61c90b96b00
|
|
BLAKE2b-256 checksum How to use checksums |
0f9ef1bbdf27c7c7f2c549b7ed4e0d3b2553e91b8015946482b516b08129d21c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.11 Linux/6.8.0-59-generic
|
Release files / modelrepo-1.0.0-py3-none-any.whl
| Download URL | modelrepo-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6116704b7cdf38d1e4c4c318d6bb4752c9d85cd06c6d86959fc1b8d4cee1495c
|
|
BLAKE2b-256 checksum How to use checksums |
b6a81f80deeafa6b2d4c8712b5c876fb8c038176b1faa582d31f608d342c4eb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.11 Linux/6.8.0-59-generic
|