Changelog 🕓
0.0.14 - 2026-11-17
A bug-fix release. Models that used to crash or fail validation now generate valid data, and many more pydantic types are supported.
Bug fixes
- One-sided bounds:
Field(ge=500),Field(le=-5)orField(ge=date(2200, 1, 1))no longer crash withempty range. When a single bound falls outside the default range, the range keeps its default width and moves next to that bound. This applies toint,float,Decimal,date,datetimeandtimedelta. timebounds at second 59:Field(gt=time(12, 0, 59))no longer raisessecond must be in 0..59.- Constrained types:
conint,constr,confloat,condecimal,conlist,conset,annotated_types.Interval,StringConstraintsand bareannotated_typesconstraints (Annotated[int, Gt(0)]) are now respected, including inside containers such asList[conint(gt=0)]. - Aliases: fields with an
aliasorvalidation_aliasnow validate. Models are built withmodel_validate(data, by_name=True). - Self-referencing models: models such as
class Node(BaseModel): children: List["Node"]no longer raiseRecursionError. Generation stops adding nested items once a model appears 3 times on a path. A self-reference that can never be empty (a requiredchild: "Node") raisesInvalidConstraints. Forward references to models defined later in the module are resolved, as pydantic does on first use. min_length=0is honoured, so lists, sets, tuples and dicts can be empty. Amin_lengthabove 5 with nomax_lengthno longer crashes.- Sets, frozensets and dict keys always reach
min_length. Values are generated until they are distinct, and an impossible request such asSet[bool]withmin_length=3raisesInvalidConstraints. - Reproducible UUIDs: every UUID version now draws from the seeded random stream, so
fake(Model, seed=1) == fake(Model, seed=1)holds for UUID fields too. Time-based versions (v1, v6, v7) use a timestamp from the 24 hours before the start of the current UTC day. - Relative and timezone types:
PastDate,FutureDate,PastDatetime,FutureDatetime,AwareDatetimeandNaiveDatetimeare supported, and no longer fail validation at random. - Unsupported types: instead of silently returning
None(which then failed validation), pyfake raisesGeneratorNotFoundwith the field path, e.g.No generator registered for type <class 'pathlib.Path'> (field 'User.avatar'). - Regex
patternis now enforced. Strings are generated from the parsed pattern and checked against it. - Callable
json_schema_extra:Field(json_schema_extra=lambda schema: ...)no longer raisesAttributeError. - Decimals: an unbounded
Decimalnow has 2 decimal places instead of ~50 digits of float noise, andmax_digitsis honoured. - Floats: exclusive bounds (
gt,lt) are now exact, so narrow ranges such asgt=0, lt=0.05stay valid. - Timeseries: the
shiftanomaly no longer raisesTypeError, and several shifts now stack. Theseasonal_anomalytype is implemented (it was a silent no-op). Seeding no longer changes NumPy's global random state. - Warnings: no more
PydanticSerializationUnexpectedValuewarnings for date and time bounds. fake.seed(42)now returns a reproducible stream: each call returns a new row, and the whole sequence is the same every run. Before, every call returned the same row. A per-callseed=still returns the same rows on every call.num=0returns[]instead of one row. A negativenumraisesValueError.
New supported types
EmailStr,NameEmailAnyUrl,HttpUrl,FileUrl,FtpUrl,WebsocketUrland every DSN type (PostgresDsn,RedisDsn,MongoDsn, ...). URLs use the schemes the type allows, onexample.*hosts.IPv4Address,IPv6Address,IPv4Network,IPv6Network,IPv4Interface,IPv6Interfaceand pydantic'sIPvAny*typesSecretStr,SecretBytes,bytes,ByteSize(and other subclasses of supported types)timedelta,Any,object,NoneFrozenSet,Sequence,MutableSequence,Iterable,deque,Mapping,MutableMapping,OrderedDict,DefaultDict,Counter,AbstractSet, and barelist/dict/tuple/setjson_schema_extra={"format": ...}accepts JSON Schema format names ("email","uri","ipv4","duration", ...) to pick a generator for astrfield.
Behaviour changes
- Seeded output differs from
0.0.13for UUIDs,Decimals, floats withgt/lt, sets, fields withmin_length=0, and timeseries noise, anomalies and missing values. Fake(seed=...)andfake.seed(...)keep one random stream across calls (see above).- Unsupported field types raise
GeneratorNotFoundinstead of returningNone. InvalidConstraintsis now also aValueError.- Generated models are built with
model_validate, so a custom__init__on your model is not called. TimeseriesraisesValueErrorfor an unknown anomalytype.
Docs
- Brought every page in line with the current behaviour: container length rules,
Decimaldefaults, regex support, seeding, the types returned in dicts (UUID, tuples, sets, enum members), and the error raised for unsupported types. - New page: Other types (emails, URLs, IP addresses, secrets, bytes,
timedelta, constrained types, abstract containers). - Rewrote the timeseries guide and added Advanced features (noise, seasonality, anomalies, missing values, value constraints).
- Fixed the Python version badge (3.10+), the requirements list, and links to the documentation site.
Testing
- 470 -> 1,242 tests; coverage 91% -> 99% (timeseries 61% -> 100%).
0.0.13 - 2026-06-27
New Features
- Timezone-aware datetimes: Pass any datetime.
tzinfosubclass — includingdatetime.timezoneconstants andzoneinfo.ZoneInfoinstances — throughjson_schema_extra={"timezone": ...}on a datetime field. Supporting attributes such as,
class Event(BaseModel):
# stdlib UTC constant
utc_ts: Annotated[
datetime, Field(..., json_schema_extra={"timezone": timezone.utc})
]
# IANA timezone via zoneinfo
ny_ts: Annotated[
datetime,
Field(..., json_schema_extra={"timezone": ZoneInfo("America/New_York")}),
]
0.0.12 - 2026-06-23
Major changes
-
Feature, allowing users to create more realistic and complex time series data. The implementation is designed to be extensible for future enhancements. (
pyfake/core/timeseries.py) -
Implemented support for
noise,seasonality,anomalies,missing values, and valueconstraintsin theTimeseriesclass. The class now includes methods to inject these features into generated data, and the constructor accepts new parameters for each
Docs
- Added detailed documentation for the new timeseries features, including explanations of noise, seasonality, anomalies, missing values, and constraints, along with code examples and usage guidelines. (advanced features)
- Replaced mermaid chart with a static image for better presentation
0.0.11 - 2026-06-21
Major changes
-
Added a new Timeseries class to pyfake.core.timeseries, supporting generation of time series data with configurable start, periods, frequency, baseline, trend (
upward,downward,flat), and reproducibility via seed. The implementation is extensible for future features like noise, seasonality, anomalies, and missing data, but currently implements only baseline and linear trend. (pyfake/core/timeseries.py) -
The project now depends on
Numpyfor internal calculations, and the documentation has been updated to reflect this change. The installation verification instructions have been removed from the docs since Numpy is now a required dependency. (docs/index.md)
Docs
- Added a comprehensive "Getting Started" guide for the new timeseries feature, including API usage, code examples, limitations, and tips for reproducibility. (
docs/timeseries/getting-started.md) - Updated the main documentation to clarify that Numpy is now a requirement and removed outdated installation verification instructions. (
docs/index.md) - Added a reference to the "how it works" section for further reading. (
docs/index.md)
0.0.10 - 2026-04-19
Minor changes
- Packaging and type hinting: Added a
py.typedmarker to the package data for pyfake in pyproject.toml, indicating that the package includes type hints for static type checkers.
0.0.9 - 2026-04-09
New Features
- Support for multiple_of constraint for numeric fields, allowing users to specify that generated numbers must be multiples of a given value. This is implemented in the generator registry and integrated into the schema resolution process.
- Improved support for the decimal_places option for both float and Decimal fields, with documentation clarifying floating-point precision nuances.
Docs - Added comprehensive new documentation pages for datetime and uuid usage, including examples, option explanations, and implementation notes. - Updated the README with a clearer quick example, a new feature matrix comparing pyfake to other generators, and a more concise project introduction.
0.0.8 - 2026-04-06
Major changes
- Introduced the Fake class as a new, user-friendly API for generating fake data (
from pyfake import fake), accessible via the fake singleton inpyfake/__init__.py. This class provides methods for generating data as dicts, models, or JSON, and supports seeding for reproducibility. (pyfake/core/api.py,pyfake/__init__.py)
New Features
- Added support for the
Decimaltype, including generator registration and type mapping in the registry. - Improved metadata parsing for field constraints (e.g.,
pattern,decimal_places) and fixed a bug in how these are extracted from Pydantic field metadata.
Docs - Added comprehensive usage guides for booleans, numbers (including constraints and Decimal), and strings, with examples and notes on supported/unsupported features. - Updated the main README.md with new documentation links and fixed minor formatting issues.
0.0.7 - 2026-04-02
Major changes
- Recursive generator support for nested Pydantic models
- Recursive resolver for resolving nested Pydantic models in the input Schema
New Features
- Support for
datetime,date&timeformats - Ability to set bounds using pydantic
Field()function - Flag based return for either accepting a dictionary or the input Pydantic model (
as_dict = True) - Updated ReadTheDocs documentation
- Support for
list,setandtupletypes with length constraints using pydanticField()function - Moving documentations to
zensicalfor better experience and future support.
0.0.6 - 2026-01-30
Major changes
- Migrated the entire project to
uvfor faster, deterministic dependency management and installs. - Introduced a new modular and expandable architecture, separating concerns into:
engine– execution and orchestration layerregistry– type to generator resolutioncontext– shared runtime state and randomness control
New Features
- Added full support for UUID generation across all formats:
UUID1,UUID3,UUID4,UUID5,UUID6,UUID7,UUID8- Added support for legacy primitive types:
intfloatstr- Introduced a reproducible generation context, allowing users to set a seed for deterministic fake data generation.
Testing
- Added comprehensive test coverage across all generators and core components.
- Tests now validate:
- Correct type resolution
- Deterministic output with seeded contexts
- UUID format correctness
- Edge cases across primitive and complex generators
0.0.5 - 2025-06-16
- Initial release