https://github.com/phha/unifactory
Automatically choose the right polyfactory.
https://github.com/phha/unifactory
attrs beanie msgspec odmantic polyfactory pydantic sqlalchemy
Last synced: 4 months ago
JSON representation
Automatically choose the right polyfactory.
- Host: GitHub
- URL: https://github.com/phha/unifactory
- Owner: phha
- License: mit
- Created: 2024-01-04T13:09:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-04T13:10:53.000Z (about 2 years ago)
- Last Synced: 2025-10-27T01:36:35.669Z (5 months ago)
- Topics: attrs, beanie, msgspec, odmantic, polyfactory, pydantic, sqlalchemy
- Language: Python
- Homepage: https://pypi.org/project/unifactory/
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unifactory
Unifactory is a spin off from [fastapi-overrider](https://github.com/phha/fastapi-overrider).
A simple tool to automatically choose a matching factory from [polyfactory's inventory](https://polyfactory.litestar.dev/usage/library_factories/index.html).
## Installation
`pip install unifactory`
## Examples
```python
from polyfactory.pytest_plugin import register_fixture
from unifactory import unifactory, build, batch, coverage
@dataclass
class Person:
name: str
age: float
height: float
weight: float
some_person = build(Person)
five_persons = batch(Person, 5)
all_persons = coverage(Person)
person_factory = register_fixture(unifactory(Person), name="person_factory")
```