17
0

20 Commits

Author SHA256 Message Date
47ae5f04b7 Accepting request 1299498 from devel:languages:python
- Add patch support-pydantic-core-2.39.0.patch:
  * Support pydantic-core 2.39.0.

OBS-URL: https://build.opensuse.org/request/show/1299498
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=34
2025-08-17 12:50:02 +00:00
6ff2e7b297 - Add patch support-pydantic-core-2.39.0.patch:
* Support pydantic-core 2.39.0.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=75
2025-08-15 04:23:45 +00:00
8fa841d96f Accepting request 1287850 from devel:languages:python
To stage with the python-pydantic-core 2.35.1 update in sr#1287849

- Add patch bump-pydantic-core-2.35.1.patch to support latest
  pydantic-core, gh#pydantic/pydantic#11963
- Add patch field-name-validator-core-schemas.patch to remove
  deprecation warning, gh#pydantic/pydantic#11761
- Update to 2.11.7
  * Copy FieldInfo instance if necessary during FieldInfo build by @Viicos in #11980
2.11.6
  * Rebuild dataclass fields before schema generation by @Viicos in #11949
  * Always store the original field assignment on FieldInfo by @Viicos in #11946
2.11.5
  * Check if FieldInfo is complete after applying type variable map by @Viicos in #11855
  * Do not delete mock validator/serializer in model_rebuild() by @Viicos in #11890
  * Do not duplicate metadata on model rebuild by @Viicos in #11902

- Update to 2.11.4
  * Bump mkdocs-llmstxt to v0.2.0
  * Allow config and bases to be specified together in create_model()
  * This change was backported as it was previously possible
    (although not meant to be supported)
  * To provide model_config as a field, which would make it
    possible to provide both configuration and bases.
  * Remove generics cache workaround
  * Remove coercion of decimal constraints
  * Fix crash when expanding root type in the mypy plugin
  * Fix issue with recursive generic models
  * Traverse function-before schemas during schema gathering
- Drop field_name.patch, merged upstream
- Update BuildRequires and Requires from pyproject.toml

OBS-URL: https://build.opensuse.org/request/show/1287850
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=33
2025-06-24 18:46:02 +00:00
f07b39b7ee - Add patch bump-pydantic-core-2.35.1.patch to support latest
pydantic-core, gh#pydantic/pydantic#11963
- Add patch field-name-validator-core-schemas.patch to remove
  deprecation warning, gh#pydantic/pydantic#11761
- Update to 2.11.7
  * Copy FieldInfo instance if necessary during FieldInfo build by @Viicos in #11980
2.11.6
  * Rebuild dataclass fields before schema generation by @Viicos in #11949
  * Always store the original field assignment on FieldInfo by @Viicos in #11946
2.11.5
  * Check if FieldInfo is complete after applying type variable map by @Viicos in #11855
  * Do not delete mock validator/serializer in model_rebuild() by @Viicos in #11890
  * Do not duplicate metadata on model rebuild by @Viicos in #11902

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=73
2025-06-23 06:57:01 +00:00
da23bc9bcd Accepting request 1274365 from home:glaubitz:branches:devel:languages:python
- Update to 2.11.4
  * Bump mkdocs-llmstxt to v0.2.0
  * Allow config and bases to be specified together in create_model()
  * This change was backported as it was previously possible
    (although not meant to be supported)
  * To provide model_config as a field, which would make it
    possible to provide both configuration and bases.
  * Remove generics cache workaround
  * Remove coercion of decimal constraints
  * Fix crash when expanding root type in the mypy plugin
  * Fix issue with recursive generic models
  * Traverse function-before schemas during schema gathering
- Drop field_name.patch, merged upstream
- Update BuildRequires and Requires from pyproject.toml

OBS-URL: https://build.opensuse.org/request/show/1274365
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=72
2025-05-05 14:56:49 +00:00
471770ba28 Accepting request 1272629 from devel:languages:python
- Add upstream field_name.patch for compatibility with recent pydantic-core
- Add missing Requires on typing-inspection.
- update to 2.11.3:
  * Preserve field description when rebuilding model fields
- update to 2.11.2:
  * Make sure __pydantic_private__ exists before setting private attributes
  * Do not override FieldInfo._complete when using field from parent class
  * Provide the available definitions when applying discriminated unions
  * Do not expand root type in the mypy plugin for variables
  * Mention the attribute name in model fields deprecation message
  * Properly validate parameterized mappings
