repository (1.5.1)
Installation
pip install --index-url repositoryAbout this package
Repository layer for Python applications
Repository
This code defines a set of abstract base classes and interfaces for implementing repository patterns in Python using asynchronous programming. It provides a generic and extensible framework for handling CRUD (Create, Read, Update, Delete) operations on data models.
Description:
- IRepository: A generic interface serving as a base for all repository types.
- BaseGetRepository: Abstract base class for retrieving data. Includes methods for fetching all items (get), retrieving data in chunks (iter_get), and fetching single items (get_first and get_one).
- BaseCreateRepository: Abstract base class for creating new records. Supports single (create) and bulk creation (bulk_create), with chunked asynchronous processing (iter_bulk_create).
- BaseUpdateRepository: Abstract base class for updating records, offering similar functionality to creation with methods for single (update) and bulk updates (bulk_update).
- BaseRemoveRepository: Abstract base class for removing records, including single (remove) and bulk deletions (bulk_remove), with chunked processing (iter_bulk_remove).
- BaseRepository: A comprehensive repository combining all CRUD functionalities by inheriting from the individual base classes.
Features:
- Asynchronous Support: Leverages async/await for efficient I/O operations.
- Generic Design: Uses Python generics to allow type safety and flexibility.
- Chunked Processing: Enables large datasets to be processed in chunks to optimize memory and performance.
- Extensibility: Abstract methods enforce implementation, ensuring custom repositories adhere to the defined patterns.
This framework simplifies and standardizes repository implementation while maintaining flexibility for specific data access strategies.
Requirements
Requires Python: >=3.10
Details
Assets (2)
Versions (3)
View all
repository-1.5.1.tar.gz
32 KiB