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 eb11981  Use the improved API types for uploading a KEYS file
eb11981 is described below

commit eb119816efadef81a72887cbf12a803f617d6815
Author: Sean B. Palmer <[email protected]>
AuthorDate: Sun Jul 20 09:49:04 2025 +0100

    Use the improved API types for uploading a KEYS file
---
 pyproject.toml              |  4 ++--
 src/atrclient/client.py     | 10 +++++-----
 src/atrclient/models/api.py | 37 ++++++++++++++++++++++++++++---------
 uv.lock                     | 10 +++++-----
 4 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 02ee32e..6099c84 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ build-backend = "hatchling.build"
 
 [project]
 name            = "apache-trusted-releases"
-version         = "0.20250716.1818"
+version         = "0.20250720.0846"
 description     = "ATR CLI and Python API"
 readme          = "README.md"
 requires-python = ">=3.13"
@@ -72,4 +72,4 @@ select = [
 ]
 
 [tool.uv]
-exclude-newer = "2025-07-16T18:18:00Z"
+exclude-newer = "2025-07-20T08:46:00Z"
diff --git a/src/atrclient/client.py b/src/atrclient/client.py
index 8979763..18f7233 100755
--- a/src/atrclient/client.py
+++ b/src/atrclient/client.py
@@ -652,12 +652,12 @@ def app_keys_get(fingerprint: str, /) -> None:
 
 
 @APP_KEYS.command(name="upload", help="Upload a KEYS file.")
-def app_keys_upload(path: str, selected_committees: str, /) -> None:
-    selected_committee_names = []
-    if selected_committees:
-        selected_committee_names[:] = selected_committees.split(",")
+def app_keys_upload(path: str, selected_committee_name: str, /) -> None:
+    # selected_committee_names = []
+    # if selected_committees:
+    #     selected_committee_names[:] = selected_committees.split(",")
     key = pathlib.Path(path).read_text(encoding="utf-8")
-    keys_upload_args = models.api.KeysUploadArgs(filetext=key, 
committees=selected_committee_names)
+    keys_upload_args = models.api.KeysUploadArgs(filetext=key, 
committee=selected_committee_name)
     keys_upload = api_keys_upload(keys_upload_args)
     for result in keys_upload.results:
         print(result.model_dump_json(indent=None))
diff --git a/src/atrclient/models/api.py b/src/atrclient/models/api.py
index 14cc85c..377f0ab 100644
--- a/src/atrclient/models/api.py
+++ b/src/atrclient/models/api.py
@@ -146,23 +146,42 @@ class KeysGetResults(schema.Strict):
 
 class KeysUploadArgs(schema.Strict):
     filetext: str
-    committees: list[str]
+    committee: str
 
 
-class KeysUploadSubset(schema.Lax):
-    status: Literal["success", "error"]
-    key_id: str
-    fingerprint: str
-    user_id: str
-    email: str
+class KeysUploadException(schema.Strict):
+    status: Literal["error"] = schema.Field(alias="status")
+    key: sql.PublicSigningKey | None
+    error: str
+    error_type: str
+
+
+class KeysUploadResult(schema.Strict):
+    status: Literal["success"] = schema.Field(alias="status")
+    key: sql.PublicSigningKey
+
+
+KeysUploadOutcome = Annotated[
+    KeysUploadResult | KeysUploadException,
+    schema.Field(discriminator="status"),
+]
+
+KeysUploadOutcomeAdapter = pydantic.TypeAdapter(KeysUploadOutcome)
+
+
+# def validate_keys_upload_outcome(value: Any) -> KeysUploadOutcome:
+#     obj = KeysUploadOutcomeAdapter.validate_python(value)
+#     if not isinstance(obj, KeysUploadOutcome):
+#         raise ResultsTypeError(f"Invalid API response: {value}")
+#     return obj
 
 
 class KeysUploadResults(schema.Strict):
     endpoint: Literal["/keys/upload"] = schema.Field(alias="endpoint")
-    results: Sequence[KeysUploadSubset]
+    results: Sequence[KeysUploadResult | KeysUploadException]
     success_count: int
     error_count: int
-    submitted_committees: list[str]
+    submitted_committee: str
 
 
 class KeysUserResults(schema.Strict):
diff --git a/uv.lock b/uv.lock
index 2501849..8922ef4 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2,7 +2,7 @@ version = 1
 requires-python = ">=3.13"
 
 [options]
-exclude-newer = "2025-07-16T18:18:00Z"
+exclude-newer = "2025-07-20T08:46:00Z"
 
 [[package]]
 name = "aiohappyeyeballs"
@@ -83,7 +83,7 @@ wheels = [
 
 [[package]]
 name = "apache-trusted-releases"
-version = "0.20250716.1818"
+version = "0.20250720.846"
 source = { editable = "." }
 dependencies = [
     { name = "aiohttp" },
@@ -172,11 +172,11 @@ wheels = [
 
 [[package]]
 name = "distlib"
-version = "0.3.9"
+version = "0.4.0"
 source = { registry = "https://pypi.org/simple"; }
-sdist = { url = 
"https://files.pythonhosted.org/packages/0d/dd/1bec4c5ddb504ca60fc29472f3d27e8d4da1257a854e1d96742f15c1d02d/distlib-0.3.9.tar.gz";,
 hash = 
"sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403", size 
= 613923 }
+sdist = { url = 
"https://files.pythonhosted.org/packages/96/8e/709914eb2b5749865801041647dc7f4e6d00b549cfe88b65ca192995f07c/distlib-0.4.0.tar.gz";,
 hash = 
"sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d", size 
= 614605 }
 wheels = [
-    { url = 
"https://files.pythonhosted.org/packages/91/a1/cf2472db20f7ce4a6be1253a81cfdf85ad9c7885ffbed7047fb72c24cf87/distlib-0.3.9-py2.py3-none-any.whl";,
 hash = 
"sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87", size 
= 468973 },
+    { url = 
"https://files.pythonhosted.org/packages/33/6b/e0547afaf41bf2c42e52430072fa5658766e3d65bd4b03a563d1b6336f57/distlib-0.4.0-py2.py3-none-any.whl";,
 hash = 
"sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16", size 
= 469047 },
 ]
 
 [[package]]


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

Reply via email to