This is an automated email from the ASF dual-hosted git repository.
HyukjinKwon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-connect-rust.git
The following commit(s) were added to refs/heads/master by this push:
new 7e0b7019 [SPARK-61587][FOLLOWUP][CONNECT][BUILD] Keep the crate
arguments of the doc snippet check optional, as its unit tests call it
7e0b7019 is described below
commit 7e0b70197ca7fefb88ddf0f7e76a6dafdf54fad9
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Fri Nov 13 09:20:11 2026 +0900
[SPARK-61587][FOLLOWUP][CONNECT][BUILD] Keep the crate arguments of the doc
snippet check optional, as its unit tests call it
### What changes were proposed in this pull request?
A follow-up of #580 (SPARK-61587). It gave `check_block` of
`scripts/check_doc_snippets.py` two required arguments: the rlib of
`apache-spark-connect` and the directories of its dependencies. The unit tests
in `scripts/tests/test_check_doc_snippets.py`, which the lint job runs
(`python3 -m unittest discover -s scripts/tests`), call `check_block(code,
tmpdir, 1)` with self-contained snippets. So they fail on master with
`TypeError: check_block() missing 2 required positional arguments: [...]
Both arguments are optional again. Without an rlib, a snippet is compiled
without `--extern spark_connect`, as the tests need.
### Why are the changes needed?
To fix the "rustfmt + clippy" job of the lint workflow on master.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
- `python3 -m unittest discover -s scripts/tests`: 35 tests OK. Three
errored before this change.
- `scripts/check_doc_snippets.py`: 56 snippets, 0 failures.
- `ruff check` and `ruff format --check`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
This pull request and its description were written by Isaac.
Closes #587 from HyukjinKwon/SPARK-61587-followup2.
Authored-by: Hyukjin Kwon <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
scripts/check_doc_snippets.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/scripts/check_doc_snippets.py b/scripts/check_doc_snippets.py
index 793454ec..5c155705 100644
--- a/scripts/check_doc_snippets.py
+++ b/scripts/check_doc_snippets.py
@@ -48,6 +48,7 @@ import re
import subprocess
import sys
import tempfile
+from collections.abc import Sequence
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
@@ -77,8 +78,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {{
def check_block(
- code: str, tmpdir: Path, idx: int, rlib: Path, deps: list[Path]
+ code: str,
+ tmpdir: Path,
+ idx: int,
+ rlib: Path | None = None,
+ deps: Sequence[Path] = (),
) -> tuple[bool, str]:
+ """Compile the snippet ``code`` (the ``idx``-th) in ``tmpdir`` against
``rlib``, the rlib of
+ ``apache-spark-connect``, whose dependencies are in the directories
``deps``. Without
+ ``rlib``, the snippet is compiled without the crate."""
indented = "\n".join(" " + ln if ln.strip() else ln for ln in
code.splitlines())
src = tmpdir / f"snippet_{idx}.rs"
src.write_text(HARNESS.format(body=indented))
@@ -92,8 +100,7 @@ def check_block(
"bin",
"--emit=metadata",
*(arg for dep in deps for arg in ("-L", f"dependency={dep}")),
- "--extern",
- f"spark_connect={rlib}",
+ *(("--extern", f"spark_connect={rlib}") if rlib is not None else
()),
"-o",
str(out),
str(src),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]