Skip to content

Commit 74dd415

Browse files
Copilotbschnurr
andauthored
Address SymPy automation review feedback
Co-authored-by: bschnurr <1946977+bschnurr@users.noreply.github.com>
1 parent 3b7893d commit 74dd415

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎.github/workflows/sympy-stub-retirement.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
run: |
3535
python - <<'PY'
3636
import json
37+
import os
3738
import pathlib
3839
report = json.loads(pathlib.Path("artifacts/sympy-typing.json").read_text())
3940
paths = [pathlib.Path("stubs/sympy-stubs") / path for path in report["candidates"]]
@@ -45,16 +46,15 @@ jobs:
4546
pathlib.Path("artifacts/removed-files.txt").write_text(
4647
"\n".join(str(path) for path in paths) + ("\n" if paths else "")
4748
)
48-
with pathlib.Path(__import__("os").environ["GITHUB_OUTPUT"]).open("a") as output:
49+
with pathlib.Path(os.environ["GITHUB_OUTPUT"]).open("a") as output:
4950
output.write(f"count={len(paths)}\n")
5051
pathlib.Path("artifacts/pull-request-body.md").write_text(
5152
"Automated monthly SymPy typing comparison.\n\n"
5253
f"SymPy version: `{report['sympy_version']}`.\n"
5354
"Removed files:\n"
5455
+ "".join(f"- `{path}`\n" for path in paths)
55-
+ f"\nWorkflow run: {__import__('os').environ['GITHUB_SERVER_URL']}/"
56-
f"{__import__('os').environ['GITHUB_REPOSITORY']}/actions/runs/"
57-
f"{__import__('os').environ['GITHUB_RUN_ID']}.\n\n"
56+
+ f"\nWorkflow run: {os.environ['GITHUB_SERVER_URL']}/"
57+
f"{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['GITHUB_RUN_ID']}.\n\n"
5858
"A file is removed only when every material declaration maps by name and kind "
5959
"to an upstream declaration with annotations on every non-`self`/`cls` parameter "
6060
"and its return value. Classes are structurally matched and their explicit members "

‎utils/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ or `simplify/simplify.pyi`, which were performance workarounds. To assess those,
4444
run the smoke command with and without the relevant stub and compare its reported
4545
elapsed time manually; timing is intentionally not an automatic deletion gate.
4646
Add another relative `.pyi` path to
47-
`PROTECTED_FILES` when a stub has value structural comparison cannot detect.
47+
`PROTECTED_FILES` when a stub provides value structural comparison cannot detect.

‎utils/compare_sympy_typing.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def markdown(report: dict[str, Any]) -> str:
164164
if file["candidate"] or file["protected"]:
165165
continue
166166
reasons = sorted({declaration["reason"] for declaration in file["declarations"] if declaration["status"] != TYPED})
167-
lines.append(f"- `{file['stub_file']}`: {' '.join(reasons)}")
167+
lines.append(f"- `{file['stub_file']}`: {' '.join(reasons) or 'No material declarations were found.'}")
168168
return "\n".join(lines) + "\n"
169169

170170

‎utils/run_sympy_analysis_smoke.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ def main() -> int:
1818
result = subprocess.run((sys.executable, "-m", "pyright", str(args.fixture)), check=False)
1919
elapsed = time.monotonic() - started
2020
print(f"Pyright smoke test completed in {elapsed:.1f}s (limit: {args.max_seconds:.1f}s).")
21+
if result.returncode:
22+
return result.returncode
2123
if elapsed > args.max_seconds:
2224
print("Pyright smoke test exceeded the generous gross-regression threshold.", file=sys.stderr)
2325
return 1
24-
return result.returncode
26+
return 0
2527

2628

2729
if __name__ == "__main__":

0 commit comments

Comments
 (0)