This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-releases-client.git


The following commit(s) were added to refs/heads/main by this push:
     new 1ec9860  Use an improved Release construction technique
1ec9860 is described below

commit 1ec9860064d16c3d97dcd363de11a82e9427ba38
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue Jul 15 18:34:12 2025 +0100

    Use an improved Release construction technique
---
 pyproject.toml              |  4 ++--
 src/atrclient/models/api.py |  5 -----
 src/atrclient/models/sql.py | 15 ++++++---------
 uv.lock                     |  4 ++--
 4 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index d545723..58ab4fb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ build-backend = "hatchling.build"
 
 [project]
 name            = "apache-trusted-releases"
-version         = "0.20250715.1629"
+version         = "0.20250715.1733"
 description     = "ATR CLI and Python API"
 readme          = "README.md"
 requires-python = ">=3.13"
@@ -72,4 +72,4 @@ select = [
 ]
 
 [tool.uv]
-exclude-newer = "2025-07-15T16:29:00Z"
+exclude-newer = "2025-07-15T17:33:00Z"
diff --git a/src/atrclient/models/api.py b/src/atrclient/models/api.py
index 4311afc..70c3036 100644
--- a/src/atrclient/models/api.py
+++ b/src/atrclient/models/api.py
@@ -229,11 +229,6 @@ class ReleasesProjectResults(schema.Strict):
     data: Sequence[sql.Release]
     count: int
 
-    @pydantic.field_validator("data", mode="before")
-    @classmethod
-    def coerce_release(cls, v: Sequence[dict[str, Any]]) -> 
Sequence[sql.Release]:
-        return [sql.Release.model_validate(item) if isinstance(item, dict) 
else item for item in v]
-
 
 class ReleasesVersionResults(schema.Strict):
     endpoint: Literal["/releases/version"] = schema.Field(alias="endpoint")
diff --git a/src/atrclient/models/sql.py b/src/atrclient/models/sql.py
index d2c91b2..802e349 100644
--- a/src/atrclient/models/sql.py
+++ b/src/atrclient/models/sql.py
@@ -597,15 +597,12 @@ class Release(sqlmodel.SQLModel, table=True):
             raise ValueError("Latest revision number is not a str or None")
         return number
 
-    @pydantic.field_validator("created", mode="before")
-    @classmethod
-    def parse_created(cls, v: str | datetime.datetime):
-        return datetime.datetime.fromisoformat(v.rstrip("Z")) if isinstance(v, 
str) else v
-
-    @pydantic.field_validator("phase", mode="before")
-    @classmethod
-    def parse_phase(cls, v: str | ReleasePhase):
-        return ReleasePhase(v) if isinstance(v, str) else v
+    def model_post_init(self, _context):
+        if isinstance(self.created, str):
+            self.created = 
datetime.datetime.fromisoformat(self.created.rstrip("Z"))
+
+        if isinstance(self.phase, str):
+            self.phase = ReleasePhase(self.phase)
 
     # NOTE: This does not work
     # But it we set it with Release.latest_revision_number_query = ..., it 
might work
diff --git a/uv.lock b/uv.lock
index 33b286c..bc066f3 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2,7 +2,7 @@ version = 1
 requires-python = ">=3.13"
 
 [options]
-exclude-newer = "2025-07-15T16:29:00Z"
+exclude-newer = "2025-07-15T17:33:00Z"
 
 [[package]]
 name = "aiohappyeyeballs"
@@ -83,7 +83,7 @@ wheels = [
 
 [[package]]
 name = "apache-trusted-releases"
-version = "0.20250715.1629"
+version = "0.20250715.1733"
 source = { editable = "." }
 dependencies = [
     { name = "aiohttp" },


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to