Skip to content

Fix packaging: declare build-system, fix package discovery (v0.2.23) - #40

Merged
haeussma merged 11 commits into
mainfrom
fix/packaging-build
Jul 23, 2026
Merged

haeussma merged 11 commits into
mainfrom
fix/packaging-build

Conversation

@haeussma

Copy link
Copy Markdown
Member

Summary

uv add --editable, uv sync, and uv run pytest all failed because the project was never actually installed. Root cause: pyproject.toml had no [build-system] table, so uv treated it as a virtual project and skipped installing mtphandler — every test collected with ModuleNotFoundError: No module named 'mtphandler'. setuptools' flat-layout discovery separately errored on the two top-level dirs (mtphandler, specifications).

Changes

  • Add [build-system] (setuptools ≥61) so the project installs as a package
  • [tool.setuptools.packages.find] include = ["mtphandler*"] — fixes "Multiple top-level packages discovered" by excluding specifications/
  • license = "MIT" (SPDX string) — drops the setuptools license-table deprecation warning
  • Raw-string a regex in multiskan_spectrum_parser.py — drops a SyntaxWarning: invalid escape sequence '\d'
  • Bump version 0.2.220.2.23 (bugfix)

Verification

uv sync now installs mtphandler==0.2.23 editable; uv run pytest25 passed. uv build produces a clean wheel + sdist.

🤖 Generated with Claude Code

The project had no [build-system] table, so uv treated it as a virtual
project and never installed mtphandler — pytest and `uv add --editable`
both failed with ModuleNotFoundError. setuptools' flat-layout discovery
also errored on the two top-level dirs (mtphandler, specifications).

- Add [build-system] (setuptools) so the project installs
- Limit package discovery to mtphandler* (excludes specifications/)
- Use SPDX string for license (drops setuptools deprecation warning)
- Raw-string a regex in multiskan_spectrum_parser (drops SyntaxWarning)
- Bump version 0.2.22 -> 0.2.23

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
haeussma and others added 2 commits July 23, 2026 10:22
- tests.yml used `pip install poetry; poetry install --with dev`, but the
  project moved to uv (uv.lock) with PEP 735 [dependency-groups]; poetry has
  no `dev` group here, so install failed. Now uses astral-sh/setup-uv +
  `uv sync --group dev` + `uv run pytest`.
- Bump actions/setup-python@v4 -> v5 in mkdocs.yml (v4 runs on EOL Node 16).
- Add Python 3.14 to the test matrix (continue-on-error): allowed to fail
  until pyenzyme's transitive dep `fastobo` ships 3.14 wheels.
- Widen requires-python to >=3.10,<3.15.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pyenzyme pins fastobo<0.14, which has no 3.14 wheel, so 3.14 can't install.
Revert requires-python to <3.14 and drop 3.14 from the CI matrix until
pyenzyme allows fastobo 0.14.x (which does ship cp314 wheels).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
haeussma and others added 8 commits July 23, 2026 11:51
- publish_pypi: gate TestPyPI publish to tag pushes and add skip-existing,
  so branch pushes no longer 400 on re-uploading an existing version.
- tests: run `pytest tests/` instead of executing docs notebooks with
  --nbval; the notebooks call live PubChem and flake on macOS runners.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
test_define_molecule_without_name does a live PubChem lookup; macOS CI
runners get rate-limited and the test fails there while ubuntu/windows
pass. Skip on PubChem-specific failure so a network flake doesn't red the
build, while still asserting whenever PubChem responds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replaces the earlier skip-on-failure band-aid. test_define_molecule_without_name
is the only test that does a live PubChem lookup. Mark it `network`; CI runs
`pytest -m "not network"` because datacenter runner IPs get rate-limited by
PubChem. A plain local `pytest` still runs it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- actions/checkout v4 -> v7
- actions/setup-python v5 -> v7
- actions/upload-artifact v4 -> v7
- actions/download-artifact v4 -> v8 (v4+ share one backend, cross-compatible)
- actions/cache v4 -> v6
- astral-sh/setup-uv v6 -> v9
- sigstore/gh-action-sigstore-python v2.1.1 -> v3.4.0

Left on moving/recommended refs: codespell-project/actions-codespell@v2,
pypa/gh-action-pypi-publish@release/v1 (upstream's recommended pin).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pypa/gh-action-pypi-publish (>=1.11.0) already generates PEP 740 attestations
by default, so the manual Sigstore signing + release-upload step duplicated
provenance PyPI now provides. PyPA removed it from their canonical workflow.
The github-release job now just creates the GitHub Release; the sigstore
id-token permission and artifact download are no longer needed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- publish: add check-version job (release tag must equal pyproject version),
  gate both publish jobs on it so a mistagged release can't ship.
- add .pre-commit-config.yaml with uv-lock hook so uv.lock can't drift from
  pyproject.toml; add pre-commit to the dev group.
- tests: `uv sync --locked` fails CI if the lock is out of sync (belt to the
  pre-commit hook's suspenders).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Read the installed version via stdlib importlib.metadata instead of
hardcoding, so it stays in sync with pyproject.toml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@haeussma
haeussma merged commit 02b9001 into main Jul 23, 2026
18 checks passed
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