Python package for interacting with databases using model repositories.
Project description
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.
Project details
Release history Release notifications | RSS feed
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 modelrepo-1.0.0.tar.gz.
File metadata
- Download URL: modelrepo-1.0.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.8.0-59-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e65fe051971341e923479aa51296bfcf2729b4264f2d8c1a3caca61c90b96b00
|
|
| MD5 |
e443aae1764ecd970752978f51555c4a
|
|
| BLAKE2b-256 |
0f9ef1bbdf27c7c7f2c549b7ed4e0d3b2553e91b8015946482b516b08129d21c
|
File details
Details for the file modelrepo-1.0.0-py3-none-any.whl.
File metadata
- Download URL: modelrepo-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.8.0-59-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6116704b7cdf38d1e4c4c318d6bb4752c9d85cd06c6d86959fc1b8d4cee1495c
|
|
| MD5 |
3903e94bc5d6a86509dbeaaa444b272b
|
|
| BLAKE2b-256 |
b6a81f80deeafa6b2d4c8712b5c876fb8c038176b1faa582d31f608d342c4eb8
|