From nobody Sat Sep 30 00:48:56 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ry7rT0khgz4tx7d; Sat, 30 Sep 2023 00:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ry7rS63F2z4Trf; Sat, 30 Sep 2023 00:48:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696034936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Do8DEgBNM5nmCtycSIeoWzDEGkPFo/HMBVqloB49cFE=; b=YfetMoFYtcXPYG0RtnfinlAmLyXPn8wwZmSOLroU7w11m7pBFzMInGdffysNBNfDCCHFwk a0Iosl37ZeHZhq5K5nlfVVKXb9OHoLogvHSscfYT6pBHq8ktRCnjB7cF7tfejUSw53DsEI rfTpuPZWulVzwjMQxPIW7YZ33YnENrhTordxCHDDO7dGPtNCLRvYuOv+ohRGBiNl0ErmTC 4LzeYTbuDLFBJYCM3Onc73EuJyZkzPphlrZ0t37RHm+InugLY2gKzjzY5RPH41SKLKXOSE nVhSAlKSfbgTPWSPjU2NNREgTzLpl5sv19TPtzOY50ziPreaSQeJoF+tOoAgPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696034936; a=rsa-sha256; cv=none; b=C33jCYl97rEE2A2JtRJEiOhxcl1ikuLjKsnsKEH0Nw/hyd7ZfMt3qT0WeVQAPm+lHMJReJ AkgHk2FeacxSum2661evTYiZbjSzaUZ0S3wTX8MjAQsZ/WLTfksGPYW0QMz1UzXF6TCVn4 /abXCpXzxoCAAbjg+2DaXuYh39Vjw1/WFcdrQQwNkS/PPqdS4RAHULfm6P3KcYIH7WNK6W 6S2ruO+Lrrh+nV0tzOMoiQKFNmKPsn5Gn4id2gkDniiUBdfQtCE/cFrpAl0YlndG57lLj+ nX2ikBLw7J6OU7bVNJXHAQI3Dy0HN81hegKDj7XFQyciL4n+kr+ZLD9myq5rCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696034936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Do8DEgBNM5nmCtycSIeoWzDEGkPFo/HMBVqloB49cFE=; b=t02skrDhCvd8hAEg74bWlYygjXCUvDwhNb/gKI+8ZSfzVjgiPtdkDzIkYukBCH1JpcOBDZ R/cJAJoDEZ4lm8WH3Anz29S66GqyPoJ3uTUqY67y0MxRUtUjZm3ZmsWb5AaalQaxTBAx6a G8GQ67kKWjvYZMnrXbs9QBX7hEOLxLoUSVkwGkhf37IoI48krunTTnI4HXRccVg4mi+Yce I5K3Vv9sUXyvvt0gxE5g02ognnPGsuDlGOFkZKWbod3fwGd157ZWJl7N1NNDirDhefDDMx cpLgq5qkPdMCRFcVifq6lRHm4Cnjk3nTLAIy45Tsxe8X6TcGt5XLwaspuaPttA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ry7rS595vzBKl; Sat, 30 Sep 2023 00:48:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38U0mugX007447; Sat, 30 Sep 2023 00:48:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38U0mucC007444; Sat, 30 Sep 2023 00:48:56 GMT (envelope-from git) Date: Sat, 30 Sep 2023 00:48:56 GMT Message-Id: <202309300048.38U0mucC007444@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Po-Chuan Hsieh Subject: git: 2c0c366f476a - main - devel/py-pydantic2: Update to 2.4.2 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sunpoet X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c0c366f476a4f1f6943a7fe5aa03814fff6b3c2 Auto-Submitted: auto-generated The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=2c0c366f476a4f1f6943a7fe5aa03814fff6b3c2 commit 2c0c366f476a4f1f6943a7fe5aa03814fff6b3c2 Author: Po-Chuan Hsieh AuthorDate: 2023-09-30 00:22:09 +0000 Commit: Po-Chuan Hsieh CommitDate: 2023-09-30 00:44:34 +0000 devel/py-pydantic2: Update to 2.4.2 Changes: https://github.com/pydantic/pydantic/releases https://docs.pydantic.dev/latest/changelog/ --- devel/py-pydantic2/Makefile | 5 +- devel/py-pydantic2/distinfo | 6 +- devel/py-pydantic2/files/patch-pydantic-core | 270 --------------------------- 3 files changed, 5 insertions(+), 276 deletions(-) diff --git a/devel/py-pydantic2/Makefile b/devel/py-pydantic2/Makefile index 11e7e61ead5a..6494e77a9ebe 100644 --- a/devel/py-pydantic2/Makefile +++ b/devel/py-pydantic2/Makefile @@ -1,6 +1,5 @@ PORTNAME= pydantic -PORTVERSION= 2.3.0 -PORTREVISION= 3 +PORTVERSION= 2.4.2 CATEGORIES= devel python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -17,7 +16,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatch-fancy-pypi-readme>=22.5.0:devel/py-hatch-fancy-pypi-readme@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}hatchling>=0:devel/py-hatchling@${PY_FLAVOR} RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}annotated-types>=0.4.0:devel/py-annotated-types@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pydantic-core>=2.9.0<2.9.0_99:devel/py-pydantic-core@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pydantic-core>=2.10.1<2.10.1_99:devel/py-pydantic-core@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.6.1:devel/py-typing-extensions@${PY_FLAVOR} USES= python diff --git a/devel/py-pydantic2/distinfo b/devel/py-pydantic2/distinfo index 659dcd551d3c..9962ee599f71 100644 --- a/devel/py-pydantic2/distinfo +++ b/devel/py-pydantic2/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1693056827 -SHA256 (pydantic-2.3.0.tar.gz) = 1607cc106602284cd4a00882986570472f193fde9cb1259bceeaedb26aa79a6d -SIZE (pydantic-2.3.0.tar.gz) = 623866 +TIMESTAMP = 1696001368 +SHA256 (pydantic-2.4.2.tar.gz) = 94f336138093a5d7f426aac732dcfe7ab4eb4da243c88f891d65deb4a2556ee7 +SIZE (pydantic-2.4.2.tar.gz) = 654020 diff --git a/devel/py-pydantic2/files/patch-pydantic-core b/devel/py-pydantic2/files/patch-pydantic-core deleted file mode 100644 index 01df62ef1615..000000000000 --- a/devel/py-pydantic2/files/patch-pydantic-core +++ /dev/null @@ -1,270 +0,0 @@ -Obtained from: https://github.com/pydantic/pydantic/commit/2575e71894a32dc615f9fa7a94ff37bb604a48a8 - https://github.com/pydantic/pydantic/commit/70d3c3e00f960191b4cc488ddb252f723fce8020 - https://github.com/pydantic/pydantic/commit/e5323ffaba449940028a9e580da81bdd3d8bd0c9 - ---- pydantic/_internal/_config.py.orig 2020-02-02 00:00:00 UTC -+++ pydantic/_internal/_config.py -@@ -65,6 +65,7 @@ class ConfigWrapper: - hide_input_in_errors: bool - defer_build: bool - schema_generator: type[GenerateSchema] | None -+ coerce_numbers_to_str: bool - - def __init__(self, config: ConfigDict | dict[str, Any] | type[Any] | None, *, check: bool = True): - if check: -@@ -160,6 +161,7 @@ class ConfigWrapper: - str_max_length=self.config_dict.get('str_max_length'), - str_min_length=self.config_dict.get('str_min_length'), - hide_input_in_errors=self.config_dict.get('hide_input_in_errors'), -+ coerce_numbers_to_str=self.config_dict.get('coerce_numbers_to_str'), - ) - ) - return core_config -@@ -200,6 +202,7 @@ config_defaults = ConfigDict( - json_encoders=None, - defer_build=False, - schema_generator=None, -+ coerce_numbers_to_str=False, - ) - - ---- pydantic/_internal/_core_utils.py.orig 2020-02-02 00:00:00 UTC -+++ pydantic/_internal/_core_utils.py -@@ -262,9 +262,9 @@ class _WalkCoreSchema: - ) -> core_schema.CoreSchema: - schema = cast(core_schema.TuplePositionalSchema, schema) - schema['items_schema'] = [self.walk(v, f) for v in schema['items_schema']] -- extra_schema = schema.get('extra_schema') -- if extra_schema is not None: -- schema['extra_schema'] = self.walk(extra_schema, f) -+ extras_schema = schema.get('extras_schema') -+ if extras_schema is not None: -+ schema['extras_schema'] = self.walk(extras_schema, f) - return schema - - def handle_dict_schema(self, schema: core_schema.DictSchema, f: Walk) -> core_schema.CoreSchema: -@@ -314,9 +314,9 @@ class _WalkCoreSchema: - return schema - - def handle_model_fields_schema(self, schema: core_schema.ModelFieldsSchema, f: Walk) -> core_schema.CoreSchema: -- extra_validator = schema.get('extra_validator') -- if extra_validator is not None: -- schema['extra_validator'] = self.walk(extra_validator, f) -+ extras_schema = schema.get('extras_schema') -+ if extras_schema is not None: -+ schema['extras_schema'] = self.walk(extras_schema, f) - replaced_fields: dict[str, core_schema.ModelField] = {} - replaced_computed_fields: list[core_schema.ComputedField] = [] - for computed_field in schema.get('computed_fields', ()): -@@ -333,9 +333,9 @@ class _WalkCoreSchema: - return schema - - def handle_typed_dict_schema(self, schema: core_schema.TypedDictSchema, f: Walk) -> core_schema.CoreSchema: -- extra_validator = schema.get('extra_validator') -- if extra_validator is not None: -- schema['extra_validator'] = self.walk(extra_validator, f) -+ extras_schema = schema.get('extras_schema') -+ if extras_schema is not None: -+ schema['extras_schema'] = self.walk(extras_schema, f) - replaced_computed_fields: list[core_schema.ComputedField] = [] - for computed_field in schema.get('computed_fields', ()): - replaced_field = computed_field.copy() ---- pydantic/_internal/_generate_schema.py.orig 2020-02-02 00:00:00 UTC -+++ pydantic/_internal/_generate_schema.py -@@ -480,7 +480,7 @@ class GenerateSchema: - - model_validators = decorators.model_validators.values() - -- extra_validator = None -+ extras_schema = None - if core_config.get('extra_fields_behavior') == 'allow': - for tp in (cls, *cls.__mro__): - extras_annotation = cls.__annotations__.get('__pydantic_extra__', None) -@@ -495,7 +495,7 @@ class GenerateSchema: - required=True, - )[1] - if extra_items_type is not Any: -- extra_validator = self.generate_schema(extra_items_type) -+ extras_schema = self.generate_schema(extra_items_type) - break - - with self._config_wrapper_stack.push(config_wrapper): -@@ -521,7 +521,7 @@ class GenerateSchema: - self._computed_field_schema(d, decorators.field_serializers) - for d in computed_fields.values() - ], -- extra_validator=extra_validator, -+ extras_schema=extras_schema, - model_name=cls.__name__, - ) - inner_schema = apply_validators(fields_schema, decorators.root_validators.values(), None) ---- pydantic/config.py.orig 2020-02-02 00:00:00 UTC -+++ pydantic/config.py -@@ -207,5 +207,11 @@ class ConfigDict(TypedDict, total=False): - Defaults to `None`. - """ - -+ coerce_numbers_to_str: bool -+ """ -+ If `True`, enables automatic coercion of any `Number` type to `str` in "lax" (non-strict) mode. -+ Defaults to `False`. -+ """ -+ - - __getattr__ = getattr_migration(__name__) ---- pydantic/json_schema.py.orig 2020-02-02 00:00:00 UTC -+++ pydantic/json_schema.py -@@ -795,8 +795,8 @@ class GenerateJsonSchema: - prefixItems = [self.generate_inner(item) for item in schema['items_schema']] - if prefixItems: - json_schema['prefixItems'] = prefixItems -- if 'extra_schema' in schema: -- json_schema['items'] = self.generate_inner(schema['extra_schema']) -+ if 'extras_schema' in schema: -+ json_schema['items'] = self.generate_inner(schema['extras_schema']) - else: - json_schema['maxItems'] = len(schema['items_schema']) - self.update_with_validations(json_schema, schema, self.ValidationsMapping.array) -@@ -1383,10 +1383,10 @@ class GenerateJsonSchema: - if self.mode == 'serialization': - named_required_fields.extend(self._name_required_computed_fields(schema.get('computed_fields', []))) - json_schema = self._named_required_fields_schema(named_required_fields) -- extra_validator = schema.get('extra_validator', None) -- if extra_validator is not None: -+ extras_schema = schema.get('extras_schema', None) -+ if extras_schema is not None: - schema_to_update = self.resolve_schema_to_update(json_schema) -- schema_to_update['additionalProperties'] = self.generate_inner(extra_validator) -+ schema_to_update['additionalProperties'] = self.generate_inner(extras_schema) - return json_schema - - def field_is_present(self, field: CoreSchemaField) -> bool: ---- pydantic/v1/main.py.orig 2020-02-02 00:00:00 UTC -+++ pydantic/v1/main.py -@@ -161,9 +161,9 @@ class ModelMetaclass(ABCMeta): - - for f in fields.values(): - f.set_config(config) -- extra_validators = vg.get_validators(f.name) -- if extra_validators: -- f.class_validators.update(extra_validators) -+ extras_schemas = vg.get_validators(f.name) -+ if extras_schemas: -+ f.class_validators.update(extras_schemas) - # re-run prepare to add extra validators - f.populate_validators() - ---- pyproject.toml.orig 2020-02-02 00:00:00 UTC -+++ pyproject.toml -@@ -61,7 +61,7 @@ requires-python = '>=3.7' - dependencies = [ - 'typing-extensions>=4.6.1', - 'annotated-types>=0.4.0', -- "pydantic-core==2.6.3", -+ "pydantic-core==2.9.0", - ] - dynamic = ['version', 'readme'] - ---- tests/test_json_schema.py.orig 2020-02-02 00:00:00 UTC -+++ tests/test_json_schema.py -@@ -2475,7 +2475,7 @@ def test_tuple_with_extra_schema(): - @classmethod - def __get_pydantic_core_schema__(cls, _source_type: Any, handler: GetCoreSchemaHandler) -> CoreSchema: - return core_schema.tuple_positional_schema( -- [core_schema.int_schema(), core_schema.str_schema()], extra_schema=core_schema.int_schema() -+ [core_schema.int_schema(), core_schema.str_schema()], extras_schema=core_schema.int_schema() - ) - - class Model(BaseModel): ---- tests/test_types.py.orig 2020-02-02 00:00:00 UTC -+++ tests/test_types.py -@@ -12,6 +12,7 @@ from dataclasses import dataclass - from datetime import date, datetime, time, timedelta, timezone - from decimal import Decimal - from enum import Enum, IntEnum -+from numbers import Number - from pathlib import Path - from typing import ( - Any, -@@ -5690,3 +5691,46 @@ def test_decimal_float_precision() -> None: - assert ta.validate_python('1.1') == Decimal('1.1') - assert ta.validate_json('1') == Decimal('1') - assert ta.validate_python(1) == Decimal('1') -+ -+ -+def test_coerce_numbers_to_str_disabled_in_strict_mode() -> None: -+ class Model(BaseModel): -+ model_config = ConfigDict(strict=True, coerce_numbers_to_str=True) -+ value: str -+ -+ with pytest.raises(ValidationError, match='value'): -+ Model.model_validate({'value': 42}) -+ with pytest.raises(ValidationError, match='value'): -+ Model.model_validate_json('{"value": 42}') -+ -+ -+@pytest.mark.parametrize( -+ ('number', 'expected_str'), -+ [ -+ pytest.param(42, '42', id='42'), -+ pytest.param(42.0, '42.0', id='42.0'), -+ pytest.param(Decimal('42.0'), '42.0', id="Decimal('42.0')"), -+ ], -+) -+def test_coerce_numbers_to_str(number: Number, expected_str: str) -> None: -+ class Model(BaseModel): -+ model_config = ConfigDict(coerce_numbers_to_str=True) -+ value: str -+ -+ assert Model.model_validate({'value': number}).model_dump() == {'value': expected_str} -+ -+ -+@pytest.mark.parametrize( -+ ('number', 'expected_str'), -+ [ -+ pytest.param('42', '42', id='42'), -+ pytest.param('42.0', '42', id='42.0'), -+ pytest.param('42.13', '42.13', id='42.13'), -+ ], -+) -+def test_coerce_numbers_to_str_from_json(number: str, expected_str: str) -> None: -+ class Model(BaseModel): -+ model_config = ConfigDict(coerce_numbers_to_str=True) -+ value: str -+ -+ assert Model.model_validate_json(f'{{"value": {number}}}').model_dump() == {'value': expected_str} ---- tests/test_utils.py.orig 2020-02-02 00:00:00 UTC -+++ tests/test_utils.py -@@ -547,8 +547,8 @@ def test_camel2snake(value: str, result: str) -> None: - ( - pytest.param({}, {}, id='Positional tuple without extra_schema'), - pytest.param( -- {'extra_schema': core_schema.float_schema()}, -- {'extra_schema': {'type': 'str'}}, -+ {'extras_schema': core_schema.float_schema()}, -+ {'extras_schema': {'type': 'str'}}, - id='Positional tuple with extra_schema', - ), - ), -@@ -575,8 +575,8 @@ def test_handle_tuple_positional_schema(params, expect - ( - pytest.param({}, {}, id='Model fields without extra_validator'), - pytest.param( -- {'extra_validator': core_schema.float_schema()}, -- {'extra_validator': {'type': 'str'}}, -+ {'extras_schema': core_schema.float_schema()}, -+ {'extras_schema': {'type': 'str'}}, - id='Model fields with extra_validator', - ), - ), -@@ -608,8 +608,8 @@ def test_handle_model_fields_schema(params, expected_e - ( - pytest.param({}, {}, id='Typeddict without extra_validator'), - pytest.param( -- {'extra_validator': core_schema.float_schema()}, -- {'extra_validator': {'type': 'str'}}, -+ {'extras_schema': core_schema.float_schema()}, -+ {'extras_schema': {'type': 'str'}}, - id='Typeddict with extra_validator', - ), - ),