- update to 2.11.1:
  * Do not override 'definitions-ref' schemas containing serialization schemas or metadata
- update to 2.11.0:
  * Re-enable memray related tests on Python 3.12+
  * Add a check_pydantic_core_version() function
  * Remove greenlet development dependency
  * Support unsubstituted type variables with both a default and a bound or constraints
  * Add a default_factory_takes_validated_data property to FieldInfo
  * Raise a better error when a generic alias is used inside type[]
  * Properly support PEP 695 generics syntax
  * Properly support type variable defaults
  * Add support for validating v6, v7, v8 UUIDs
  * Improve alias configuration APIs
  * Add experimental support for free threading
  * Add encoded_string() method to the URL types
  * Add support for defer_build with @validate_call decorator
  * Allow @with_config decorator to be used with keyword arguments
  * Simplify customization of default value inclusion in JSON Schema generation
  * Add generate_arguments_schema() function
  * Rework create_model field definitions format
  * Raise a deprecation warning when a field is annotated as final with a default value
  * Deprecate accessing model_fields and model_computed_fields on instances
  * Move core schema generation logic for path types inside the GenerateSchema class
  * Move Mapping schema gen to GenerateSchema to complete removal of prepare_annotations_for_known_type workaround
  * Remove Python 3.8 Support
  * Optimize calls to get_type_ref
  * Disable pydantic-core core schema validation
  * Only evaluate FieldInfo annotations if required during schema building
  * Improve __setattr__ performance of Pydantic models by caching setter functions
  * Improve annotation application performance
  * Improve performance of _typing_extra module
  * Refactor and optimize schema cleaning logic
  * Create a single dictionary when creating a CoreConfig instance
  * Reuse cached core schemas for parametrized generic Pydantic models
  * Add validation tests for _internal/_validators.py
  * Subclass all single host url classes from AnyUrl to preserve behavior from v2.9
  * Improve TypeAdapter instance repr
  * Use the correct frame when instantiating a parametrized TypeAdapter
  * Relax check for validated data in default factory utils
  * Fix type checking issue with model_fields and model_computed_fields
  * Use the parent configuration during schema generation for stdlib dataclasses
  * Use the globals of the function when evaluating the return type of serializers and computed_fields
  * Fix url constraint application
  * Fix URL equality with different validation methods
  * Fix JSON schema title when specified as ''
  * Do not evaluate annotations for private fields
  * Support serialization as any for Secret types and Url types
  * Fix type hint of Field.default to be compatible with Python 3.8 and 3.9
  * hashing support for urls
  * Hide BaseModel.__replace__ definition from type checkers
  * Set fields when defer_build is set on Pydantic dataclasses
  * Do not resolve the JSON Schema reference for dict core schema keys
  * Use the globals of the function when evaluating the return type for PlainSerializer and WrapSerializer functions
  * Fix host required enforcement for urls to be compatible with v2.9 behavior
  * Fix url json schema in serialization mode
  * Fix for comparison of AnyUrl objects
  * Properly fetch PEP 695 type params for functions, do not fetch annotations from signature
  * Infer final fields with a default value as class variables in the mypy plugin
  * Recursively unpack Literal values if using PEP 695 type aliases
  * Override __subclasscheck__ on ModelMetaclass to avoid memory leak and performance issues
  * Include JSON Schema input core schema in function schemas
  * Add len to _BaseUrl to avoid TypeError
  * Make sure the type reference is removed from the seen references
  * Add FastAPI and SQLModel to third-party tests
  * Improve discriminated union error message for invalid union variants
  * Unpack PEP 695 type aliases if using the Annotated form
  * Remove custom MRO implementation of Pydantic models
  * Add pandera third-party tests
  * Add ODMantic third-party tests
  * Copy WithJsonSchema schema to avoid sharing mutated data
  * Do not cache parametrized models when in the process of parametrizing another model
  * Add discriminated union related metadata entries to the CoreMetadata definition
  * Consolidate schema definitions logic in the _Definitions class
  * Fix url serialization for unions
  * Support initializing root model fields with values of the root type in the mypy plugin
  * Move deque schema gen to GenerateSchema class

OBS-URL: https://build.opensuse.org/request/show/1272629
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=32
2025-04-25 20:17:56 +00:00
8c78ba441f Accepting request 1272628 from home:mcalabkova:branches:devel:languages:python
- Add upstream field_name.patch for compatibility with recent pydantic-core

