Modernize packaging and CI: pyproject.toml, uv, ruff#3
Open
abizer wants to merge 3 commits into
Open
Conversation
`assert` statements are stripped when Python runs under `-O`, which would silently accept bad input and produce broken source maps downstream. Replace the three isinstance asserts with an explicit TypeError that names the offending argument, so the failure mode is the same regardless of optimization level and the error message actually points at the cause. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces the legacy setup.py with a PEP 621 pyproject.toml using the uv_build backend (flat layout preserved via module-root = ""), and switches both GitHub workflows to astral-sh/setup-uv: - build.yml installs via `uv sync --group dev` and runs lint/tests via `uv run`, across the 3.8–3.14 matrix. - upload_pypi.yml builds with `uv build` instead of `python -m build` before handing dist artifacts to pypa/gh-action-pypi-publish. Action pins are brought to current latest as part of the rewrite: actions/checkout@v6 (v6.0.2, 2026-01-09) and astral-sh/setup-uv@v8.0.0 (2026-03-29). setup-uv v8 dropped floating major/minor tags, so the pin is to the exact v8.0.0 tag rather than @v8. Metadata is carried over verbatim from setup.py (name, version, description, author, URL, MIT license) plus explicit Python-version classifiers matching the CI matrix. `requires-python` is tightened from the aspirational `>=3.4` in the old setup.py to `>=3.8`, which matches the versions that are actually tested. Dev tools (pytest, numpy, flake8) move to [dependency-groups].dev, and uv.lock is gitignored since this is a library — consumers pin via their own resolver, not ours. Verified: `uv build` produces a correct wheel (flat stackprinter/ layout, LICENSE embedded) and `uv run pytest` passes on Python 3.11, 3.12, and 3.14. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
With `uv sync` creating an in-tree .venv/, `flake8 .` walks into .venv/site-packages and flags undefined names in flake8's own sources and numpy internals, failing every CI job. Ruff auto-excludes .venv, .venv*, and other virtualenv-like directories by default, so `uv run ruff check` just works without adding explicit excludes. Lint selection is scoped to the same rules the old flake8 "fail build" pass used — E9 (syntax errors), F63 (invalid comparisons/assertions), F7 (break/return/continue outside block), F82 (undefined names) — so this is a drop-in tool swap, not an expanded lint gate. Verified locally: `uv run ruff check` passes with zero violations on the existing codebase. The old flake8 also ran a second `--exit-zero` pass for complexity warnings that never gated the build and just produced stderr noise. Dropped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 14, 2026
abizer
added a commit
that referenced
this pull request
Apr 14, 2026
Squash of py314-modernize-tooling onto the 0.2.13 release branch for internal consumption ahead of the corresponding upstream PR (#3) merging. - Replaces legacy setup.py with a PEP 621 pyproject.toml using the uv_build backend (flat layout preserved via module-root = ""). - Switches both GitHub workflows from actions/setup-python + pip to astral-sh/setup-uv + uv sync / uv build, and from flake8 to ruff for linting. Lint selection scoped to the old flake8 "fail build" rules (E9, F63, F7, F82) so this is a drop-in tool swap. - Bumps actions/checkout to v6 and pins astral-sh/setup-uv to v8.0.0 (v8+ dropped floating major tags, so exact pin required). - Tightens source_inspection.annotate input validation from assert to TypeError so the check survives python -O. - Tightens requires-python from the aspirational >=3.4 in the old setup.py to >=3.8, matching the tested matrix. - Dev tools (pytest, numpy, ruff) move to [dependency-groups].dev; uv.lock is gitignored since this is a library. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes packaging and CI tooling after #2 lands the actual fix. Stacked on `py314-lineno-fix`; rebase onto master once that merges.
Commits
Test plan
Notes
setup-uv v8 stopped publishing floating major/minor tags starting with 8.0.0 — the only valid refs are exact version tags or commit SHAs. The workflow pins `@v8.0.0` directly; dependabot will bump on each patch release.
🤖 Generated with Claude Code