Skip to content

fix: pre-commit is a development tool, not a runtime dependency - #250

Open
petercorke wants to merge 2 commits into
rai-opensource:masterfrom
petercorke:fix/pre-commit-not-a-runtime-dependency
Open

petercorke wants to merge 2 commits into
rai-opensource:masterfrom
petercorke:fix/pre-commit-not-a-runtime-dependency

Conversation

@petercorke

Copy link
Copy Markdown
Collaborator

pre-commit was added to [project].dependencies in #98, alongside the black hook. Nothing in spatialmath imports it, but every pip install spatialmath-python has installed it, and its dependency tree (virtualenv, identify, cfgv, nodeenv, ...), ever since. The hook config was later removed (#153) and restored, but the runtime dependency stayed.

Why it matters beyond bloat: it makes the install fail wherever a transitive pin conflicts. virtualenv 21.14.7 now requires packaging>=26.3, and Pyodide ships packaging 24.2, so in JupyterLite / in-browser notebooks micropip.install("spatialmath-python") raises ValueError: Requested 'packaging>=26.3', but packaging==24.2 is already installed. That breaks the in-browser demos of the Robotics, Machine Vision and bdsim toolboxes, and it will break again whenever any dev tool in that tree raises a floor.

Change: move pre-commit to the dev extra (CI already installs .[dev]) and make the README's contributor instructions install it.

Verified: built the wheel and installed it with micropip.install in Pyodide 0.27.6. Dependencies resolve, and import spatialmath and SE3.Rx(...) work. Before the change the same install fails with the error above.

🤖 Generated with Claude Code

pre-commit was added to [project].dependencies in rai-opensource#98 along with the
black hook, so every 'pip install spatialmath-python' also installs
pre-commit and its dependency tree (virtualenv, identify, cfgv, nodeenv,
...).  spatialmath never imports it.

This is not just bloat.  It makes the install fail anywhere a transitive
pin conflicts: virtualenv 21.14.7 requires packaging>=26.3, and Pyodide
(JupyterLite, in-browser) ships packaging 24.2, so
micropip.install('spatialmath-python') raises ValueError.  Downstream
JupyterLite notebooks of the Robotics, Machine Vision and bdsim toolboxes
are affected.

Move it to the dev extra, which the CI workflows already install, and
make the README's contributor instructions install it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…t-a-runtime-dependency

# Conflicts:
#	pyproject.toml

This branch has not been deployed

No deployments
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.

2 participants