Copilot commented on code in PR #3379:
URL: https://github.com/apache/iceberg-rust/pull/3379#discussion_r4229949351
##########
.github/workflows/ci.yml:
##########
@@ -61,6 +61,12 @@ jobs:
with:
tool: [email protected],[email protected],[email protected]
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 #
v7.0.0
+ with:
+ # dev/release/licenses.py needs 3.11+ for tomllib. Pinned rather
than relying
+ # on the runner's system interpreter.
Review Comment:
The workflow comment claims `dev/release/licenses.py` requires Python 3.11+
for `tomllib`, but the added script (in this PR) does not import or use
`tomllib`. This is misleading for maintainers. Either remove/adjust the comment
to reflect the current requirement (e.g., just pinning Python for consistency),
or add a clear TODO referencing the planned follow-up where `tomllib` will be
used.
##########
dev/release/licenses.py:
##########
@@ -0,0 +1,101 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+CLI for assisting maintenance of the project's license checks.
+"""
+
+import argparse
+import subprocess
+import sys
+from pathlib import Path
+
+REPO_ROOT = Path(__file__).resolve().parent.parent.parent
+
+
+class Failure(Exception):
+ """A user-facing error."""
+
+
+def step(message: str) -> None:
+ print(f"==> {message}", flush=True)
+
+
+def ok(message: str) -> None:
+ print(f"OK: {message}", flush=True)
+
+
+def require_cargo_deny() -> None:
+ """Assert cargo-deny is installed."""
+ try:
+ subprocess.run(
+ ["cargo", "deny", "--version"],
+ capture_output=True,
+ check=True,
+ )
+ except FileNotFoundError:
+ raise Failure("This script requires 'cargo', but it is not installed.")
+ except subprocess.CalledProcessError:
+ raise Failure(
+ "This script requires 'cargo-deny' for dependency license
checks.\n"
+ "Install it with: cargo install --locked cargo-deny"
Review Comment:
The install guidance is unpinned (`cargo install --locked cargo-deny`) while
the repo pins a specific cargo-deny version elsewhere (e.g., Makefile/CI). To
reduce version drift and inconsistent results across machines, consider
updating the message to recommend the repo’s pinned installation method (e.g.,
`make install-cargo-deny` or `cargo install --locked cargo-deny@<pinned>`).
##########
.github/workflows/ci.yml:
##########
@@ -80,7 +86,7 @@ jobs:
run: make check-license-notice
- name: Check dependency licenses
- run: dev/release/dependencies.sh check
+ run: python3 ./dev/release/licenses.py dependencies check
Review Comment:
Since the workflow explicitly installs Python via `actions/setup-python`,
invoking `python` (rather than `python3`) is typically the most portable way to
ensure the intended interpreter is used across runner OSes. Consider switching
this to `python ./dev/release/licenses.py ...` for robustness.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]