OBS-URL: https://build.opensuse.org/request/show/1272628
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=70
2025-04-25 09:37:37 +00:00
792c6d9221 - Add missing Requires on typing-inspection.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=69
2025-04-24 04:47:31 +00:00
51e012857a Accepting request 1271997 from home:rrahl0
need pytest-run-parallel

OBS-URL: https://build.opensuse.org/request/show/1271997
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=68
2025-04-23 09:35:07 +00:00
6e5b9a0d5f Accepting request 1240305 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1240305
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=31
2025-01-29 15:09:40 +00:00
da00c576a5 Accepting request 1240258 from home:ecsos:python
- Update to 2.10.6
  * Fixes
    - Fix JSON Schema reference collection with 'examples' keys by @Viicos in #11325
    - Fix url python serialization by @sydney-runkle in #11331
- Changes from 2.10.5
  * Fixes
    - Remove custom MRO implementation of Pydantic models by @Viicos in #11184
    - Fix URL serialization for unions by @sydney-runkle in #11233
- Changes from 2.10.4
  * Packaging
    - Bump pydantic-core to v2.27.2 by @davidhewitt in #11138
  * Fixes
    - Fix for comparison of AnyUrl objects by @alexprabhat99 in #11082
    - Properly fetch PEP 695 type params for functions, do not fetch annotations from signature by @Viicos in #11093
    - Include JSON Schema input core schema in function schemas by @Viicos in #11085
    - Add len to _BaseUrl to avoid TypeError by @Kharianne in #11111
    - Make sure the type reference is removed from the seen references by @Viicos in #11143
- Changes from 2.10.3
  * Fixes
    - Set fields when defer_build is set on Pydantic dataclasses by @Viicos in #10984
    - Do not resolve the JSON Schema reference for dict core schema keys by @Viicos in #10989
    - Use the globals of the function when evaluating the return type for PlainSerializer and WrapSerializer functions by @Viicos in #11008
    - Fix host required enforcement for urls to be compatible with v2.9 behavior by @sydney-runkle in #11027
    - Add a default_factory_takes_validated_data property to FieldInfo by @Viicos in #11034
    - Fix url json schema in serialization mode by @sydney-runkle in #11035
- Changes from 2.10.2
  * Fixes
    - Only evaluate FieldInfo annotations if required during schema building by @Viicos in #10769
    - Do not evaluate annotations for private fields by @Viicos in #10962
    - Support serialization as any for Secret types and Url types by @sydney-runkle in #10947
    - Fix type hint of Field.default to be compatible with Python 3.8 and 3.9 by @Viicos in #10972
    - Add hashing support for URL types by @sydney-runkle in #10975
    - Hide BaseModel.__replace__ definition from type checkers by @Viicos in 10979
- Changes from 2.10.1
  * Packaging
    - Bump pydantic-core version to v2.27.1 by @sydney-runkle in #10938
  * Fixes
    - Use the correct frame when instantiating a parametrized TypeAdapter by @Viicos in #10893
    - Relax check for validated data in default_factory utils by @sydney-runkle in #10909
    - Fix type checking issue with model_fields and model_computed_fields by @sydney-runkle in #10911
    - Use the parent configuration during schema generation for stdlib dataclasses by @sydney-runkle in #10928
    - Use the globals of the function when evaluating the return type of serializers and computed_fields by @Viicos in #10929
    - Fix URL constraint application by @sydney-runkle in #10922
    - Fix URL equality with different validation methods by @sydney-runkle in #10934
    - Fix JSON schema title when specified as '' by @sydney-runkle in #10936
    - Fix python mode serialization for complex inference by @sydney-runkle in pydantic-core#1549
