Skip to content

🤖 ci: test built wheels, ship type stubs, add ruff - #61

Merged
dancergraham merged 8 commits into
ci/zizmor-concurrency-cachefrom
ci/test-built-wheels
Nov 22, 2026
Merged

dancergraham merged 8 commits into
ci/zizmor-concurrency-cachefrom
ci/test-built-wheels

Conversation

@dancergraham

@dancergraham dancergraham commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #60 (base will retarget to main once #60 merges).

  1. Test the built wheels instead of recompiling. The pytest matrix rebuilt the extension from source for 5 interpreters, and coverage rebuilt it again. The pytest matrix now downloads the wheels-linux-x86_64 artifact and tests it on 3.11–3.15, 3.14t and 3.15t (already built, never tested). Free-threaded jobs also assert that importing e57 leaves the GIL disabled (pyo3 0.30 already declares gil_used = false by default; checked locally on 3.14t). The redundant x86_64 pytest step in the linux job is removed. release now also needs pytest (and stubtest, ruff).
    • Dropped the coverage job: --cov=e57 measures Python code and the package is entirely Rust. Removed the now unused pytest-cov from the test extra. Rust coverage would need cargo-llvm-cov; not done here.
  2. Type stubs. New e57.pyi; with a stub present maturin ships an e57/ package (__init__.py re-exporting the compiled e57.e57) plus py.typed. import e57 and its public names are unchanged. New stubtest job runs mypy.stubtest against the built wheel (stubtest-allowlist.txt only allowlists the private e57.e57 submodule).
  3. ruff. ruff check + ruff format --check (ruff pinned to 0.17.3); fixed the one import-order and one formatting issue.

New actions: astral-sh/setup-uv v10.3.3, pinned by SHA, enable-cache: false (avoids cache-poisoning in a release workflow). Picked over v10.4.0 and ruff 0.17.6, which are under two weeks old.

Verified locally:

  • 3.14 wheel: mypy.stubtest e57 --allowlist stubtest-allowlist.txt → no issues; pytest 18 passed; mypy infers read_points(...).points as ndarray[..., dtype[float64]].
  • 3.14t wheel: sys._is_gil_enabled() is False after import e57; pytest 18 passed.
  • ruff@0.17.3 check / format --check clean; zizmor no findings; actionlint clean.

PyPy is not tested: the manylinux image builds pypy311_pp73 wheels, but current PyPy 3.11 has the pp80 ABI, so it can't install them and falls back to the sdist, which needs Rust. That's a packaging gap to fix separately.

Left as is: E57.__module__ is builtins (no module= on the #[pyclass]), which affects its repr; that's a Rust change, so it's not in this PR. Trusted publishing still needs PyPI-side setup.

🤖 Generated with Claude Code

dancergraham and others added 8 commits November 22, 2026 13:08
The pytest matrix rebuilt the extension from source for each of five
interpreters, plus once more for a coverage job that only measured
Python code (there is none). Download the manylinux x86_64 wheels
instead, cover 3.14t, 3.15t and PyPy 3.11 too, assert the free-threaded
builds keep the GIL off, and make release depend on the tests.
Drop the coverage job and the now unused pytest-cov extra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add e57.pyi; maturin packages it with py.typed. CI checks it against
the compiled module with mypy.stubtest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The manylinux image builds pypy311_pp73 wheels, which the current PyPy
3.11 (pp80 ABI) can't install, so the job could never pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Shape-typed arrays: points/color (n, 3), intensity (n, 1).
- Document that color/intensity are empty if any scan lacks them, and
  that color falls back to greyscale from intensity.
- Document raised exceptions.
- E57.__init__ -> NoReturn, since E57() raises TypeError at runtime.
- Mirror the docs on the Rust items so help() matches the stub.
- Test array dtypes/shapes and that E57() raises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep docstrings in e57.pyi (PYI021 ignored): for a compiled module
they are what IDEs show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dancergraham

Copy link
Copy Markdown
Owner Author

Applied review feedback:

  • Stub docs: color and intensity are empty if any scan lacks them, and color falls back to greyscale from intensity. Added Raises: sections. The same docs are now on the Rust items, so help() matches the stub (comment in lib.rs to keep them in sync).
  • E57.__init__ -> NoReturn, so type checkers reject E57(). Added a runtime test that it raises TypeError.
  • Shape-typed arrays: (n, 3) for points/color, (n, 1) for intensity. Checked locally with mypy assert_type.
  • dtype/shape test across both sample files.
  • [tool.ruff.lint] extend-select = ["I", "PYI", "NPY"], with PYI021 ignored for *.pyi (docstrings are what IDEs show for a compiled module).
  • Pinned mypy==2.4.1 in stubtest; added a README line.

Not applied:

  • PyPy: the pp73 wheels still install on PyPy 7.3.x, so the classifier is accurate. The gap is that current PyPy (pp80) gets no wheel; to handle separately.
  • Splitting into 3 PRs: each change is its own commit and can be reverted on its own.
  • Version bump: better done in the release commit.
  • Generating the stub (pyo3-stub-gen / introspection): not worth it for three symbols.

Found while documenting errors, not fixed here: read_points calls .expect() on per-point reads, so a corrupt point raises pyo3_runtime.PanicException (a BaseException) instead of RuntimeError.

Verified locally (3.14 wheel): stubtest clean, pytest 21 passed, ruff, cargo fmt and clippy clean.

🤖 Generated with Claude Code

@dancergraham
dancergraham marked this pull request as ready for review November 22, 2026 12:41
@dancergraham
dancergraham merged commit 94ebf21 into ci/zizmor-concurrency-cache Nov 22, 2026
22 checks passed
dancergraham added a commit that referenced this pull request Nov 22, 2026
🤖 ci: test built wheels, ship type stubs, add ruff (re-land #61)
@dancergraham
dancergraham deleted the ci/test-built-wheels branch November 22, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant