Skip to content

noahchalifour/modelrepo

Repository files navigation

ModelRepo

PyPI version Build Status Coverage Python Versions License

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.

Documentation

Documentation for the package can be found at https://noahchalifour.github.io/modelrepo/reference/modelrepo/

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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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.

About

A Python package for managing database models using model repositories.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages