Skip to content

Commit 5fdd0bb

Browse files
authored
Update to Pydantic V2 (#588)
* Pydantic V2 support * Support Python 3.8 * Mark as classmethod * Remove max int validation * Run poe format * Merge develop * Revert dataclasses import * Fix revert
1 parent 8b59234 commit 5fdd0bb

File tree

8 files changed

+345
-155
lines changed

8 files changed

+345
-155
lines changed

poetry.lock

+141-50
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pytest = "^6.2.5"
3939
pytest-asyncio = "^0.12.0"
4040
pytest-cov = "^2.9.0"
4141
pytest-mock = "^3.1.1"
42-
pydantic = ">=1.10.16,<2"
42+
pydantic = ">=2.0,<3"
4343
protobuf = "^4"
4444
cachelib = "^0.10.2"
4545
tomlkit = ">=0.7.0"

src/betterproto/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,9 @@ def _validate_field_groups(cls, values):
18521852
continue
18531853

18541854
set_fields = [
1855-
field.name for field in field_set if values[field.name] is not None
1855+
field.name
1856+
for field in field_set
1857+
if getattr(values, field.name, None) is not None
18561858
]
18571859

18581860
if not set_fields:

0 commit comments

Comments
 (0)