- Changes from 2.10.0
  * Packaging
    - Bump pydantic-core to v2.27.0 by @sydney-runkle in #10825
    - Replaced pdm with uv by @frfahim in #10727
  * New Features
    - Support fractions.Fraction by @sydney-runkle in #10318
    - Support Hashable for json validation by @sydney-runkle in #10324
    - Add a SocketPath type for linux systems by @theunkn0wn1 in #10378
    - Allow arbitrary refs in JSON schema examples by @sydney-runkle in #10417
    - Support defer_build for Pydantic dataclasses by @Viicos in #10313
    - Adding v1 / v2 incompatibility warning for nested v1 model by @sydney-runkle in #10431
    - Add support for unpacked TypedDict to type hint variadic keyword arguments with @validate_call by @Viicos in #10416
    - Support compiled patterns in protected_namespaces by @sydney-runkle in #10522
    - Add support for propertyNames in JSON schema by @FlorianSW in #10478
    - Adding __replace__ protocol for Python 3.13+ support by @sydney-runkle in #10596
    - Expose public sort method for JSON schema generation by @sydney-runkle in #10595
    - Add runtime validation of @validate_call callable argument by @kc0506 in #10627
    - Add experimental_allow_partial support by @samuelcolvin in #10748
    - Support default factories taking validated data as an argument by @Viicos in #10678
    - Allow subclassing ValidationError and PydanticCustomError by @Youssefares in pydantic/pydantic-core#1413
    - Add trailing-strings support to experimental_allow_partial by @sydney-runkle in #10825
    - Add rebuild() method for TypeAdapter and simplify defer_build patterns by @sydney-runkle in #10537
    - Improve TypeAdapter instance repr by @sydney-runkle in #10872
  * Changes
    - Don't allow customization of SchemaGenerator until interface is more stable by @sydney-runkle in #10303
    - Cleanly defer_build on TypeAdapters, removing experimental flag by @sydney-runkle in #10329
    - Fix mro of generic subclass by @kc0506 in #10100
    - Strip whitespaces on JSON Schema title generation by @sydney-runkle in #10404
    - Use b64decode and b64encode for Base64Bytes type by @sydney-runkle in #10486
    - Relax protected namespace config default by @sydney-runkle in #10441
    - Revalidate parametrized generics if instance's origin is subclass of OG class by @sydney-runkle in #10666
    - Warn if configuration is specified on the @dataclass decorator and with the __pydantic_config__ attribute by @sydney-runkle in #10406
    - Recommend against using Ellipsis (...) with Field by @Viicos in #10661
    - Migrate to subclassing instead of annotated approach for pydantic url types by @sydney-runkle in #10662
    - Change JSON schema generation of Literals and Enums by @Viicos in #10692
    - Simplify unions involving Any or Never when replacing type variables by @Viicos in #10338
    - Do not require padding when decoding base64 bytes by @bschoenmaeckers in pydantic/pydantic-core#1448
    - Support dates all the way to 1BC by @changhc in pydantic/speedate#77
  * Performance
    - Schema cleaning: skip unnecessary copies during schema walking by @Viicos in #10286
    - Refactor namespace logic for annotations evaluation by @Viicos in #10530
    - Improve email regexp on edge cases by @AlekseyLobanov in #10601
    - CoreMetadata refactor with an emphasis on documentation, schema build time performance, and reducing complexity by @sydney-runkle in #10675
  * Fixes
    - Remove guarding check on computed_field with field_serializer by @nix010 in #10390
    - Fix Predicate issue in v2.9.0 by @sydney-runkle in #10321
    - Fixing annotated-types bound by @sydney-runkle in #10327
    - Turn tzdata install requirement into optional timezone dependency by @jakob-keller in #10331
    - Use correct types namespace when building namedtuple core schemas by @Viicos in #10337
    - Fix evaluation of stringified annotations during namespace inspection by @Viicos in #10347
    - Fix IncEx type alias definition by @Viicos in #10339
    - Do not error when trying to evaluate annotations of private attributes by @Viicos in #10358
    - Fix nested type statement by @kc0506 in #10369
    - Improve typing of ModelMetaclass.mro by @Viicos in #10372
    - Fix class access of deprecated computed_fields by @Viicos in #10391
    - Make sure inspect.iscoroutinefunction works on coroutines decorated with @validate_call by @MovisLi in #10374
    - Fix NameError when using validate_call with PEP 695 on a class by @kc0506 in #10380
    - Fix ZoneInfo with various invalid types by @sydney-runkle in #10408
    - Fix PydanticUserError on empty model_config with annotations by @cdwilson in #10412
    - Fix variance issue in _IncEx type alias, only allow True by @Viicos in #10414
    - Fix serialization schema generation when using PlainValidator by @Viicos in #10427
    - Fix schema generation error when serialization schema holds references by @Viicos in #10444
    - Inline references if possible when generating schema for json_schema_input_type by @Viicos in #10439
    - Fix recursive arguments in Representation by @Viicos in #10480
    - Fix representation for builtin function types by @kschwab in #10479
    - Add python validators for decimal constraints (max_digits and decimal_places) by @sydney-runkle in #10506
    - Only fetch __pydantic_core_schema__ from the current class during schema generation by @Viicos in #10518
    - Fix stacklevel on deprecation warnings for BaseModel by @sydney-runkle in #10520
    - Fix warning stacklevel in BaseModel.__init__ by @Viicos in #10526
    - Improve error handling for in-evaluable refs for discriminator application by @sydney-runkle in #10440
    - Change the signature of ConfigWrapper.core_config to take the title directly by @Viicos in #10562
    - Do not use the previous config from the stack for dataclasses without config by @Viicos in #10576
    - Fix serialization for IP types with mode='python' by @sydney-runkle in #10594
    - Support constraint application for Base64Etc types by @sydney-runkle in #10584
    - Fix validate_call ignoring Field in Annotated by @kc0506 in #10610
    - Raise an error when Self is invalid by @kc0506 in #10609
    - Using core_schema.InvalidSchema instead of metadata injection + checks by @sydney-runkle in [#1...

OBS-URL: https://build.opensuse.org/request/show/1240258
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=66
2025-01-25 21:10:38 +00:00
ece5a4cbec Accepting request 1218159 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1218159
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=30
2024-10-25 17:19:09 +00:00
81554033f9 Accepting request 1218139 from home:yeey:OpenWebUI
SUSE AI needs a more recent version

OBS-URL: https://build.opensuse.org/request/show/1218139
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=64
2024-10-25 05:27:29 +00:00
ed34bd7f24 Accepting request 1184776 from devel:languages:python
- update to 2.8.0:
  * Update citation version automatically with new releases
  * Bump pyright to `v1.1.367` and add type checking tests for
    pipeline API
  * Update `pydantic.v1` stub to `v1.10.17`
  * General package updates to prep for `v2.8.0b1`
  * Bump `pydantic-core` to `v2.20.0`
  * Add support for Python 3.13
  * Update `pdm` version used for `pdm.lock` to v2.16.1
  * Update to `ruff` `v0.4.8`
  * Experimental: support `defer_build` for `TypeAdapter`
  * Implement `deprecated` field in json schema
  * Experimental: Add pipeline API
  * Add support for programmatic title generation
  * Implement `fail_fast` feature
  * Add `ser_json_inf_nan='strings'` mode to produce valid JSON
  * Replace `__spec__.parent` with `__package__`
  * Fix Outputted Model JSON Schema for `Sequence` type
  * Fix typing of `_frame_depth`
  * Make `ImportString` json schema compatible
  * Hide private attributes (`PrivateAttr`) from `__init__`
    signature in type checkers
  * Make detection of `TypeVar` defaults robust to the CPython
    `PEP-696` implementation
  * Fix usage of `PlainSerializer` with builtin types
  * Add more robust custom validation examples
  * Fix ignored `strict` specification for
    `StringConstraint(strict=False)`
  * Use `Self` where possible
  * Do not alter `RootModel.model_construct` signature in the

OBS-URL: https://build.opensuse.org/request/show/1184776
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=29
2024-07-02 16:14:50 +00:00
7010590fbd OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=62 2024-07-02 06:07:32 +00:00
516f52d744 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=61 2024-07-01 17:25:27 +00:00
3ed8cb7b37 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=60 2024-07-01 17:06:54 +00:00
03aec1e9b4 - update to 2.8.0:
* Update citation version automatically with new releases
  * Bump pyright to `v1.1.367` and add type checking tests for
    pipeline API
  * Update `pydantic.v1` stub to `v1.10.17`
  * General package updates to prep for `v2.8.0b1`
  * Bump `pydantic-core` to `v2.20.0`
  * Add support for Python 3.13
  * Update `pdm` version used for `pdm.lock` to v2.16.1
  * Update to `ruff` `v0.4.8`
  * Experimental: support `defer_build` for `TypeAdapter`
  * Implement `deprecated` field in json schema
  * Experimental: Add pipeline API
  * Add support for programmatic title generation
  * Implement `fail_fast` feature
  * Add `ser_json_inf_nan='strings'` mode to produce valid JSON
  * Replace `__spec__.parent` with `__package__`
  * Fix Outputted Model JSON Schema for `Sequence` type
  * Fix typing of `_frame_depth`
  * Make `ImportString` json schema compatible
  * Hide private attributes (`PrivateAttr`) from `__init__`
    signature in type checkers
  * Make detection of `TypeVar` defaults robust to the CPython
    `PEP-696` implementation
  * Fix usage of `PlainSerializer` with builtin types
  * Add more robust custom validation examples
  * Fix ignored `strict` specification for
    `StringConstraint(strict=False)`
  * Use `Self` where possible
  * Do not alter `RootModel.model_construct` signature in the

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=59
2024-07-01 16:30:27 +00:00
f93ee20198 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=58 2024-06-30 20:52:08 +00:00
37a899ef23 - drop optional email-validator dependency
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=57
2024-06-30 20:45:03 +00:00
3 changed files with 304 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Aug 15 04:23:15 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-pydantic-core-2.39.0.patch:
* Support pydantic-core 2.39.0.
-------------------------------------------------------------------
Mon Jun 23 05:56:23 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pydantic
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
# Copyright (c) 2019, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
@@ -37,11 +37,13 @@ Source: https://github.com/pydantic/pydantic/archive/v%{version}.tar.gz#
Patch0: bump-pydantic-core-2.35.1.patch
# PATCH-FIX-UPSTREAM field-name-validator-core-schemas.patch gh#pydantic/pydantic#11761
Patch1: field-name-validator-core-schemas.patch
# PATCH-FIX-UPSTREAM Based on gh#pydantic/pydantic#11883
Patch2: support-pydantic-core-2.39.0.patch
BuildRequires: %{python_module hatch-fancy-pypi-readme}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pydantic-core = 2.35.1}
BuildRequires: %{python_module pydantic-core = 2.39.0}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -62,10 +64,7 @@ BuildRequires: %{python_module rich}
BuildRequires: %{python_module typing-inspection}
%endif
Requires: python-annotated-types >= 0.4.0
%if 0%{?python_version_nodots} < 310
Requires: python-eval-type-backport
%endif
Requires: python-pydantic-core = 2.35.1
Requires: python-pydantic-core = 2.39.0
Requires: python-typing-extensions >= 4.12.2
Requires: python-typing-inspection
BuildArch: noarch

