From 88f0acdeb1bd8b8a5888cc6207a3f0c8366591e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?= Date: Fri, 13 Sep 2024 18:37:21 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Upgrade=20pyngo=20to=20use=20Pydant?= =?UTF-8?q?ic=20to=20v2.9=20(#173)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- pyngo/__init__.py | 2 +- pyproject.toml | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 54e754e..88baa16 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ class Model(BaseModel): data = {"foo": "Cat"} try: - Model.parse_obj(data) + Model.model_validate(data) except ValidationError as e: print(drf_error_details(e)) ``` diff --git a/pyngo/__init__.py b/pyngo/__init__.py index 4754a08..fffe047 100644 --- a/pyngo/__init__.py +++ b/pyngo/__init__.py @@ -1,6 +1,6 @@ """Pydantic Package for Adding Models into a Django or Django Rest Framework Project""" -__version__ = "2.2.0" +__version__ = "2.2.1" from .errors import drf_error_details from .openapi import ParameterDict, openapi_params diff --git a/pyproject.toml b/pyproject.toml index 173e141..3f6ce95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,8 @@ path = "pyngo/__init__.py" [tool.ruff] line-length = 120 -mccabe = { max-complexity = 14 } + +[tool.ruff.lint] select = [ "E", # pycodestyle errors "W", # pycodestyle warnings @@ -81,14 +82,15 @@ ignore = [ "B008", # do not perform function calls in argument defaults "C901", # too complex ] +mccabe = { max-complexity = 14 } -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-third-party = ["pydantic", "typing_extensions"] -[tool.ruff.pyupgrade] +[tool.ruff.lint.pyupgrade] keep-runtime-typing = true [tool.coverage.run]