From nobody Fri Sep 22 23:35:16 2023 X-Original-To: dev-commits-ports-all@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 4RspXh5hkNz4tchF; Fri, 22 Sep 2023 23:35:16 +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 4RspXh4lBpz4LP3; Fri, 22 Sep 2023 23:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695425716; 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=dAaQhg3+VQ5XizTbDalLJNRhgKC/+TPUnJjoKhl/9Qc=; b=WAp9flbtEH1sDvr08sXjfw4TLphm9mQJP95bbqGTdyagGXE5/Oj8hx0JGB2oYztnLNyCrT FuyD1M1urY5gj19oKEeVg8KcPNK443P0kBmnsGofbgGBfutDOeRdut2DuSlzK9nbkRKbIR VCQz/oUtkuJvZHkqJ0H/iHmJQos+P21zLWL5r4tRfzaG33n/BW6ZrT+OD8inTfWdjTk5WP xYBfCt4SamqcKmzkxiQJ1KbMA1Jn6BIGKWe1JeGEtrBQRorOSa0fm2PVq1Assy+z0ikkwT ti3j2Y2iRkKpu6hF95A81lcI0HDMJaOIS350KaIfseHuwUHjeXNSmPm3TrfJPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695425716; a=rsa-sha256; cv=none; b=wuB8fIQxXZx6RkP6EXFu6rKpQP4oggV0I58qmi3kkDXV4+GdODI1PrJhNg2+OAT3mYo7o8 Ah4FLGx7xXLqm8dt3Bm5mfd3dOJFBp5NQc3SMrknRoF3Lh+V/A078mSxZmrAd3bqE6Vdih ifbQyloGBuKJ7Y+3LcL758mkpGQK6Ju0g3H7Ar/lG7FSrMTszpbdEUrkS29GsVOTHHuWkX fMYifmSXplhz9ou34Zin6dQGR2g2yomPJPdEXvQhwu3EIuZaXffiEklTC4YXuKsn1RkH8C znFlqJ9J9EdCsrgzBv0oChfgf/yBdd7iYYMIqOsumFIG+Za/iRCDar2Xnx39Og== 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=1695425716; 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=dAaQhg3+VQ5XizTbDalLJNRhgKC/+TPUnJjoKhl/9Qc=; b=eHLxZhMkfgprtDAQT+6j7dlZ9S1ENFtZoATFueK6a4XLO7j38svy97a8Vx0wYA9WEscrjG 4QTDbuMoac2d3N53JgkGoRr86Zzmx1deyBzFLjo0NlHcUj2xZfOPCCt5s1o4Q+ZhFuCs8H tE/cmft+o3X/Nznq6/1EBRPL3LDPGwKwQw/Hb6gKI4uyTkIYG/Cny8GD7Y6RI8hdJ2HKdu qqE6b22uQGoPHY68ygy1AFxGRDkym9jwykd74Fs4ZM7mUL9YEGkXzeHhyrZpk7hI27neLm ASDqvQUbYwFrqVC7Lv9HlhsEpaeJ9ctSYQCKK9e45QIlE0BSXSUpA7rCF4GZgw== 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 4RspXh3mP2zhHZ; Fri, 22 Sep 2023 23:35:16 +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 38MNZGFc016983; Fri, 22 Sep 2023 23:35:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38MNZGFf016980; Fri, 22 Sep 2023 23:35:16 GMT (envelope-from git) Date: Fri, 22 Sep 2023 23:35:16 GMT Message-Id: <202309222335.38MNZGFf016980@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: 8b5c386c1748 - main - devel/py-pydantic2: Allow build with py-pydantic-core 2.9.0 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@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: 8b5c386c1748bd889a1ac799461ebfc6d8544b27 Auto-Submitted: auto-generated The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=8b5c386c1748bd889a1ac799461ebfc6d8544b27 commit 8b5c386c1748bd889a1ac799461ebfc6d8544b27 Author: Po-Chuan Hsieh AuthorDate: 2023-09-22 23:23:59 +0000 Commit: Po-Chuan Hsieh CommitDate: 2023-09-22 23:23:59 +0000 devel/py-pydantic2: Allow build with py-pydantic-core 2.9.0 - Bump PORTREVISION for package change Obtained from: https://github.com/pydantic/pydantic/commit/e5323ffaba449940028a9e580da81bdd3d8bd0c9 --- devel/py-pydantic2/Makefile | 4 +- devel/py-pydantic2/files/patch-pydantic-core | 100 ++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/devel/py-pydantic2/Makefile b/devel/py-pydantic2/Makefile index 8f3a03d53447..11e7e61ead5a 100644 --- a/devel/py-pydantic2/Makefile +++ b/devel/py-pydantic2/Makefile @@ -1,6 +1,6 @@ PORTNAME= pydantic PORTVERSION= 2.3.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= devel python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -17,7 +17,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.8.0<2.8.0_99:devel/py-pydantic-core@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pydantic-core>=2.9.0<2.9.0_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/files/patch-pydantic-core b/devel/py-pydantic2/files/patch-pydantic-core index 6a6b96f25629..01df62ef1615 100644 --- a/devel/py-pydantic2/files/patch-pydantic-core +++ b/devel/py-pydantic2/files/patch-pydantic-core @@ -1,6 +1,33 @@ 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: @@ -71,6 +98,20 @@ Obtained from: https://github.com/pydantic/pydantic/commit/2575e71894a32dc615f9f 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: @@ -120,7 +161,7 @@ Obtained from: https://github.com/pydantic/pydantic/commit/2575e71894a32dc615f9f 'typing-extensions>=4.6.1', 'annotated-types>=0.4.0', - "pydantic-core==2.6.3", -+ "pydantic-core==2.8.0", ++ "pydantic-core==2.9.0", ] dynamic = ['version', 'readme'] @@ -135,6 +176,63 @@ Obtained from: https://github.com/pydantic/pydantic/commit/2575e71894a32dc615f9f ) 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: