pypi / polyfactory
polyfactory
What changed in polyfactory 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-24.
1 breaking3 new APIs and options1 behavior and defaults10 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpolyfactory 315 changes
Breaking changes 1
Default values are no longer fetched from TypedDict models.
New APIs and options 3
__use_examples__ is now supported in all factories.
Adds __persistence__method__ to SQLAlchemyFactory.
Adds support for SQLAlchemy computed fields.
Behavior and default changes 1
The session lifecycle is managed when a session is created implicitly.
Fixes and other changes 10
Pydantic factories now respect __by_name__ when fields define Field(alias=...).
Adds support for Python 3.15.
The by_name keyword argument is guarded for pydantic versions earlier than 2.11.
Timezone handling for end_date is fixed.
Date constraint handling now handles bool tz constraints from msgspec.Meta.
Resolution order now favours provider types.
Pydantic examples in nested type annotations are now supported.
More supporting BaseFactories are found for unsupported types.
TypedDictFactory now supports ReadOnly fields.
Leaves the async session opened after persisting data.