Skip to content

feat(mvtbtool): add 'tool' extra for IPython/pygments - #24

Merged
petercorke merged 3 commits into
mainfrom
feat/tools-extra
Jul 29, 2026
Merged

feat(mvtbtool): add 'tool' extra for IPython/pygments#24
petercorke merged 3 commits into
mainfrom
feat/tools-extra

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

  • mvtbtool imports IPython, pygments, and traitlets inside main(), but none were declared as a dependency anywhere — pip install machinevision-toolbox-python followed by running mvtbtool crashed with a raw ModuleNotFoundError unless IPython happened to already be present transitively (e.g. via Jupyter). Same gap found and fixed in roboticstoolbox-python's rtbtool (companion PR).
  • Wrapped the imports in a try/except that points the user at a new tool extra (pip install machinevision-toolbox-python[tool]) instead of a bare traceback.
  • Added tool = ["ipython", "pygments"] to pyproject.toml, folded into all, and documented in docs/source/installation.rst's extras table alongside the existing ros/jupyter/torch extras.

Test plan

  • Simulated missing IPython/pygments → clean error message pointing at pip install machinevision-toolbox-python[tool]
  • Normal run (python -m machinevisiontoolbox.bin.mvtbtool) still drops into an IPython shell correctly

🤖 Generated with Claude Code

…r message when missing

mvtbtool imports IPython, pygments, and traitlets inside main(), but
none of the three were declared as a dependency anywhere -- pip
install machinevision-toolbox-python followed by running mvtbtool
crashed with a raw ModuleNotFoundError unless IPython happened to
already be present transitively (e.g. via Jupyter). Same gap as
roboticstoolbox-python's rtbtool, fixed there first.

Wrap the imports in a try/except that points the user at the new
'tool' extra instead. Added as an extra (matching the existing
ros/jupyter/torch pattern) rather than a core dependency, since
mvtbtool is an opt-in interactive shell.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Pull in #26's ci.yml fix so this PR's own workflow file (loaded from
this branch's head, not main, for pull_request-triggered runs) actually
tests against opencv4 instead of the unpinned conda-forge opencv5 drift.
This PR adds a `tool` extra (ipython, pygments) to pyproject.toml for
mvtbtool's interactive shell, but ci.yml's conda create-args list is a
separate, hand-maintained package list that pip's --no-deps install
never populates from pyproject.toml's extras -- so test_bin.py::
TestMvtbtool::test_help failed with "IPython and pygments...not
installed" even though the feature code itself is correct. Add both
packages directly to create-args in the test and codecov jobs, matching
how opencv<5 was already handled the same way.

Same underlying gap as the opencv5 CI drift incident: pyproject.toml's
dependency spec and ci.yml's conda list can silently diverge because
they're two separate sources of truth (see tech-debt.md).
@petercorke
petercorke merged commit 0c87ef8 into main Jul 29, 2026
16 of 17 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