Repository navigation
First public release.
Added
build(cls, seed=..., **overrides)creates one object filled with test data.
Works with dataclasses, plain classes (fields read from__init__type hints)
and, with thepydanticextra, Pydantic v2 models.build_many(cls, n, seed=...)createsndifferent objects; the same seed
gives the same list.register(type, fn)adds a generator for a custom type, and
reset_registry()restores the defaults.- Supported types:
int,float,bool,str,bytes,Decimal,UUID,
datetime,date,time,timedelta,Enum,Literal,list,set,
dict,tuple,OptionalandUnion, nested classes, and
self-referencing classes (stopped at depth 3). - Realistic
strvalues for fields namedemail,name,first_name,
last_name,city,country,url,phone,username,title,
descriptionandslug. - Pydantic
Fieldconstraints:ge,gt,le,lt,min_length,
max_lengthand basicpatternregexes. - Error classes
PolarFactoryErrorandGenerationErrorin
polarfactory.errors. Both subclassTypeError, and every message says how to
fix the problem.