View File

@@ -0,0 +1,293 @@
From d6c65493a8436b22733d0f04d0bb3df1bc952ac9 Mon Sep 17 00:00:00 2001
From: Viicos <65306057+Viicos@users.noreply.github.com>
Date: Fri, 16 May 2025 15:46:24 +0200
Subject: [PATCH 1/8] Add `UNSET` sentinel
---
pydantic/_internal/_generate_schema.py | 3 +
pydantic/fields.py | 4 +-
pydantic/json_schema.py | 7 +-
pyproject.toml | 2 +-
5 files changed, 15 insertions(+), 122 deletions(-)
Index: pydantic-2.11.7/pydantic/_internal/_generate_schema.py
===================================================================
--- pydantic-2.11.7.orig/pydantic/_internal/_generate_schema.py
+++ pydantic-2.11.7/pydantic/_internal/_generate_schema.py
@@ -42,6 +42,7 @@ from zoneinfo import ZoneInfo
import typing_extensions
from pydantic_core import (
+ MISSING,
CoreSchema,
MultiHostUrl,
PydanticCustomError,
@@ -1050,6 +1051,8 @@ class GenerateSchema:
return core_schema.multi_host_url_schema()
elif obj is None or obj is _typing_extra.NoneType:
return core_schema.none_schema()
+ if obj is MISSING:
+ return core_schema.missing_sentinel_schema()
elif obj in IP_TYPES:
return self._ip_schema(obj)
elif obj in TUPLE_TYPES:
Index: pydantic-2.11.7/pydantic/fields.py
===================================================================
--- pydantic-2.11.7.orig/pydantic/fields.py
+++ pydantic-2.11.7/pydantic/fields.py
@@ -15,7 +15,7 @@ from warnings import warn
import annotated_types
import typing_extensions
-from pydantic_core import PydanticUndefined
+from pydantic_core import MISSING, PydanticUndefined
from typing_extensions import Self, TypeAlias, Unpack, deprecated
from typing_inspection import typing_objects
from typing_inspection.introspection import UNKNOWN, AnnotationSource, ForbiddenQualifier, Qualifier, inspect_annotation
@@ -392,7 +392,7 @@ class FieldInfo(_repr.Representation):
Returns:
A field object with the passed values.
"""
- if annotation is default:
+ if annotation is not MISSING and annotation is default:
raise PydanticUserError(
'Error when building FieldInfo from annotated attribute. '
"Make sure you don't have any field name clashing with a type annotation.",
Index: pydantic-2.11.7/pydantic/json_schema.py
===================================================================
--- pydantic-2.11.7.orig/pydantic/json_schema.py
+++ pydantic-2.11.7/pydantic/json_schema.py
@@ -36,7 +36,7 @@ from typing import (
)
import pydantic_core
-from pydantic_core import CoreSchema, PydanticOmit, core_schema, to_jsonable_python
+from pydantic_core import MISSING, CoreSchema, PydanticOmit, core_schema, to_jsonable_python
from pydantic_core.core_schema import ComputedField
from typing_extensions import TypeAlias, assert_never, deprecated, final
from typing_inspection.introspection import get_literal_values
@@ -805,6 +805,17 @@ class GenerateJsonSchema:
result['type'] = 'null'
return result
+ def missing_sentinel_schema(self, schema: core_schema.MissingSentinelSchema) -> JsonSchemaValue:
+ """Generates a JSON schema that matches the `MISSING` sentinel value.
+
+ Args:
+ schema: The core schema.
+
+ Returns:
+ The generated JSON schema.
+ """
+ raise PydanticOmit
+
def enum_schema(self, schema: core_schema.EnumSchema) -> JsonSchemaValue:
"""Generates a JSON schema that matches an Enum value.
@@ -1109,7 +1120,7 @@ class GenerateJsonSchema:
json_schema = self.generate_inner(schema['schema'])
default = self.get_default_value(schema)
- if default is NoDefault:
+ if default is NoDefault or default is MISSING:
return json_schema
# we reflect the application of custom plain, no-info serializers to defaults for
Index: pydantic-2.11.7/pydantic/version.py
===================================================================
--- pydantic-2.11.7.orig/pydantic/version.py
+++ pydantic-2.11.7/pydantic/version.py
@@ -66,7 +66,7 @@ def version_info() -> str:
def check_pydantic_core_version() -> bool:
"""Check that the installed `pydantic-core` dependency is compatible."""
# Keep this in sync with the version constraint in the `pyproject.toml` dependencies:
- return __pydantic_core_version__ == '2.35.1'
+ return __pydantic_core_version__ == '2.39.0'
def parse_mypy_version(version: str) -> tuple[int, int, int]:
Index: pydantic-2.11.7/docs/concepts/experimental.md
===================================================================
--- pydantic-2.11.7.orig/docs/concepts/experimental.md
+++ pydantic-2.11.7/docs/concepts/experimental.md
@@ -502,3 +502,49 @@ args, kwargs = val.validate_json('{"args
print(args, kwargs)
#> ('arg1',) {'extra': 1}
```
+
+## `MISSING` sentinel
+
+The `MISSING` sentinel is a singleton indicating a field value was not provided during validation.
+
+This singleton can be used as a default value, as an alternative to `None` when it has an explicit
+meaning. During serialization, any field with `MISSING` as a value is excluded from the output.
+
+```python
+from typing import Union
+
+from pydantic import BaseModel
+from pydantic.experimental.missing_sentinel import MISSING
+
+
+class Configuration(BaseModel):
+ timeout: Union[int, None, MISSING] = MISSING
+
+
+# configuration defaults, stored somewhere else:
+defaults = {'timeout': 200}
+
+conf = Configuration()
+
+# `timeout` is excluded from the serialization output:
+conf.model_dump()
+# {}
+
+# The `MISSING` value doesn't appear in the JSON Schema:
+Configuration.model_json_schema()['properties']['timeout']
+#> {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'title': 'Timeout'}}
+
+
+# `is` can be used to discrimate between the sentinel and other values:
+timeout = conf.timeout if conf.timeout is not MISSING else defaults['timeout']
+```
+
+This feature is marked as experimental because it relies on the draft [PEP 661](https://peps.python.org/pep-0661/), introducing sentinels in the standard library.
+
+As such, the following limitations currently apply:
+
+* Static type checking of sentinels is only supported with Pyright
+ [1.1.402](https://github.com/microsoft/pyright/releases/tag/1.1.402)
+ or greater, and the `enableExperimentalFeatures` type evaluation setting
+ should be enabled.
+* Pickling of models containing `MISSING` as a value is not supported.
Index: pydantic-2.11.7/docs/errors/validation_errors.md
===================================================================
--- pydantic-2.11.7.orig/docs/errors/validation_errors.md
+++ pydantic-2.11.7/docs/errors/validation_errors.md
@@ -1384,6 +1384,27 @@ except ValidationError as exc:
#> 'missing_positional_only_argument'
```
+## `missing_sentinel_error`
+
+This error is raised when the experimental `MISSING` sentinel is the only value allowed, and wasn't
+provided during validation:
+
+```python
+from pydantic import BaseModel, ValidationError
+from pydantic.experimental.missing_sentinel import MISSING
+
+
+class Model(BaseModel):
+ f: MISSING
+
+
+try:
+ Model(f=1)
+except ValidationError as exc:
+ print(repr(exc.errors()[0]['type']))
+ #> 'missing_sentinel_error'
+```
+
## `model_attributes_type`
This error is raised when the input value is not a valid dictionary, model instance, or instance that fields can be extracted from:
Index: pydantic-2.11.7/pydantic/experimental/missing_sentinel.py
===================================================================
--- /dev/null
+++ pydantic-2.11.7/pydantic/experimental/missing_sentinel.py
@@ -0,0 +1,5 @@
+"""Experimental module exposing a function a `MISSING` sentinel."""
+
+from pydantic_core import MISSING
+
+__all__ = ('MISSING',)
Index: pydantic-2.11.7/pyproject.toml
===================================================================
--- pydantic-2.11.7.orig/pyproject.toml
+++ pydantic-2.11.7/pyproject.toml
@@ -46,7 +46,7 @@ dependencies = [
'typing-extensions>=4.13.0',
'annotated-types>=0.6.0',
# Keep this in sync with the version in the `check_pydantic_core_version()` function:
- 'pydantic-core==2.35.1',
+ 'pydantic-core==2.39.0',
'typing-inspection>=0.4.0',
]
dynamic = ['version', 'readme']
Index: pydantic-2.11.7/tests/test_missing_sentinel.py
===================================================================
--- /dev/null
+++ pydantic-2.11.7/tests/test_missing_sentinel.py
@@ -0,0 +1,71 @@
+import pickle
+from typing import Union
+
+import pytest
+from pydantic_core import MISSING, PydanticSerializationUnexpectedValue
+
+from pydantic import BaseModel, TypeAdapter, ValidationError
+
+
+def test_missing_sentinel_model() -> None:
+ class Model(BaseModel):
+ f: Union[int, MISSING] = MISSING
+ g: MISSING = MISSING
+
+ m1 = Model()
+
+ assert m1.model_dump() == {}
+ assert m1.model_dump_json() == '{}'
+
+ m2 = Model.model_validate({'f': MISSING, 'g': MISSING})
+
+ assert m2.f is MISSING
+ assert m2.g is MISSING
+
+ m3 = Model(f=1)
+
+ assert m3.model_dump() == {'f': 1}
+ assert m3.model_dump_json() == '{"f":1}'
+
+
+def test_missing_sentinel_type_adapter() -> None:
+ """Note that this usage isn't explicitly supported (and useless in practice)."""
+
+ # TODO Remove annotation with PEP 747:
+ ta: TypeAdapter[object] = TypeAdapter(MISSING)
+
+ assert ta.validate_python(MISSING) is MISSING
+
+ with pytest.raises(ValidationError) as exc_info:
+ ta.validate_python(1)
+
+ assert exc_info.value.errors()[0]['type'] == 'missing_sentinel_error'
+
+ assert ta.dump_python(MISSING) is MISSING
+
+ with pytest.raises(PydanticSerializationUnexpectedValue):
+ ta.dump_python(1)
+
+
+# Defined in module to be picklable:
+class ModelPickle(BaseModel):
+ f: Union[int, MISSING] = MISSING
+
+
+@pytest.mark.xfail(reason="PEP 661 sentinels aren't picklable yet in the experimental typing-extensions implementation")
+def test_missing_sentinel_pickle() -> None:
+ m = ModelPickle()
+ m_reconstructed = pickle.loads(pickle.dumps(m))
+
+ assert m_reconstructed.f is MISSING
+
+
+def test_missing_sentinel_json_schema() -> None:
+ class Model(BaseModel):
+ f: Union[int, MISSING] = MISSING
+ g: MISSING = MISSING
+ h: MISSING
+
+ assert Model.model_json_schema()['properties'] == {
+ 'f': {'title': 'F', 'type': 'integer'},
+ }