Dynamic default value#1210
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1210 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 21 21
Lines 3689 3706 +17
Branches 726 730 +4
=======================================
+ Hits 3685 3702 +17
Misses 2 2
Partials 2 2 Continue to review full report at Codecov.
|
|
Discussed in #866 So I would like to see this: from datetime import datetime
from pydantic import BaseModel
class Record(BaseModel):
name: str
description: str
ts: datetime = datetime.now
record = Record(name='Foo', description='Bar and Baz also.')
print(record.ts)
#> 2020-02-06 22:11:43.454720However if type of field is callable, it must remain untouched: from random import randint
from typing import Callable
from pydantic import BaseModel
class IntGenerator(BaseModel):
fabric: Callable[..., int] = randint
generator = IntGenerator()
print(generator.fabric(0, 1))
#> 1@samuelcolvin, any thoughts? |
|
@MrMrRobat Thanks ! I thought about the implementation with |
ba4603a to
5f7fc5d
Compare
samuelcolvin
left a comment
There was a problem hiding this comment.
Mostly looks goods, needs tests fixing and docs.
|
|
||
| def __init__(self, default: Any, **kwargs: Any) -> None: | ||
| def __init__(self, default: Any = Undefined, *, default_factory: Any = None, **kwargs: Any) -> None: | ||
| if default is not Undefined and default_factory is not None: |
There was a problem hiding this comment.
perhaps better to move this check into Fieldm then you can use pop() as is done elsewhere.
| default: Any, | ||
| default: Any = Undefined, | ||
| *, | ||
| default_factory: Any = None, |
There was a problem hiding this comment.
| default_factory: Any = None, | |
| default_factory: Optional[Callable[[], Any]] = None, |
or something
|
I'm keen on the approach of from datetime import datetime
from pydantic import BaseModel
class Record(BaseModel):
ts: datetime = datetime.nowHowever I think it could cause subtle changes in behaviour in edge cases so let's wait for v2. Getting |
6b24d27 to
065cf78
Compare
| # With a callable: we still should be able to set callables as defaults | ||
| class FunctionModel(BaseModel): | ||
| a: int = 1 | ||
| uid: Callable[[], UUID] = Field(uuid4) |
There was a problem hiding this comment.
Had to use = Field(uuid) instead of = uuid4 as functions are ignored when creating fields and the default is hence not properly set
I think this behaviour should be fixed but in another PR (maybe for v2 with the other syntax for dynamic values)
| default: Any, | ||
| default: Any = Undefined, | ||
| *, | ||
| default_factory: Optional['Callable[[], Any]'] = None, |
There was a problem hiding this comment.
Had to use 'Callable...' because it would raise
TypeError: 'ABCMeta' object is not subscriptable
There was a problem hiding this comment.
How is that possible? It already used in this module without an issues. That could be the case for collections.Callable, but it's a different thing.
There was a problem hiding this comment.
Ah right ! I didnt' see the Callable came from .typing. Thanks !
96fa43c to
5b08aef
Compare
samuelcolvin
left a comment
There was a problem hiding this comment.
There's a chance we might need to change the signature or behaviour of default_factory in future.
Therefore might be useful to comment in the documentation that this feature is provisional and might change in future minor releases? See #1179 for an example.
Otherwise looking good.
| @@ -0,0 +1 @@ | |||
| Add `default_factory` `Field` argument to create a dynamic default value by passing a zero-argument callable. | |||
There was a problem hiding this comment.
| Add `default_factory` `Field` argument to create a dynamic default value by passing a zero-argument callable. | |
| Add `default_factory` argument to `Field` to create a dynamic default value by passing a zero-argument callable. |
| from typing import ( | ||
| TYPE_CHECKING, | ||
| Any, | ||
| Callable, |
There was a problem hiding this comment.
if the below is TypingCallable, what is this? Maybe good to give this an alias.
There was a problem hiding this comment.
I decided to add a NoArgAnyCallable directly in the local typing module. Makes things clearer imo
| """ | ||
| if self.default is not None and self.type_ is None: | ||
| self.type_ = type(self.default) | ||
| default_value = self.default_factory() if self.default_factory is not None else self.default |
There was a problem hiding this comment.
perhaps useful to have a get_default() function on this class which is used here and in main.py and perhaps deals with deepcopy?
|
@samuelcolvin Thanks for the review ! Changes done |
5b08aef to
3802985
Compare
3802985 to
fce7c10
Compare
samuelcolvin
left a comment
There was a problem hiding this comment.
otherwise looks good, sorry I missed this before.
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
|
@samuelcolvin When do you think a release will be ready with this PR? Looking forward to it! |
|
@jmagnusson see #1341 for details on release date. |
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b52670e84 Merge branch 'main' into add-fraction 383eb95a1 Turn off dependabot (#1892) 15b9c7b42 change README to archive note (#1850) 52b821dfc release: 2.41.5 (#1883) 65d7c44b6 optimizations in URL implementation (#1833) 4d23017bf revert url credential encoding (to be reintroduced as an option in future) (#1882) 2e932c696 add type inference for serializing ip address types (#1868) 4c9bec8af clean up GC traversal for some top-level types (#1870) bed9c14b8 fix issue with field_serializers on nested typed dicts (#1879) 4d3816745 update things fb5cecb22 adjustments based on PR comments 556009db8 remove debug statement from decimal 0eceff0e5 Merge branch 'add-fraction' of github.com:CloseChoice/pydantic-core into add-fraction ea511428b update fraction, add fraction validator tests and adjust to pass the tests 20d576b5b address trivial fixme (#1880) 83133d6b0 Bump astral-sh/setup-uv from 6 to 7 (#1872) fbf16d7b4 Bump percent-encoding from 2.3.1 to 2.3.2 (#1876) d25eda1f4 Bump actions/setup-node from 5 to 6 (#1871) adeeab94f Bump regex from 1.11.3 to 1.12.2 (#1877) 7cf998ee6 Bump actions/download-artifact from 5 to 6 (#1874) 2ddd6adbd Bump actions/upload-artifact from 4 to 5 (#1875) 9ef6565d5 Bump jiter from 0.11.0 to 0.11.1 (#1878) 191187ace ci: lint fixes for rust 1.91 (#1869) 4d4975aff refactor out common str serialization logic (#1867) 166072825 fix: only percent-encode characters in the userinfo encode set (#1852) e1aa528cf move `extra` inside of `state` (#1863) 9672f39e4 `JsonValue`: Deduplicate keys before populating Dict (#1865) db94945b6 ci: add more 3.14t builds, delete duplicate linux aarch64 build (#1864) f8927557e avoid getting default values from defaultdict (#1853) 33592411a move `check` from `Extra` to `SerializationState` (#1862) 5ef6e2b9b Update src/input/input_python.rs 423264f87 move `model` from `Extra` to `SerializationState` (#1860) 570d448ef move `include` / `exclude` into `SerializationState` (#1859) 49b72b235 move `field_name` from `Extra` to state (#1858) f1239f81d refactor model serialization (#1855) 98229775e pass `SerializationState` around (#1857) e8f13852c remove unnecessary code parts 2c710aa89 hand zero division error through 5f66a6580 remove test_fraction_decimal.py ff4df279d fix linting errors eed392bf0 Correct invalid serialization of `date`/`datetime`/`time`/`timedelta` by pulling downcast checks up (#1851) 2028880b4 WIP: fix linting errors and added test_fraction.py 2fce2cc72 WIP: try to fix linting 396499c61 Only check integrity before publishing (#1846) f0a967016 Fix integrity checking of wheel files during release (#1845) bd04c18eb Prepare release v2.41.4 (#1844) 31f510735 Check integrity of wheel files during release (#1843) e158fa1ae Prepare release v2.41.3 (#1840) 1f1255995 fix runs-on condition for linux builds (#1839) ff1aeae0f release: 2.41.2 (#1838) 03447637f fix various `RootModel` serialization issues (#1836) d90a93b4b ci: PGO-optimize linux aarch64, restore builds for windows aarch64 (#1837) eb48cad6d respect `field_serializer` when using `serialize_as_any=True` (#1835) 0425954d8 Populate `field_name` in `InternalValidator` (#1834) 1e1c96259 fix: encode credentials in MultiHostUrl builder (#1829) 534b6c201 fix minor typos in comments (#1832) 9222ef874 fix `clippy::manual_let_else` lint (#1830) 67cf14ab7 build PyPy manylinux wheels for x86_64 (#1831) 99460bf40 WIP: add fraction decimal 3043aba82 Populate field name for validation of default value (#1826) b46fd16f5 WIP: add fraction f5e72c30d Prepare release 2.41.1 (#1824) 3a729932a Add `url_preserve_empty_path` entry to `CoreConfig` (#1823) 6c643ee73 release: 2.41.0 310fe647d Preserve order for `collections.OrderedDict` (#1801) d90cdd1c0 make _pydantic_core._pydantic_core pub for static linking (#1820) a51a75369 ci: avoid timeout on aarch64 tests (#1821) b45d0870f fix `default_factory` which takes data on more types (#1822) e87ba01ee Do not call default factories taking the data argument if a validation error already occurred (#1623) 70bd6f97f Prepare release v2.40.1 (#1819) 32c76bf05 Only create class instance after validation in `ModelValidator.validate_construct()` (#1818) 8d06fac6f Bump `maturin` to v1.9.4 (#1817) d6774289a Add quotes to field name in serialization warning (#1816) 7a1a124c3 Reapply "Match return type of SerializationInfo.mode() to mode of model_dump() (#1770)" (#1797) (#1815) edfdce857 ci: fix pydantic integration test to actually use local core (#1814) 13a34ef0f release: 2.40.0 (#1812) 52d75108e Bump regex from 1.11.1 to 1.11.3 (#1804) 22e88b101 Bump CodSpeedHQ/action from 3 to 4 (#1805) 37d2ce4dd Bump actions/setup-python from 5 to 6 (#1803) b5fe42c63 Bump actions/download-artifact from 4 to 5 (#1808) 88c47386b Add field name in serialization error (#1799) 1887c34b1 Bump serde_json from 1.0.142 to 1.0.145 (#1811) f6656e246 Bump uuid from 1.17.0 to 1.18.1 (#1802) f19662c0d Bump idna from 1.0.3 to 1.1.0 (#1806) 3ec22a6fa Bump actions/checkout from 4 to 5 (#1810) 7c8555799 Bump actions/setup-node from 4 to 5 (#1807) 400a08332 Add option to preserve empty URL paths (#1789) ed0d1ca09 Reuse basic validators and serializers (#1795) 25b064926 Revert "Match return type of SerializationInfo.mode() to mode of model_dump() (#1770)" (#1797) ecbc893b0 fix `EitherString::as_cow` implementation (#1794) d0dbb097e Match return type of SerializationInfo.mode() to mode of model_dump() (#1770) 89917096a Add fail-fast for dicts (#1543) 1973ee3fa ci: simplify `test_definition_cycles` test (#1793) 0cd11fe51 Add GraalPy 3.12 to CI, build GraalPy wheels for more platforms (#1790) d7cdc8513 bump pyo3 to 0.26, jiter to 0.11 (#1785) cbe2dd25c tidy URL validator implementations (#1788) 1cd5ee3a9 add benchmark for wrap serializer (#1787) 313d19923 update hooky configuration (#1782) 13b1a3b60 chore: Correct grammar in docstring (#1784) b8321ccfa Add `extra` parameter to the validate functions (#1722) e0bc98076 Bump version to v2.39.0 (#1783) 5da40643c Add `exclude_computed_fields` serialization option (#1780) 4ba86e8b4 build: bump pytest to 8.4 (#1781) 17cbe988d docs: improve onboarding (#1775) 57e441180 release: 2.38.0 (#1779) a1b875731 Implement val_temporal_unit for deciding how datetimes and dates timestamps get validated. (#1751) 4c4ac6ed8 bump speedate to 0.17 (#1778) 46796b60b Build wheels for GraalPy (#1771) 1a945f6d3 Bump serde_json from 1.0.140 to 1.0.142 (#1772) 1ea1fef1c fix: make everything work on nightly (#1776) 68a1e7b2a feat: make TzInfo instantiable without any arguments (#1777) 1b3815c3e Benchmarks for perf (#1756) 04b296bfa Simplify `ValidationError.from_exception_data()` docstring (#1768) 550ee1693 Switch to PEP 639 license information (#1769) a630293e7 Fix CI job to create release (#1767) 0b5dff908 Bump version to v2.37.2 (#1766) 7072ec40e Add missing entries in `missing-sentinel` core schema (#1765) bb5a9b3bb Bump version to v2.37.1 (#1764) 50b585aa5 Bump version to v2.37.0 (#1763) b787c41ae Add `MISSING` sentinel (#1711) b1c9f21ed Use uv `UV_NO_PROGRESS` option when building on arch (#1761) 961285d09 Use uv `--no-progress` option when building on arch (#1760) c2617072a Bump version to v2.36.0 (#1759) f36713886 Add `exclude_if` logic at the field level (#1535) eeb51e8e6 Properly coerce fractions as int (#1757) 37ec6e750 Implement ser_json_temporal config option (#1743) d523cf57c Bump pyo3 from 0.25.0 to 0.25.1 (#1753) cabfc436e Bump uuid from 1.16.0 to 1.17.0 (#1754) 48643d01b Bump smallvec from 1.15.0 to 1.15.1 (#1752) b4fd51781 Stop testing free-threaded on 3.13 (#1738) 5f0b5a8b2 Bump version to v2.35.2 (#1748) 5e3bbb5b4 Better document `SerializationInfo` (#1747) d9dacb01a update to `speedate` 0.16 (#1740) 3415428fe Bump version to v2.35.1 (#1737) fff2a3cf5 Fix generic issues with `ValidationInfo` and `SerializationInfo` (#1736) 6ecf7f9f0 remove twine install from release job in ci e8e4d3d80 fix release job in CI (#1735) 1802ea539 Fix release CI (#1733) 0509d9048 Bump version to v2.35.0 (#1732) 477b9b320 Make `ValidationInfo` and `SerializationInfo` generic for `context` (#1686) a7bd9f803 Update repr of `TzInfo` (#1701) d7bfe90a0 Add `ensure_ascii` option (#1689) 52e9a5309 drop pypy3.9 support, add pypy3.11 support (#1726) 4e8541100 bump python3-dll-a to fix 3.14 windows build (#1731) 94ac927d0 Add support for Python 3.14 (#1714) ef455b40e Improve uncaught `PydanticUseDefault` exception message (#1730) 0b898d2e3 Remove core schema validation (#1715) 0ef2eb1ac Bump jiter from 0.9.0 to 0.9.1 (#1728) 1f2a2e8fa Bump ahash from 0.8.11 to 0.8.12 (#1727) 238c1c745 drop serde-json `preserve_order` feature (#1724) 22d34a73e Coerce `'time'` schema constraints (#1720) e43c144a6 fix wasm-preview 774778195 simplify ser-as-any mechanism (#1478) e20b74efb Add Codecov Test Analytics (#1684) 5c56fde19 add critical sections around bytearray reads (#1717) c0f4a7f69 ci: fix coverage job (#1713) de128b4f1 use `pypa/gh-action-pypi-publish` (#1599) 4375d6ad1 fix: submodel fields with wrap validator affect smart union selection (#1700) cc3ac4634 Mark constructor parameters of exceptions as positional-only (#1699) bd24ed00f Update test dependencies after 3.8 dropped support (#1710) f0106b913 Remove unecessary required fields count when `exclude_none` is set (#1708) d03bf4a01 Bump uraimo/run-on-arch-action from 3.0.0 to 3.0.1 (#1707) bc2f98cb8 Bump astral-sh/setup-uv from 5 to 6 (#1706) 7347eb4d1 Bump smallvec from 1.14.0 to 1.15.0 (#1705) e8ee342b3 Bump pyo3 from 0.24.1 to 0.24.2 (#1704) fc2d1e3e9 Bump serde from 1.0.218 to 1.0.219 (#1703) 334a9b0f3 Do not reuse validator and serializer when unpickling (#1693) 34147034f Bump version to v2.34.1 (#1698) 5bb2d6273 Mark some tests as xfailing on free-threaded (#1697) 2bcce9fca Fix CI condition for `release` job x2 (#1696) 0d034502a Fix CI condition for `release` job (#1695) 60bccf17b Bump version to v2.34.0 (#1694) 4760f383a Ensure `ValidationInfo.field_name` is correct on validator reuse (#1692) 9a25aa69f Allow JSON `BigInt` to validate against `float` schema (#1685) 0a5bbfc11 Bump pyo3 from 0.24.0 to 0.24.1 (#1677) 59e655ef3 Bump serde_json from 1.0.138 to 1.0.140 (#1679) 5a32b4f13 Bump uuid from 1.15.1 to 1.16.0 (#1678) ee8c173f3 fix clippy lints for Rust 1.86 (#1682) baa8cbf4d Bump version to v2.33.1 (#1681) f6ded645f Pin `inline-snapshot` with an upper bound to fix wasm build (#1680) 104d39889 Coerce `'timedelta'` schema constraints (#1676) 6c936de5a Bump version to v2.33.0 (#1673) f977516d5 Revert `by_alias` default value change for `to_json()` and `to_jsonable_python()` (#1672) f25653179 Add support for extra keys validation for model fields (#1671) ac17f0c92 Bump version to v2.32.0 (#1670) f3fa016e9 Add `TzInfo.__new__` stub method (#1611) 1defe6294 Add new `arguments-v3` schema (#1641) 53bdfa62a update authors (#1668) aa142f94a bump jiter to 0.9, pyo3 to 0.24 (#1667) d8be765fb Bump version to `v2.31.0` (#1664) 94d7985e7 Skip reusing after validators in prebuilt schemas (#1663) c3be32d78 Bump version to v2.31.0 (#1662) a6f397286 Coerce validator constraints to their valid type (#1661) 0761adb45 Add `cls_name` to `typed-dict` schema (#1659) 72350a135 Skip reusing wrap validators / serializers for prebuilt variants (#1660) 66c8c58bb Clean up `PydanticUnexpectedValueError` (#1652) 8b7bda658 Bump smallvec from 1.13.2 to 1.14.0 (#1654) db340609d Bump uuid from 1.12.1 to 1.15.1 (#1655) eab183d6d Bump serde from 1.0.217 to 1.0.218 (#1657) 30df64158 Bump uraimo/run-on-arch-action from 2.8.1 to 3.0.0 (#1658) 9975030e1 Bump version to v2.30.0 (#1648) 8c59fa295 Improving the alias configuration API for validation and serialization (#1640) 7dc19c365 update python3-dll-a for PyPy 3.11 (#1647) c40a138f8 Fix strict behavior for unions (#1638) 21eef8db7 bump to PyO3 0.23.5, support PyPy 3.11 (#1646) bd0bde24f Fix typo in `InitErrorDetails.type` documentation (#1645) 6a31b3b70 Add API documentation for `ErrorDetails.url` (#1642) 248bd8b81 Remove unneeded `Option` map in `PyMultiHostUrl.build` (#1643) 68b678de2 pin nightly for wasm build (#1644) a0e60bd00 Add support for UUIDv6 and UUIDv8 validation (#1636) 741961c05 refactor `LookupKey` logic to reduce redundancy (#1635) 7da479897 Add support for validating v7 UUIDs (#1634) 0a467e9a6 Fix enum strict JSON validation when validators are present (#1632) 51bae7d86 Bump url from 2.5.2 to 2.5.4 (#1585) 2e4134c08 Use core schema fns to initalize `SchemaValidator`s in the test suite. (#1631) f1aaaaf14 Prep for v2.29.0 release :) (#1630) ce467563c support free-threaded Python 3.13t (#1628) db63fecda disable `inline-snapshot` on 3.13t test run (#1627) 944658816 Fix condition before using prebuilt validator/serializer (#1625) 4e824dff5 add test run for 3.13t (#1626) f7fb50bdc Raise validation error when unhashable items added to a set (#1619) 0862ea5da build PGO wheels on `macos-latest` runners (#1624) 164b9ff9e Memory usage optimization via reuse of `SchemaValidator` and `SchemaSerializer` (#1616) 3707dcdd2 fix wasm preview (#1621) fdccecd3d always use maturin for the uv commands in Makefile (#1622) ed15f6cae Fix float `multiple_of` validation for negative numbers (#1373) e89bd8cf7 Bump serde_json from 1.0.134 to 1.0.138 (#1617) e5b249edf Bump uuid from 1.11.0 to 1.12.1 (#1618) 009b94853 Bump version to v2.28.0 (#1615) 0ede4d11f Add back `stubtest` check (#1610) 875852856 resolve remaining deprecation warnings from PyO3 0.23 (#1584) 261c7ab39 Fix: `dataclass` `InitVar`s shouldn't be required on serialization (#1602) 82b7aa77d Remove `pyupgrade` as an explicit linting dependency (#1606) b426cce3c Drop 3.8 support (#1604) e572f55aa Linting / formatting updates (#1603) 2c2731970 Bump serde_json from 1.0.133 to 1.0.134 (#1594) ecaa1a03a Bump serde from 1.0.216 to 1.0.217 (#1595) e7c5dc762 Bump astral-sh/setup-uv from 4 to 5 (#1596) 562fad3e3 pass `--uv` flag to `maturin develop` (#1591) b6395cf78 optimize refcounting op in datetime creation (#1590) b5c3e141e bump version to 2.27.2 (#1589) d3a2f4719 Bump serde from 1.0.215 to 1.0.216 (#1586) 15adfc787 fix `ValueError` on year zero (#1583) 39435c236 remove uses of IntoPy (#1578) bd91c180c fix wasteful `to_python()` calls checking for undefined (#1580) 730adc347 add benchmark for root model validation (#1581) 80756c197 clean up deprecations in PyO3 0.23 for tests / benches (#1575) d7650d115 Move from `_bound` suffixed APIs as part of PyO3 0.23 update (#1577) 98bc1e2a3 Include JSON Schema input core schema in function schemas (#1572) 6a455fbfc fix type hint for `SerializationInfo.round_trip` (#1576) 7f13140ef Forward `default_value` calls to the underlying schema for `DefinitionRefValidator` (#1573) 4c02cbd0a Fix typo in `PydanticUseDefault` docstring (#1571) 707b440c5 bump jiter to 0.8.2, PyO3 to 0.23.3 (#1570) be87e05d7 Use UserWarning from pyo3 (#1559) ab0e4bd32 Bump python3-dll-a from 0.2.10 to 0.2.11 (#1566) 167ffcf86 remove `python3-dll-a` dependency (#1568) ce03db571 Bump serde from 1.0.214 to 1.0.215 (#1565) 3bb1eb1c2 Bump idna from 1.0.2 to 1.0.3 (#1567) 6b49c1ec4 Bump serde_json from 1.0.132 to 1.0.133 (#1564) 8e867bc24 Bump astral-sh/setup-uv from 3 to 4 (#1563) c278ba6d7 Bump codecov/codecov-action from 4 to 5 (#1562) 298e4eadc Fix lint errors with toolchain 1.83 (#1561) 5c96bec06 minimal upgrade to PyO3 0.23 (ignoring deprecations) (#1556) 334e3df6a ci: fix PGO build on windows (#1558) 49bcd5104 fix linux PGO wheel build (#1557) 83ff1cfd0 Version bump -> v2.27.1 (#1553) e4de8a68e Fix performance regression for JSON tagged union (#1552) 4477692c0 bump to PyO3 0.22.6 (#1550) afd23eea7 Fix serialization inference for `complex` types in `python` (#1549) 1e5e89905 Use `uv` in `Makefile` and CI (#1546) c9d01c3ba Use `uv` for `pydantic` install (#1545) 30f6f55e4 tidy up some uses of `Bound<'_, PyString>::to_str` (#1544) 6472887b3 WIP: Simplify shared union serializer logic (#1538) 061711f96 Prep for v2.27.0 release (#1541) be03c66bd support `trailing-strings` with `allow_partial` (#1539) a3f13c737 fix `wrap` serializer breaking union serialization in presence of extra fields (#1530) cd0346d68 More union serialization tidying (#1536) cd270e403 Fix `_IncEx` type alias to be compatible with mypy (#1537) 2419981d9 fix(union_serializer): do not raise warnings in nested unions (#1513) 4cb82bfb5 fix panic in `validate_assignment` when field has gone missing (#1532) 085e61dba Remove `Url` and `MultiHostUrl` docstrings, we moved them to pydantic (#1531) 815d22486 Bump the python-packages group across 1 directory with 7 updates (#1529) 96038dd87 Bump version to prep release (#1527) c864ff297 bump speedate to 0.15 (#1526) a1fa59624 Add `allow_partial` (#1512) 5e95c05a5 Bump jiter from 0.6.1 to 0.7.0 (#1521) 2ee8fa880 Fix serializing complex values in enums (#1524) 184e7be2d Bump regex from 1.11.0 to 1.11.1 (#1520) 4d90f4407 Bump serde from 1.0.213 to 1.0.214 (#1519) 5dd2992f4 Fix when coerce_numbers_to_str enabled and string has invalid unicode character (#1515) 89bdee10c Revert changes to url schemas that support `cls`, the 2x validation isn't worth it (and is breaking) (#1514) 921701990 Patch version bump -> v2.25.1 (#1509) fe736529f Support subclass inits for `Url` and `MultiHostUrl` (#1508) 8568136ee Revert "feat: add 'millisecond' option to `ser_json_timedelta`" (#1503) 9b29661c2 Update Pyodide to v0.26.3 (#1507) 9b21b0f62 Allow subclassing ValidationError and PydanticCustomError (#1413) 7c70e3b33 Bump jiter from 0.5.0 to 0.6.1 (#1498) e16198067 Bump pyo3 from 0.22.3 to 0.22.5 (#1497) ed8f2e1b5 Bump uuid from 1.10.0 to 1.11.0 (#1496) 75738b006 Bump serde from 1.0.210 to 1.0.213 (#1495) e62befe2c Bump serde_json from 1.0.128 to 1.0.132 (#1494) d1aff8970 Bump uraimo/run-on-arch-action from 2.7.2 to 2.8.1 (#1493) e49c549f6 Bump version to v2.25.0 (#1492) ff08c20f5 Support default factories taking validated data as an argument (#1491) 288dd1c87 Support revalidation of parametrized generics (#1489) 1ced3e6b4 Properly enforce `host_required` for URLs (#1488) 92a259ea1 Version bump to v2.24.2 (#1485) c38a68d85 Add `serialization` key to `InvalidSchema` (#1482) bbd4de528 ci: fix for ubuntu 24.04, use Python 3.13 for scripts (#1484) 10374e2db Bump version to v2.24.1 (#1481) b773c9d44 Relax intensity of error for `issubclass` and `isinstance` schemas from json (#1479) dc4846e50 ci: add flag to integration tests to mitigate schema changes (#1480) 903a1a98b ci: add prebuilt musl for armv7 (#1477) 0af18c417 Add `invalid` schema placeholder (#1469) e3eff5cb8 Bump regex from 1.10.6 to 1.11.0 (#1470) 019104338 Bump serde from 1.0.209 to 1.0.210 (#1471) a8303e53f Bump pyo3 from 0.22.2 to 0.22.3 (#1472) f38972843 Fix equality checks for primitives in literals (#1459) 4aa52a8fe limit windows builds to Rust 1.77 (to keep Windows 7 support) (#1463) bfccf0983 restore Windows aarch64 builds (#1464) 31a5156d8 Prep for v2.24.0 (#1458) f3f436e95 Add support for unpacked `TypedDict` to type hint variadic keyword arguments in `ArgumentsValidator` (#1451) 8c1a0da3a Support wider variety of enum validation cases (#1456) e0b4c9405 feat: add 'millisecond' option to ser_json_timedelta config parameter (#1427) bc0c97add Do not require padding when decoding base64 bytes (#1448) dbe03f68e version bump 4a0c332b9 Clean up serialization warnings for invalid data in unions (#1449) 16331d71a Fix variance issue in `_IncEx` type alias, only allow `True` (#1453) ba8eab4ac Bump version to v2.23.3 (#1444) 3bd1baac3 Fix `_IncEx` type annotation (#1443) f2a0bb81d Fix tagged union serialization warning when using aliases (#1442) c462f775c Bump serde_json from 1.0.127 to 1.0.128 (#1440) 6169ea91a Improve test_valid_complex_string_with_space() xfail condition (#1441) dec5faa27 Negative integers with leading zeros raise ValueError (#1436) e1cd613f3 Bump serde_json from 1.0.121 to 1.0.127 (#1433) bc540483f Bump regex from 1.10.5 to 1.10.6 (#1432) e26afb836 Bump uuid from 1.9.1 to 1.10.0 (#1431) 4bd42980e Bump idna from 1.0.1 to 1.0.2 (#1430) 638e33df2 Bump serde from 1.0.204 to 1.0.209 (#1429) 4dabe3c65 Bump the python-packages group with 8 updates (#1428) fa6b75b76 Try removing flaky xfail test (#1439) 0946d71cb Version bump for docs update (#1438) fcdca0f6f Adding missing API docs to `pydantic_core` (#1420) d93e6b154 Prep for `v2.23.1` patch release (#1425) cd04138fe Refactor `BigInt` boilerplate (#1421) d0384c788 Support `BigInt` serialization for `int` subclasses (#1417) f4a06755d Use more explicit warning regarding serialization warning for missing fields (#1415) 4113638a8 Prep for v2.23.0 (#1412) 51c412b3b Breaking change: Change `metadata` type hint from `Any` -> `Dict[str, Any] | None` (#1411) b12765200 Adding `cls` reference to `TypedDictSchema` (#1410) de04f032c Disable automatic assignees with `hooky` (#1408) a6d0d631b Version bump to prep for new release (#1406) 08a99b527 Introduce `exactness` into `Decimal` validation logic (#1405) fdd1e85f3 Adding tagged union serializer 🚀 (#1397) 3d8295efe Support complex numbers (#1331) bb67044c6 Use `typing_extensions.TypedDict` on Python < 3.12 (#1404) a0725759f For missing fields, we don't warn on `exclude_`, so don't warn on `exclude` (#1403) 39a6b104f Fix float serialization behavior in strict mode (#1400) 7368c1f76 stop clone-ing serializers (#1402) fd81a7572 Try each option in union serializer before inference (#1398) 863640b29 Show value of wrongly typed in serialization warning (#1377) 585f72563 Validate base64 standard encoding (#1395) e07c41b3b dont embed `RUSTFLAGS` in final binary (#1396) 6e96b85a8 Expose AnySerializer via core schema (#1394) f79d49bdf Revert "use little endian int (#1372)" (#1393) 81106d9e7 Uprev to v2.21.0 (#1391) 099a8e125 Support `allow_partial='trailing-strings'` (#1390) cc2c46c92 Bump base64 from 0.21.7 to 0.22.1 (#1386) c5a42612c clean up some string handling cases (#1381) 507ff47e6 Bump serde from 1.0.203 to 1.0.204 (#1385) 111109691 Bump serde_json from 1.0.118 to 1.0.121 (#1384) a1ee73642 Bump pyo3 from 0.22.0 to 0.22.2 (#1383) 0ff28ea0b Bump version_check from 0.9.4 to 0.9.5 (#1382) 3a5f2cbae Bump the python-packages group with 7 updates (#1388) 0a6a839cf Bump CodSpeedHQ/action from 2 to 3 (#1387) 57e699186 Validate bytes based on ser_json_bytes (#1308) 40b8a947c Fix lints firing since rust 1.80 (#1379) 06a834887 Bump idna from 0.5.0 to 1.0.1 (#1358) cb696e261 use little endian int (#1372) cd2521e33 Fix model field serializer with computed field (#1349) 61318d902 use Uuid:::from_u128 for uuid_to_string (#1362) 9f7bf4c0e string: Use 're.Pattern.search' instead of 're.Pattern.match' (#1368) e459d3c34 Fixes discriminated union bug regression when using enums (#1286) 0e6b377d2 Bump `speedate` to v0.14.1 and prep for v0.20.1 (#1347) b7fa25414 Bump the python-packages group across 1 directory with 7 updates (#1361) de196833f Bump num-bigint from 0.4.5 to 0.4.6 (#1357) 4519e9f4a Bump uuid from 1.9.0 to 1.9.1 (#1356) 510daf8f6 Bump `pytest-examples` to get tests passing with ruff `v0.5.0` (#1360) a017bd923 try restore 3.13 PGO builds (#1346) 7b62646c3 Prep for v2.20.0 release (#1343) ef7f81c63 update to PyO3 0.22, add 3.13 support (#1340) aba682ee7 Add list fail-fast config option (#1322) a65f3272f Fix union validation logic when `extra='allow'` (#1334) fcc77f88d Improvements in union matching logic during validation (#1332) 46379acc7 tidy up `tagged_union_schema` (#1333) 9507a28f9 ci: remove pins on git dependencies of packages (#1330) 03f1aa87f remove some dead PyPy-specific code (#1329) 4d20a1da5 ci: stop building on windows aarch64 pending fix (#1328) 66331bb1a Prep for 2.19.0 (#1326) d7946da74 Reuse `re.Pattern` object in regex patterns (#1318) 8afaa4519 impl `Copy` for simple config enums (#1325) 96aca5244 Add ser_json_inf_nan='strings' mode to produce valid JSON (#1307) 1f8b30bdd Make `ValidatorFunctionWrapHandler` positional only (#1323) 34d789fc5 deps: bump libc from 0.2.147 to 0.2.155 (#1317) ebef5bdf9 Lower MSRV to 1.75 (#1316) 77f2b6957 Ugh, another `typing-extensions` fix (#1314) 51ac71abf Attempt fix - release build failed, need to install `typing-extensions` from main until a version after v4.12.1 (#1313) 37ad92598 Uprev `jiter` to v0.4.1 and `pydantic-core` to v2.18.4 (#1306) 81e3bd3a6 Bump the python-packages group with 6 updates (#1312) 2a5f46454 Bump serde from 1.0.197 to 1.0.203 (#1310) 87438f98b Bump uuid from 1.7.0 to 1.8.0 (#1311) 0c7c2e567 Fix context type hints (#1303) fd2629336 tests: use zoneinfo instead of pytz (#1304) 52287213a Prep for 2.18.3 Release (#1301) a76204193 Fix generate_self_schema for Python 3.12+ (#1299) 0dcf82af4 add test for 1298 (#1300) 88a8a302b fix case of checking truthiness of `NotImplemented` (#1298) 2415f423e uuid: allow str subclass as input (#1296) f04418b2a support big ints in literals and enums (#1297) 727deee70 Fix str subclass validation for enums (#1273) b777774d0 fix: keyword only non default argument (#1290) 0f8445ebd defer to PyO3 i64 extraction to avoid implicit integer casts (#1288) 8f5f91aca fix validation of ints with leading unary minus (#1291) aed68446d ci: lint fixes for rust 1.78 (#1289) e1fc99dd3 Bump uraimo/run-on-arch-action from 2.7.1 to 2.7.2 (#1284) 505a199f4 Bump pyo3 from 0.21.1 to 0.21.2 (#1283) 8abdfdc6d Bump regex from 1.10.3 to 1.10.4 (#1282) 3c3391de2 Bump the python-packages group with 7 updates (#1280) c67e48c6f Bump serde_json from 1.0.114 to 1.0.116 (#1281) 1cefeae57 version bump (#1277) a99729a32 fix memory leak with iterable validation (#1271) f537a03fa Handle error from `Enum`'s `missing` function as `ValidationError` (#1274) 3240277ed fix interaction between `extra != 'ignore'` and `from_attributes=True` (#1275) 91c354182 fix validation of ints with leading unary plus (#1272) 4adf47f10 support multiple zeros as an int (#1269) 031fc93b4 Bump to 2.18.1 (#1268) b945bcb98 prevent trailing dots in integers (#1267) f636403c2 trim leading zeros before parsing `str` -> `int` (#1266) e23d7eb2f remove old profiling directory (#1265) 4b82169f2 Add coerce_numbers_to_str option in StringSchema (#1262) 683c5a31a allow serialization functions to upgrade warnings to exceptions (#1258) ee0633509 update to PyO3 0.21.1, bump version to 2.18 (#1261) e73b2d1ed Adopt jiter `0.2.0` (#1250) 1c4baacac Fixes for `ser_json_inf_nan` inference (#1251) e26e8575f fix build warnings on python <3.11 (#1259) 970c6e53a Bump enum_dispatch from 0.3.12 to 0.3.13 (#1252) 517cc0bfc Bump smallvec from 1.13.1 to 1.13.2 (#1253) 4ca7f5549 Bump serde from 1.0.196 to 1.0.197 (#1255) d49ab496e Bump softprops/action-gh-release from 1 to 2 (#1256) 947397571 Bump the python-packages group with 10 updates (#1257) 2e2c13936 caching strings from JSON (#1240) c607fd82b Add `coerce_numbers_to_str` option in `str_schema` (#1249) 0830d0dcd update to PyO3 0.21 final (#1248) 193f5d7a8 Uprev `speedate` (#1244) da161402c Add `serialize_as_any` runtime flag support (#1194) 1287d226b Allow case where `__pydantic_extra__` is `None`, even if `extra='allow'` (#1236) abaab1028 bump version to 2.17.0 (#1239) ebf55d669 refactor `Input` trait to have single `as_python` cast for python inputs (#1241) 639959238 support json cow of jiter 0.1.0 (#1231) 3d2e53ee8 remaining associated types (#1238) d73668f44 Rust enums validator (#1235) 36a1b6c6c associated types for dict in input (#1237) 092f5f016 really drop python<=3.7 support (#1232) abff9ba08 associated types for arguments in Input (#1234) 0587e152e remove `with_new_extra` (#1233) 89fc62fa2 move list validation to produce an associated type (#1230) 352d40f69 implement `Input` for `str` (#1229) b92a69b05 Fix json serialization when computed field is excluded (#1228) 8db3a6f45 separate `Input` trait `'a` and `'py` lifetimes (#1227) 9efbc163a Use new typing syntax for `_pydantic_core.pyi` (#1217) 10095b5fb tidy up some remaining PyO3 GIL Refs (#1225) 71d54a243 update to PyO3 0.21 beta (#1222) 4a533aa93 Make tests pass in 2032 (#1221) 1083986b5 ability to pass context to serialization (pydantic#7143) (#1215) c6301fe59 Fix parsing BigInt from str (#1204) f669db9c0 Use PEP570 syntax (#1216) a98b8b040 Bump the python-packages group with 7 updates (#1213) 6d23acdb1 Bump strum_macros from 0.25.3 to 0.26.1 (#1208) 19769b8d6 Bump pyo3 from 0.20.2 to 0.20.3 (#1212) 1f905160e Bump ahash from 0.8.7 to 0.8.10 (#1210) 68a7e9687 Bump serde_json from 1.0.113 to 1.0.114 (#1211) ad5007dc8 Update pyproject.toml to get a 'Summary' metadata (#1214) 7fe78edc8 Fix stack overflow due to recursion in some recursive serializer schemas. (#1198) 7779206d1 support Rust 1.70 as MSRV (#1206) 1a9046801 Trimming str before parsing to int and float (#1203) 47aff70a7 ci: if tzdata not available, skip comparing to `ZoneInfo` (#1200) c2c90fd00 Fix TzInfo equality check based on offset (#1197) 8c6e2bdd8 Update pyodide to 0.25.0 (#1199) ea443ba0b Prevent panicking when `__dict__` changes during iteration (#1196) cf4251138 Add benchmarks for serializing model with complete schema (#1189) 61a656239 `date` string coerced to `datetime` shouldn't infer timezone (#1193) fadeecc0b ci: updates for Rust 1.76 (#1191) 44621f1de Bump serde from 1.0.195 to 1.0.196 (#1177) 80660d582 Bump serde_json from 1.0.109 to 1.0.113 (#1178) 0c8043839 Bump uuid from 1.6.1 to 1.7.0 (#1179) a2bf4d8e3 Bump regex from 1.10.2 to 1.10.3 (#1180) d0a438a38 Bump smallvec from 1.11.2 to 1.13.1 (#1181) 5ba2d52fb Bump uraimo/run-on-arch-action from 2.6.0 to 2.7.1 (#1183) ff073f0c9 Bump codecov/codecov-action from 3 to 4 (#1184) 1fb3343cb Bump mymindstorm/setup-emsdk from 13 to 14 (#1185) b393063f9 Bump actions/cache from 3 to 4 (#1186) 858d85df0 Bump the python-packages group with 7 updates (#1182) 305a837e9 Version bump, 2.16.2 (#1188) 42394acb0 Fix model computed field serializer (json) (#1187) dcaf63ece Fix warning for tuple of wrong size in union (#1174) 758bc51d4 fix(uuid): validation from string (#1172) 8be45e67a fix: 8405 pattern serialization (#1168) c670b2bd7 remove `AsLocItem` trait (#1169) 4538190f0 Uprev core to 2.16.1 (#1167) 7a5f8e6b9 Ensure recursion guard is always used as a stack (#1166) 4da7192ff uprev to jiter v0.0.6, uprev pydantic-core (#1165) 29c541917 Add support for dataclass fields init (#1163) 5a1385b86 dataclass serialization speedups (#1162) e1cb0ebe5 improve performance of recursion guard (#1156) d7cf72d8d Int extraction (#1155) 5d3aa43f4 correct build-profiling make command (#1160) 579166767 Bump serde from 1.0.193 to 1.0.195 (#1150) 545f8c3f8 Bump pyo3-build-config from 0.20.1 to 0.20.2 (#1151) 1ff756f03 Bump pyo3 from 0.20.1 to 0.20.2 (#1152) a1f6023d0 Bump base64 from 0.21.5 to 0.21.7 (#1153) 3f7b0b428 Bump the python-packages group with 4 updates (#1154) b9b28ad69 unify 'profile.profiling' configuration (#1158) fa65fcdbb simplify instantiation of undefined type (#1157) 8030c5ae1 add to_json ser benchmark 700e17d8c Group dependencies on dependabot updates (#1149) 82c4ca35f adjust build for upload-artifact-4 (#1146) 8dde89e06 Use stricter serializer for unions of simple types (#1132) 4df7624c1 Add unified tuple validator that can handle "variadic" tuples via PEP-646 (#865) a1b934f20 Bump dirty-equals from 0.6.0 to 0.7.1.post0 (#1111) 740e996e7 Bump idna from 0.4.0 to 0.5.0 (#1101) e3ae7f643 Support serialization mode specification from model config and `SerializationConfig` (#1122) f3d0cc524 Rework `PYDANTIC_ERRORS_OMIT_URL` to `PYDANTIC_ERRORS_INCLUDE_URL` (#1123) 9a2f6204e Bump coverage from 7.2.7 to 7.4.0 (#1142) d1e18e4ac Bump serde_json from 1.0.108 to 1.0.109 (#1134) ccf13e26c Bump pyo3 from 0.20.0 to 0.20.1 (#1136) ab7dae559 Bump hypothesis from 6.79.4 to 6.92.5 (#1145) 22e5fba2f Bump mypy from 1.6.1 to 1.8.0 (#1141) 3757e2180 Bump actions/download-artifact from 3 to 4 (#1137) 5f0ad2c47 Bump actions/upload-artifact from 3 to 4 (#1139) be727a952 Bump actions/setup-python from 4 to 5 (#1138) bb9c84156 Bump pytest from 7.4.3 to 7.4.4 (#1143) 1c7554fae Bump ahash from 0.8.6 to 0.8.7 (#1135) 341b1bd85 drop Python 3.7, and PyPy 3.7 and 3.8 (#1129) d706aa45a fix "run-on-arch" tests (#1131) 5c896fe51 Support indirect definition references (#1130) 2cb87a62e fix memory leak with recursive definitions creating reference cycles (#1125) ea3ec7ed5 Sync 2.14 branch into main (#1127) 10ad10f9f Support `yyyy-MM-DD` string for datetimes (#1124) bec63dbae Bump pyright from 1.1.334 to 1.1.339 (#1120) 360bd88d7 Bump ruff from 0.1.6 to 0.1.7 (#1121) a5e0e0947 Bump serde from 1.0.190 to 1.0.193 (#1104) 1e5a4a22e Bump smallvec from 1.11.1 to 1.11.2 (#1103) 8da73b1aa Bump url from 2.4.1 to 2.5.0 (#1102) 77068b7c5 Bump uuid from 1.5.0 to 1.6.1 (#1105) c1b4febcf Bump ruff from 0.1.5 to 0.1.6 (#1109) 167a9f1e8 Bump griffe from 0.36.9 to 0.38.0 (#1112) af36330f9 Bump mymindstorm/setup-emsdk from 12 to 13 (#1106) c7b6bb2f2 Bump CodSpeedHQ/action from 1 to 2 (#1108) cfd1efd8f Bump uraimo/run-on-arch-action from 2.5.1 to 2.6.0 (#1107) dfe502732 Implement pickling for ValidationError (#1119) a5b390691 Use input type json when validating a json schema (#1117) 7fa450d96 pass extra argument in arguments validator (#1094) f323e74a5 Fix memory leak caused by not visiting the function in a CallValidator during gc (#1100) 5d64894e8 bump pandas tests to run on 3.12 (#1097) 3b6344e9a Fixing `exclude_none` for json serialization of `computed_field`s (#1098) c7daf1671 support newest jiter behaviour (#1092) 5b63e7a89 Avoid using `?` with `get_item` to handle unhashable inputs properly (#1089) 3840e006b Correct deprecation message for general_after_validator_function (#1090) a7739ec86 Remove needless uses of `PyString::intern` (#1088) 3d3f40610 Don't build dummy objects when populating `ObTypeLookup` (#1086) 7634e5e74 Fix typo in is_instance_schema docstring (#1087) be9c21c9f Remove lifetime from errors (#1084) 2bb53d869 move all clippy lints into `[lints.clippy]` table (#1083) 14c297172 Fix bug with UUID validation from json with a wrap validator (#1080) 223aa2784 uprev: 2.14.4 (#1081) ca83d2473 Fix validation of negative floats when using `multiple_of` (#1077) 2f0c8c27f Update ci for Rust 1.74 (#1079) 203b395fe Fix validation of `Literal` from JSON keys when used as `dict` key (#1075) 3fea8332e Fix bug re `custom_init` on members of `Union` (#1076) 73b118444 uprev to 2.24.3 b18f4f95a bump version to 2.14.2 (#1073) 439eeacd7 Bump python version for benchmarks (#1064) a35b1829c restore pypy builds for x86_64 (#1072) baed94340 Fix invalid link in docstring (#1070) fbae08ce8 Bump version to 2.14.1 (#1069) 4c2ea5957 Restore manylinux-compatible PGO builds (#1068) b27455eb9 Bump ruff from 0.1.3 to 0.1.5 (#1067) 5712edfd4 Adopt ruff formatter instead of black (ready for review) (#1051) d3416f7bf bump version to 2.14.0 (#1066) f409e0013 replace ultra_strict with new union implementation (#867) d08b4f38c run pydantic integration tests with lax xfail (#1054) 0c4614616 PGO build for MacOS M1 (#1063) d80c454bb fix: nan inf float (#1062) 5de6b75b2 reduce dependabot frequency (#1059) cb47b9669 check not type in serialization (#962) 1cf1c75fa uprev speedate, prevent - sign as datetime (#1060) d43d08767 Uprev to 2.12.0 (#1061) 828eb33fc Bump serde_json from 1.0.107 to 1.0.108 (#1058) 3eeebf373 Bump black from 23.10.0 to 23.10.1 (#1057) 1f18da208 jiter (#974) 9d07a8c6b Bump pyright from 1.1.332 to 1.1.334 (#1055) acf336147 Bump griffe from 0.36.7 to 0.36.9 (#1041) 8484cec11 Bump ruff from 0.1.1 to 0.1.3 (#1043) fdaf9da20 Bump pytest from 7.4.2 to 7.4.3 (#1044) d98f14ff1 Bump actions/setup-node from 3 to 4 (#1045) 8dba67ab8 Bump ahash from 0.8.4 to 0.8.6 (#1046) 73c431b2c Bump serde from 1.0.189 to 1.0.190 (#1047) 383535655 Fix proper pluralization in validation error messages (#1050) ef3e8132e Allow validation against `max_digits` and `decimals` to pass if normalized or non-normalized input is valid (#1049) dd75669bb Support subclasses in lists in `Union` of `List` types (#1039) 866eb2da0 Add lax_str and lax_int support for enum values not inherited from str/int (#1015) 23d106551 Don't accept NaN in float and decimal constraints (#1037) acf15bf30 Bump black from 23.9.1 to 23.10.0 (#1028) 22255ad20 Bump mypy from 1.6.0 to 1.6.1 (#1030) f59bcc7b1 Bump pyright from 1.1.331 to 1.1.332 (#1029) 45e8df311 Bump griffe from 0.36.5 to 0.36.7 (#1031) 81924c0a8 Bump ruff from 0.0.292 to 0.1.1 (#1032) 53619bf8c Bump base64 from 0.21.4 to 0.21.5 (#1033) ad1d38456 Bump ahash from 0.8.3 to 0.8.4 (#1034) a3c367ec4 Bump uuid from 1.4.1 to 1.5.0 (#1035) 8f347ff78 Bump regex from 1.10.1 to 1.10.2 (#1036) f8470df75 Bump version to 2.11.0 (#1027) 38c9e64e6 Bump griffe from 0.36.4 to 0.36.5 (#1025) f8c0920c9 Fix bug allowing validation of `bool` types with `coerce_numbers_to_str=True` (#1017) 1b7b6e909 Bump mypy from 1.5.1 to 1.6.0 (#1022) b697abfbb Bump pyright from 1.1.330.post0 to 1.1.331 (#1023) d0704489f Bump regex from 1.9.6 to 1.10.1 (#1020) 085342ba3 Bump serde from 1.0.188 to 1.0.189 (#1019) e866c1111 Bump strum_macros from 0.25.2 to 0.25.3 (#1021) 005c8a752 feat: add `ser_json_bytes` mode `'hex'` (#1016) 372904c53 Update PyO3 to 0.20 (#1003) f67e25c2c Fix `definition-ref` bug with `Dict` keys (#1014) b51105a4d Add `SchemaSerializer.__reduce__` method to enable `pickle` serialization (#1006) 8e66bd947 Fix `regex_engine` being rejected by `validate_core_schema` (#1011) 8bbfb33bc Bump pyright from 1.1.329 to 1.1.330.post0 (#1007) 172f6fcf9 Bump pytest-timeout from 2.1.0 to 2.2.0 (#1008) 30444546a Bump ruff from 0.0.291 to 0.0.292 (#1009) 493621705 Fix new lint error from Rust 1.73 (#1010) d93482e3b Fix pydantic 7715 (#1002) 4622ed72d Bump regex from 1.9.5 to 1.9.6 (#1001) a8ac5b1ba Bump pyright from 1.1.327 to 1.1.329 (#998) b5fb6875b Bump griffe from 0.36.2 to 0.36.4 (#1000) 49126b0b9 Add benchmark for nested/wide model using definitions (#997) f3c5714c4 Fix backwards compatibility of type-checking when using deprecated `FieldValidationInfo` (#995) a8fb1e3f4 Replace definitions `Vec` with `OnceLock` slots (#992) 1a966d555 bump version to 10.0.1 (#991) 8435153f2 improve quality of too short / too long error messages (#990) e610984bd Bump ruff from 0.0.290 to 0.0.291 (#987) 0ebd60703 Bump smallvec from 1.11.0 to 1.11.1 (#988) 91746c956 make `field_name` and `data` available on `ValidationInfo` (#980) 0a3f2b218 add strict flag to validate_core_schema (#984) 916d9092f Add `validate_core_schema` function and remove validation from `SchemaValidator` and `SchemaSerializer` constructors (#982) 33a7cc072 🐛 Fix handling of `UUID` values having `UUID.version=None` (#981) 4c84ed877 add switch to change regex engine from Rust to Python (#983) b8d3b95ac use `TypedDict` from `typing_extensions` on <3.12 (#978) 0f9a5c956 🔖 Bump version to 2.9.0 (#979) 621fb035f Add support for hiding input in errors and json (#973) 157a64389 ✨ Implement optional `number` to `str` coercion (#975) bed050bcd Fix serialization of model subclasses via unions when definition referneces are used (#977) 367a67aaa implementing `validate_strings` (#883) fb7b50133 fix function-after validator changing validation mode to Python (#967) a17e9b632 Populate defs from defs schema (#972) 1d102381b Bump ruff from 0.0.287 to 0.0.290 (#968) a107c96a0 Bump serde_json from 1.0.106 to 1.0.107 (#971) e4eed14b7 Bump pyright from 1.1.325 to 1.1.327 (#970) 245381f98 Implementation of __cause__ for ValidationError using ExceptionGroups (#780) e8015318b Bump black from 23.7.0 to 23.9.1 (#955) 502fb9adf Update pytest-codspeed requirement from ~=2.1.0 to ~=2.2.0 (#953) 3dfecd70d update to coverage_attribute feature (#966) 5edddd506 Bump base64 from 0.21.3 to 0.21.4 (#952) 1c79f979c Bump serde_json from 1.0.105 to 1.0.106 (#951) ba3c502c6 Bump griffe from 0.36.1 to 0.36.2 (#954) 03cecdd54 Bump pytest from 7.4.1 to 7.4.2 (#956) 6e9c6ebf5 Bump actions/checkout from 3 to 4 (#958) f6b14cce2 make error "duplicate" cheaper (#950) 6769140df Fix parsing int from large decimals (#948) 2d9df49bc Update pytz (#949) 6a139753a Bump griffe from 0.35.2 to 0.36.1 (#946) e09112a28 Bump pyright from 1.1.324 to 1.1.325 (#941) 8a0bc71f3 Bump griffe from 0.35.2 to 0.36.0 (#940) 7dc8946e0 Bump ruff from 0.0.286 to 0.0.287 (#942) fffb1d853 Bump pytest from 7.4.0 to 7.4.1 (#939) 04a9135a6 Bump regex from 1.9.4 to 1.9.5 (#944) 9ec1036b4 Fix typo in `MultiHostUrl.build` docstring (#938) 01a1523af Bump serde from 1.0.185 to 1.0.188 (#929) 18425b00d Bump num-bigint from 0.4.3 to 0.4.4 (#931) 53385d365 Bump pyright from 1.1.323 to 1.1.324 (#926) cf9050307 Bump griffe from 0.34.0 to 0.35.2 (#927) 2dfcd6b8b Bump ruff from 0.0.285 to 0.0.286 (#928) a52d38b0a Bump regex from 1.9.3 to 1.9.4 (#930) 39b4a7815 Bump url from 2.4.0 to 2.4.1 (#932) 42d48fefd Bump base64 from 0.21.2 to 0.21.3 (#933) a23db506c Update version to 2.7.0 (#936) b9f45f9de Make round trip exclude computed fields (#934) 34fbd845c snipe off some unsafe code (#922) 882b57fc8 Fix max length error on conlist with type int (#902) b076a8f41 Allow customizing serialization of extras (#911) c086caec1 Bump pydantic-core to 2.6.3 (#920) e34a5eb05 fix big int subclass extraction (#919) e414a1298 Bump pydantic-core to 2.6.2 (#918) 8477825be 👽 Implement `tzinfo.fromutc` for `TzInfo` (#864) 815fd9242 avoid coercing int subclasses to floats (#914) 4a1ef3aba remove dict validation macro (#917) a5cb73826 Allow using type() in tests (#916) 15f62b6b4 Convert datetime error message to human friendly message (#915) 7f7d03d3d Fix `pytest tests/benchmarks --benchmark-enable` (#912) 8bf9e5f0c fix json-or-python serializer as JSON object key (#903) be9bab644 Bump pyright from 1.1.322 to 1.1.323 (#907) 95161b1c6 Bump griffe from 0.32.3 to 0.34.0 (#906) 83ead2809 Bump serde from 1.0.183 to 1.0.185 (#904) 09dddc5ff Bump mypy from 1.5.0 to 1.5.1 (#908) 50089e2f6 Bump serde_json from 1.0.104 to 1.0.105 (#905) 53f65b3de Bump ruff from 0.0.284 to 0.0.285 (#909) a4015ab79 Prepare for 2.6.1 release (#901) ce2068f68 Replace MiMalloc w/ default allocator (#900) 5f7426d0e Bump version to 2.6.0 (#896) e01bc34e2 disable mimalloc on manylinux cross-compiles (#893) c2548a2b4 add some missing pypy builds for macos (#894) b57f5fd18 don't install pytest-codspeed on non x86_64 machines (#895) e56491ed1 limit test requirements so that all platforms can build (#892) 1d8a253cb add `left_to_right` union mode (#889) a2b531a4a remove `'s` lifetime from `validate` and `validate_assignment` (#890) 2e59f2556 collapse arguments into ValidationState (#886) 0a072b026 Update to speedate 0.12 (#887) 26453d573 fix serialization of subclasses (#860) 75a943e4f Bump ruff from 0.0.282 to 0.0.284 (#877) 09f0acf12 Support manually specifying case labels for union validators (#841) 5c98b05c9 custom behaviour for timedelta subclasses (#881) 7ecec1942 running cargo clippy (#885) 7d67b91fe Bump uraimo/run-on-arch-action from 2.5.0 to 2.5.1 (#880) 94b835997 Bump pyright from 1.1.320 to 1.1.322 (#878) 0f7b22ad2 Bump mypy from 1.4.1 to 1.5.0 (#876) 8ac50ecdc special case of datetime as not allowed in date serializer (#873) 87b4789a1 Allow parsing numbers w/ underscores (e.g. 1_000) from strings (#868) e4f418b8a Bump `pytest-codspeed` to v2.1.0 (#875) 040985fbf bump version to 2.5.0 (#874) 672c2b431 add decimal validator (#763) c94fa1578 fix inconsistency with strict mode of date validation (#870) 3f7df8091 Bump serde from 1.0.179 to 1.0.183 (#857) ea37fe29a Bump strum_macros from 0.25.1 to 0.25.2 (#858) 197a2d21a Bump pyright from 1.1.318 to 1.1.320 (#863) 2c063f39f special case serialization for int as input to float (#866) 1bd36f1ff fix: cargo include (#852) 9799d9b2c Bump hypothesis from 6.63.0 to 6.79.4 (#861) bfa7cce78 Bump ruff from 0.0.280 to 0.0.282 (#862) f9221f8d8 Bump regex from 1.9.1 to 1.9.3 (#859) e22a2fd03 Fix PydanticKnownError user context handling issues (#839) d6ba6e6e4 Build wheels for arm64 Windows (#856) ca1055b6a update to PyO3 0.19.2 (#844) d15d0391f optimize Python float validation (#826) 4ec40e05e Bump griffe from 0.27.3 to 0.32.3 (#847) 63b054883 Bump serde from 1.0.175 to 1.0.179 (#845) 6738bb2ee Bump serde_json from 1.0.103 to 1.0.104 (#846) 163a48831 Bump black from 23.3.0 to 23.7.0 (#850) 37749641f Bump ruff from 0.0.264 to 0.0.280 (#849) 1aaa03539 Fix typehint of discriminator for tagged_union_schema (#827) d333dfabe Fix wasm preview (#835) 956f99666 ruff: ignore E501 (#832) ce346227f Fix error context type annotations (#809) f5ef7afbf uprev 78028210b adding docstrings (#795) 5f2d1d06f Bump pytest-examples from 0.0.4 to 0.0.10 (#814) 7cbbd74e8 use github continue-on-error to avoid red CI with test-pydantic-integration (#817) 7110986f3 Bump pytest from 7.2.1 to 7.4.0 (#812) 996c12014 Bump pytest-pretty from 1.1.1 to 1.2.0 (#815) a3af478ea Bump pyright from 1.1.296 to 1.1.318 (#816) f89c8b28e Bump uuid from 1.3.4 to 1.4.1 (#810) b3abff930 Bump serde from 1.0.174 to 1.0.175 (#811) c18c875fd Add uuid validator (#772) 6ad908c0d Bump base64 from 0.13.1 to 0.21.2 (#805) b3eb6605f add profiling make target and instructions (#793) d6dff4c30 Bump serde_json from 1.0.100 to 1.0.103 (#800) 5b68b2899 Bump serde from 1.0.171 to 1.0.174 (#803) 240fa3855 Bump idna from 0.3.0 to 0.4.0 (#798) 9f5271b7c Bump mymindstorm/setup-emsdk from 11 to 12 (#804) 34a1463f4 Bump strum_macros from 0.24.3 to 0.25.1 (#797) 8e1bd0e02 Bump actions/cache from 2 to 3 (#802) 8cc92f5ef Bump pytz from 2022.7.1 to 2023.3 (#799) 1e0c41da4 Bump coverage from 7.2.2 to 7.2.7 (#801) 5d58288e3 Bump pytest-mock from 3.10.0 to 3.11.1 (#807) f290196eb Bump dirty-equals from 0.5.0 to 0.6.0 (#808) 608db7ba7 add weekly dependabot configuration (#791) ec6f719ad Remove patch version number from error link (#794) f38bea601 Always convert str subclasses to str (#788) 72120441c correct name of "AssignmentValidatorCallable" (#789) 9b540d001 bump version to 2.3.1 (#790) 68453df2e fix python GC traversal for validators and serializers (#787) 33fea1e5e reject is_instance inputs based on their type, not the mode (#765) a3b9788e3 🐛 Fix handling of bool literals (#783) 6aab4db55 run pydantic tests as an allowed-to-fail job (#767) 1382debe3 Special case bool literals (#784) fe9a46206 Fix ValidationInfo repr (#776) ff660dc09 fix type annotations for Url & MultiHostUrl build (#781) e3ceb4ba9 set up stable Rust toolchain on all rust builds (#782) 9be711e35 Fix scientific floats with uppercase E (#779) 3597351a1 Fix scientific floats (#774) 65aee42fe Revert "Bump version to 2.4.0 (#771)" 3f7c0105e Make validating assignment work properly with allowed extra (#766) f5b804b87 Bump version to 2.4.0 (#771) f499c73cc Make TzInfo picklable (#770) 16a05d3a1 Update speedate to 0.11.0 (#769) 3345f3e89 Type validation context as `dict[str, Any] | None` (#709) 0c0e39138 Consider `exclude_none` in `computed_field` serialization (#768) bf0bce002 Update speedate and truncate microseconds by default (#762) 5f660f0ea fix borrow error when serializing recursive models (#764) 3e7cc4fb1 uprev to 2.2.0 5f2d14ef0 serde for JSON integers larger than 64 bits (#745) 8adeccff0 feat: add build method back to multihosturl (#730) 75daffc6e 🐛 Fix `max_length` for unicode strings (#758) 1a17d4211 Preserve exception instances and their context in ValidationError (#753) 45d812f5c use pydantic's version in error messages (#759) dfbedbdc6 fix pypy tests on windows (#757) a27b34efd Add enum error type (#751) 0b317115a add `build_info` to `_pydantic_core` (#749) 964066be3 Bump speedate and pydantic-core versions (#752) fac2a4055 remove pydantic V1 comparisons from benchmark suite (#748) 634087a58 add build-pgo make target (#741) 3a9c16260 Properly truncate characters when splitting up strings in error repr (#746) 666607379 use timedelta repr as constraint in error messages (#747) ce6872961 fix segfaults on tests in debug builds for PyPy (#744) 4527b8078 use __new__ in .pyi for Rust types (#743) d08d269b0 Always build PGO using `RUSTFLAGS` (#739) 5c696e5ab Fix: micro typo in README #737 (#738) 586ad8ffb Update python3-dll-a to 0.2.9 (#736) c9e7c691d Update python3-dll-a to 0.2.8 (#735) a893e3679 Bump version to 2.1.0 (#734) 193ec8690 build pypy3.10 wheels on PGO platforms (#733) 9ad1425db build with PGO on x86_64 ubuntu and windows (#678) 024efa24c Move `field_name` from runtime to schema generation time (#715) d76812ae6 update to PyO3 0.19.1 (#731) d285975d8 Don't warn on missing fields if exclude_* are used (#727) 2a943a3f3 basic tidy-ups to core_schema.py (#713) 7da749622 try testing and building for 3.12 (#629) a63621a8b Add benchmark for field validator functions (#726) 41f91a6ad Bump version to 2.0.2 (#729) 52173ef73 Simplify typing_extensions pin (#728) 37964097a Make `__pydantic_extra__ = None` when `extra='forbid'` (#725) 0d12efd17 allow typing-extensions-4.7.0+ on pypy3.9+ (#723) 7da65c4bc bump to 2.0.1 bd4cc93d4 fix _pydantic_core.pyi to be compatible with 3.7 d45cc570b update readme 6b54b145d prepare to release v2.0.0 (#720) 1c06a3a63 PYD-147 Better model error messages (#719) 8d81c3e76 Add faster int inequality (#694) 16ef7031d PYD-137: Implement PydanticUseDefault error (#714) 12073b845 Fix installation with pypy3.7 and pypy3.8 (#716) 081cf31e8 Use `from __future__ import annotations` instead of string type hints in `python/pydantic_core/_pydantic_core.pyi` (#710) 54daab742 fix stubtest issue post-merge (#711) a55bd2ec9 Add eitherfloat (#691) 703b7b2a2 run stubtest on _pydantic_core.pyi (#702) 00e9f1b69 small cleanups after move to python/ source dir (#708) f43fab3d5 move pydantic_core -> python/pydantic_core (#705) 424a2f806 Allow proper subclasses of strings (#706) 29de2c940 Remove unused bool error (#704) c1c27d459 reconcile _pydantic_core.pyi against the Rust implementation (#701) 95955d7b4 🔧 Add `assignees` list to the hooky config (#699) c84c0a901 fix context may be None (#696) a6e9db5f2 Extend clippy to include `clippy::pedantic` (#695) dfae003c4 🚸 Expose `PydanticUndefinedType` (#693) 4c2a8f8ca 🐛 Raise `PydanticSerializationUnexpectedValue` in root model serializer only if strict check is enabled (#690) 875befef9 add PULL_REQUEST_TEMPLATE (#688) bbd5bb433 bump maturin version to 1.0 (#687) 2906379f9 update pydantic-core version in Cargo.lock (#689) 31392517e expand allowed errors from hypothesis test for url parsing (#684) e9e76b8ca 🔖 Bump version to 0.41.0 (#685) 942d575ad add davidhewitt to reviewers (#683) 7d6f97c1e fix windows build crash on generate_self_schema.py (#682) a85cd3669 try pyo3_build_config python for schema (#674) 35f6ba502 🐛 Fix crash on serializing a union of RootModel and BaseModel (#679) 31f35796b include debug info in Rust benchmarks (#673) 3e58056fd fix panic on empty MultiHostUrl (#680) 0ff7563c3 make Url and MultiHostUrl pickleable (#676) 4420be3db correct MultiHostUrl __repr__ (#677) c8e38786c uprev speedate, add test (#672) dcc349d9a Docstring fixes for core_schema.py (#664) 4a376a516 📌 Proper update `Cargo.lock` (#671) 4b938444d 🔖 Bump version to 0.40.1 (#670) d4e4e9bfb 🚑 Fix `__pydantic_fields_set__` behavior in validate_construct for RootModel (#669) 4f43f858d 🔖 Bump version to 0.40.0 (#668) 74d6df0bb 🐛 Fix `__pydantic_fields_set__` behavior on `RootModel` (#661) 55de89a3e Make Url and MultiHostUrl subclassable (#660) d48819443 Uprev version to 0.39.0 (#665) 3b1a6a781 Allow non-scalar values as tagged union keys (#655) d2f422694 use default allocator for benchmarks (#662) e7108e82a update to PyO3 0.19.0 (#658) 0fe0936e6 Add tagged union benchmarks (#656) 3d3cb7f8c specific TZ offset constraints (#653) 449a9f3e4 uprev ca48482e0 Move dataclass config onto dataclass schema (#652) 2c3719950 New speedate (#651) a6edba9c1 support `from_attributes` at validation time (#648) ebf07a076 Serialization return schema (#646) 679d59039 remove strict checks from models directly (#647) 6e96b5711 Add CoreConfig to TypedDict (#645) 3bd718cf1 Uprev version to 0.37.0 (#644) 616dea9e3 Add SchemaValidator.get_default_value() (#643) 068742ede fix error for long int input (#642) 774fbbbc5 rename `hide_input_in_errors` -> `hide_input` on `ValidationError` (#641) b09ec907e uprev 74b74d51a Add `__pydantic_private__` (#640) 7c6f32641 add typing-extensions to pyodide, add comment about V8 bug 8dab0c14e Add error messages for json (#637) 5ff9e4e20 uprev 60ed51f5a Use `PyInt` for inequality and multiple of checks (#634) 62204557c adding `tools.rs`, add `extract_i64` (#635) 7dc970f99 fix for model subclass serialization in unions (#632) 726ef5f4f Add hide_input to ValidationError (#633) 26fa27da3 Add slots to dataclass schema (#617) 058a0b8d5 nicer error when hitting recursion error while serializing (#630) fe3eef6db Bump version to 0.34.0 (#631) b764c169d Support negative indices in serializer include/exclude (#627) c9a83c85e cleanup string validation a little (#624) 8d12f9636 Int validation performance improvement (#620) 29f6895d9 Upgrade maturin to 0.15 (#621) ed43fb33e Bump version to 0.33.0 6667c07dd ✨ Implement root model serialization (#613) 4dbc875cf Bump version to 0.32.0 (#618) b6e9baf26 eager length checks and accept arbitrary iterables for list/sets/tuples (#610) 084172a03 Do not inherit config in model fields that are themselves of type model (#612) c818c3e57 Fix reversal of loc when building errors from Python (#609) 2a7a2f639 Add ability to specify dataclass name in dataclass_schema (#603) bd710f2ce Make ValidationError constructor a non-init method (#601) 47c2df1b2 Fix swapped test names in test_micro_benchmarks.py (#607) 52d58d222 Add set benchmarks with duplicates (#606) 3603f1078 Uprev to 0.31.0 (#600) c1e0111e7 Add JsonOrPython validator and serializer (#598) 027e67975 Use return_schema for computed fields (#595) 0d5724359 uprev b863be7f6 RootModel (#592) 493643e0e Remove warning for mutable default (#594) b396f9371 Uprev to 0.29.0 (#588) 6a9400ac3 add griffe to linting (#587) dbff17127 Call cls for custom init (#574) 403cce745 Don't generate URLs for custom errors (#586) 0ec87af65 Add hooky to pydantic core (#581) 287d16f5b 🐛 Deepcopy mutable defaults (#582) 68d081063 fix docstring indents 4767abfa9 uprev 82fb0e9df support `__pydantic_extra__` when serializing (#576) 944bf911d Assume wrap validators produce the same serialization schema (#573) bfc74d71a 🙈 Add `/.pdm-python` to git ignore (#579) d3f97e79f simplify serialization filtering (#578) 9ba8acde5 Fix to_json function (#577) 119b265af Uprev to 0.28.0 c65503052 Rework def ref system to fix various bugs (#571) b6eff4c4a Error URLs (#570) 817af7214 separate model fields validator from typed dict validator (#568) 9f69da195 fix: copy with tzinfo (#567) c9f45e347 use LiteralString on PydanticCustomError (#562) 9381862e4 Use `__pydantic_serializer__` for serializing to JSON (#557) 4f1ce3359 remove `expect_fields_set` (#565) cb4266344 Uprev to 0.27.1 93af8cc92 Fix arguments to dataclass validation functions (#563) b23b38a07 install typing-extensions in emscripten runner (#564) 43aa422a4 rename LaxOrStrictBuilder ser variable (#561) 435e43a99 Uprev to 0.27.0 (#560) ba8079bf1 allow subclassing of ValidationError (#556) 414745ca4 Uprev to 0.26.0 (#559) c31fe514e Support RichComparison, hash and deepcopy for Url and MultiHostUrl (#558) ae4cb2851 Fix serialization of models with computed fields (#550) 51f24f6a0 [skip ci] case in wasm-preview 435228d78 allow running tests on a specific version (#551) da5577704 uprev 3c553b7b1 Computed fields (#547) f8cafe7de Uprev to 0.24.1 02ec941e1 Fix enum value literals (#544) 2e2bd34ff allow partials to "call" validator (#546) 493bbb6f3 serialization test coverage 633227f39 uprev d786d1b91 `LazyIndexMap` for JSON objects (#522) 5c908510b Add ultra-strict mode for better union decisions (#536) dd98ccc1f Add python benchmarks for literal values 668474adf Use black_box correctly in benchmarks 0cb0e579d Add benchamrks for literal str/int from json cfd4334f5 Add enum literal benchamrks b1a5f9620 Fix CoreSchema's workaround (#543) ed3a37219 Add benchamrks for literals 0ef8e7e8b No info argument (#535) 043e0e4cd test with debug build on CI (#541) c85f9acb0 remove check-debug.sh, ruff does the same check f128c223a fix "make build-dev" for local development (#539) cf543e2fa Uprev to 0.23.1 938a0bbd5 Skip extra/unknown fields checks when using from_attributes=True (#537) 8dca91d64 use pyo3-signature for serializer defautls (#534) c6b3f1c29 Use `__pydantic_serializer__` in to_jsonable_python (#533) e2a0bdee3 Don't recurse into metadata (#532) 23ac0db84 Fix issue with recursive wrap function serializer schemas (#530) 6b43adeb7 fix error in wasm preview 534630ffe Make mypy ignore CoreSchema's typing (#528) cc7a74e0c [skip-ci] uprev f765a7c93 arguments validation improvements (#523) 8a0ecd4eb rename __fields_set__ -> __pydantic_fields_set__ (#527) f44a94298 better panic behaviour, should give us more to go on (#526) 8dae57007 Make validator complete required (#525) 91e84f231 simplify error `str()` (#512) 6a715433d Update pyo3 to 0.18.2, maturin to 0.14.16 (#519) 60b3ff20d add * to core_schema functions (#521) f10e52726 show wasm binary size in CI 0f9786410 Add PyPy wheels for Windows (#511) 49ee9ea2e Update pyodide to 0.23.0 (#520) 1276e375b allow function-wrap-schema to reuse parent schema (#515) cd5cd657c Serialize support `Path` and add `fallback` function, JSON improvements (#514) 330911aed move InitErrorDetails to be public (#513) f6657a479 uprev to v0.21.0 fd987e880 support for raising `ValidationError` directly (#510) 227292bfc Change args to list (#508) e65b46f6d cleanup lookup_key.rs a6440498b catch cycles ValidationError.json() (#509) 7182275dc Error loc (#507) 431336851 Uprev to 0.20.0 af07999f1 Implement frozen and extra_behavior for dataclasses (#505) 8b2be899f follow on from #501, fix "list_all_errors" (#506) ecc8df4e3 Different error messages for JSON input (#501) 4b1e57c17 Uprev to 0.19.0 (#502) b384a37fe adding to_jsonable_python method (#500) eab7e5d80 add `ValidationError.json()` method as per V1 (#499) 958af0430 allow subclasses even in strict mode (#498) 956a23505 Model subclass instances (#492) 12f596dd6 Fix complete not being implemented for all validator types properly (#494) 4b2210953 Uprev to 0.18.1 6a830dc73 Revert behavior change in error reporting for function after validators (#495) 7662bdd1a Uprev to 0.18.0 772f59839 Uncomment some assertion (#493) 5c6d31f6b Make validate_assignment a part of the Validator trait (#478) b80e0f64d remove isort, use ruff 960aad2f9 Remove duplicate code from field_after_validator_function doc (#491) 3837b5a94 Remove duplicate test case from test_arguments (#490) cb05dcfae Uprev version to 0.17.1 (#489) f4759a38b validating default value (#479) cdeba7070 trying using venv to fix alpine issue (#488) 3032121e7 fix test-builds-arch 81c8ad7aa Uprev version to 0.17.0 (#487) cbbc3aabd ignore docstring tests in test-builds-arch 9154a0177 ignore docstring tests in test-builds-os e61f71b93 try ubuntu-20.04 (#486) ccae42450 CI: rustc --version --verbose (#481) 40b72a379 Add 'frozen' to Config & SchemaValidator (#462) d74ff2ead Uprev coverage to 7.2.2 (#471) d1626f0f4 chore: Update maturin action in CI (#476) 70dcb069f use `pytest-examples` (#465) dcf1fdd5d build: Use `PYTHON` to determine the correct python executable (#469) ab1723222 Add metadata to dataclass-field (#470) 752d9c80a Add `type` to `TypedDictField` (#457) 389b9ed2e Uprev version to 0.16.1 c98045878 Rename validation / serialization symbols to homogenize naming (#467) 518579015 Use 'Invalid Schema:' as prefix (#468) 4406af62e Add ability to collect validation errors for SchemaError (#466) 3b53edf55 uprev 53dbdcefd add support for "init mode" in `SchemaValidator` (#443) b9bb303bb Uprev version to 0.15.2 94573520b Fix type of self argument for model serializer's to_json method (#461) fe4601ae8 ValidationInfo.__repr__ (#460) a5f1ed9ef Uprev version to 0.15.1 (#459) f19c3fc98 Fix lack of model info for to_json serialization (#458) 5ff4bf621 Uprev version to 0.15.0 (#456) dfb5be68e Allow serializers to accept a model instance (#437) 5efeaf9fe Flatten CoreSchema types to get a single discriminant key (#450) 28ff34efc Uprev version to 0.14.1 (#455) 3f96b0988 Set info.data and info.field_name for dataclass field validators (#454) 653308ff6 Uprev version to 0.14.0 6a200c983 Add `field_name` to `ValidatorInfo` (#439) cc79b0580 uprev bdab841b9 remove most python caching from ci b5d6f7eb9 Custom dataclass validator (#428) cca85d783 coverage only on 3.11 (#453) 5ca4db70a Uprev version to 0.12.1 (#449) e646b44c7 Support dict keys, values and items on PyPy (#448) a79147dc4 Convert tuples from *args into lists in schemas (#431) 7a4666490 Update repr of SchemaValidator (#442) 88a555e47 Fix typehint for discriminator; add test (#441) d7ff64d1c make all getters read only (#429) e0008e9c5 move py to first parameter of ValidationInfo::new 949944100 Uprev version to 0.12.0 (#426) ccc7c2703 Replace **kwargs with a ValidatorInfo object in validation functions (#423) 5763f90e5 tweak value_exception.rs ee3da4c69 uprev to 0.11.1 (#421) 58555d849 Implement garbage collection for Rust data holding refs to Python objects (#416) e976b8110 bump pyright linter version (#418) ad5005a8f uprev to 0.11.0 (#414) c17abdd99 Adding definitions support (#406) 8d0678cd0 adding more string benchmarks (#412) 786f4c009 tests for serializing dataclasses with InitVar and ClassVar (#411) e248ef72e Support include/exclude arguments with `__contains__` (#409) ad6588cfc add ErrorDetails to public interface (#384) 11bd0c715 uprev to 0.10.0 (#408) 5bc4689bb Use `ChoiceKey` in `TaggedUnionValidator` for int keys (#405) 3ea00bd8d Add some notes to the documentation of some of the arguments of certain CoreSchema types (#391) 6616c9a3f bump b85a44a9f Add min-length support for GeneratorSchema (#394) c1d0d7cb7 rename extra->metadata, fix #395 (#396) cbbfead0f uprev to 0.9.0 7dcf502e3 Add CoreSchemaType Literal (#389) 27a33670d Update pyo3 to 0.18.1 (#388) bfb373c26 fix pyo3 git ref 23005c6ae add pydantic framkework classifier (#379) 2fd9b1c4e another fix to function_wrap_ser_schema types 03c8e09a1 add type hints for function-wrap ea6024360 fix benchmarks using pydantic 20601a18b add benchmarks for serializing a simple model 9736a8dbf implement `function-wrap` serializer type to support `deque` and similar (#376) 90a956cc9 tweak filter methods f373fdfb9 fix string_schema refs 6106b8f3b fix issue with windows CI 5e69c60ee add to_string_ser_schema, add more custom serializers 237743cdc More Serialization changes (#374) e3607eb3a rename string_schema -> str_schema 7d7ca9f1d general `to_json` method and more inferred types (#372) a478fa478 fix `is_enum` (#373) 0ce0f57b7 Serialize improvements (#370) 084c5516d add build tests on ppc64le, simplify (#369) 3844ea96b rename new-class, new_class and 'new class' occurences to 'model'; rename files (#368) 8fc71df47 couple more tests 138386be2 uprev ed9747cbf Union Serialization (#357) fb69c3916 feat: remove usage of nohash_hasher in favor of ahash (#360) 3aa86a7c1 linting 57109a8d7 Test on other OSs, remove CI benchmarks (#366) 8f42a9a50 Support `kwargs` with `from_attributes` (#306) 459e59ecc try `mimalloc/local_dynamic_tls` (#363) b41605f3a utf8 error fixed on pypy with pyo3 0.18 (#364) 82d071a4e Add python bindings for constructors for Url and MultiHostUrl (#349) cf82eda01 Upgrade pyo3 to 0.18.0 (#361) 25120edac add docstrings and docstring tests (#350) 168753540 Serialization (#327) d6e7890b3 update pyodide to 0.22.0 (#351) 9e54f7833 molify grumpy clippy 03a2adf24 add `strip = true` to release profile (#348) 883048a6b Uprev linting (#346) 9973ceebf Implement datetime timezone constraints (#343) 7f01bff00 disable coverage on CI with PyPy (#344) bb28794a5 tweak large benchmark ordering 24965d7e3 add large model benchmark 94b67f441 mxschmitt/action-tmate on failure to investigate seg faults (#341) a084f30d9 Implement `LaxOrStrictValidator` (#330) 9f2cd677d Upgrade pytest-codspeed to 1.2.0 (#337) 85eb377c6 Fix the Compile time RNG seed when running the benchmarks (#338) 2712e6c2e Upgrade maturin to 0.14 (#336) 7eb555b33 switch codspeed to tokenless uploads (#335) e146483e2 Improve PyMapping related function (#314) bfe2d1348 switch flake8->ruff (#334) 1900f4abd add s390x & ppc64le linux binaries (#333) 79ad25513 Integrate codspeed (#332) 463ed7aa8 Multi host URLs, other URL changes (#325) e749174dd fix error details type hints 572ba7d6a Url strictness (#324) 34c52d3ed some more test cases 7b77c6f8c hypothesis tweaks (#321) 5ab27628a try switching pytest-sugar -> pytest-pretty (#322) 791e06ac4 uprev pyo3 to 0.17.3 (#320) 754fc2ba3 add more strict mode tests (#319) f23c6a7e4 Url Type (#317) 9028b4f33 ✏ Fix micro typo in README (#318) cf4a5cd9f a few misc tweaks (#315) bd721b56f 3.11 windows builds (#311) bcf799f0e uprev to 0.6.0 da0a6c72a uprev 1ab918292 tests to confirm "loc" on errors with an alias (#310) 96939192a Error changes (#307) 8f2daf68e uprev-deps (#308) ea5c83256 fix linting for newest clippy (#309) 5731c23dc uprev be7b07e3a Change how arguments are defined (#304) fc42f4fa9 uprev b7cb4d211 add name to function validators (#303) 9bbe0d946 Add `IsSubclassValidator` (#301) 72caae4e8 fix repr for single literals (#300) d1feaa3d2 Allow `Sequence` and `tuple` to `is_instance` validator (#299) a8a1f1afc combine `literal_single_error` and `literal_multiple_error` (#298) 44436263e Ci tweaks (#297) 7029215d6 tweak type annotations for PydanticCustomError and PydanticKindError b20753bdc uprev, use single quotes in cargo.toml 99b7472ac support future and past dates and datetimes (#295) 8a3dae507 set clippy to catch dbg and print 800114be3 uprev c9b3d20ae Logic for instances of subclasses of strings (#294) 49d77deef add json_function to is_instance validator (#293) ad12e4738 Schema extra (#292) e671f3364 currect use of Str…
Change Summary
Following #155 and #866, here is a proposal of implementation to simplify dynamic default values
Right now, to have a dynamic default value, we need to use
validatorslikeNow, we can use
default_factory(same name as dataclasses.to be consistent)Related issue number
#155 and #866
Checklist
changes/<pull request or issue id>-<github username>.mdfile added describing change(see changes/README.md for details)