Polyfactory FactoriesΒΆ

The factories exported by this library are classes that extend the Abstract Base Class (ABC) BaseFactory.

These include:

DataclassFactory

a base factory for dataclasses

TypedDictFactory

a base factory for typed-dicts

ModelFactory

a base factory for pydantic models

BeanieDocumentFactory

a base factory for beanie documents

OdmanticModelFactory

a base factory for odmantic models.

MsgspecFactory

a base factory for msgspec Structs

AttrsFactory

a base factory for attrs models.

SQLAlchemyFactory

a base factory for SQLAlchemy models.

Note

All factories exported from polyfactory.factories do not require any additional dependencies. The other factories, such as ModelFactory, require an additional but optional dependency, in this case pydantic. As such, they are exported only from their respective namespaced module, e.g. polyfactory.factories.pydantic_factory.ModelFactory.

Note

We will be adding additional factories to this package, so make sure to checkout the above list from time to time.