fix(packaging): name the extra when an optional entry point is missing - #75
Merged
Conversation
`[project.scripts]` installs `ast-rag-mcp` and `ast-rag-watch` on every `pip install ast-rag`, but `mcp` and `watchdog` ship only in the `[mcp]` extra. Both commands died at import with a bare ModuleNotFoundError that never mentions the extra that fixes it. Guard each shim on `find_spec` and fall back to a `main` that prints the install line. `ast_rag.cli` was already fixed this way; this covers the two entry points that test did not reach.
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.
Description
[project.scripts]installsast-rag-mcpandast-rag-watchon everypip install ast-rag, butmcpandwatchdogship only in the[mcp]extra. Both commands died at import with a bare
ModuleNotFoundErrorthat never mentions the extra that fixes it.
Each shim now guards on
find_specand falls back to amainthat printsthe install line.
ast_rag.cliwas already fixed this way in thetest_optional_watchdogwork; this covers the two entry points that testdoes not reach.
On a clean
pip install -e .with neither package present:Related Issue
None filed — found while auditing the install path.
Type of Change
Checklist
ast-rag evaluate --all— needs live Neo4j/Qdrant; unaffected by this change (no query path touched)Testing
New
tests/test_console_scripts_without_extras.pyblocksmcpandwatchdogvia a
meta_pathfinder in a subprocess, then asserts every[project.scripts]target still resolves, and that the two optional ones exit naming the extra
rather than raising.
Without the fix, 4 of its 5 tests fail with the reported symptom:
Suite: 255 passed / 1 skipped / 1 xfailed before, 260 / 1 / 1 after (5 new).
Also verified through a real
uv pip install -e .into an empty venv, notonly the subprocess simulation — that produced the before/after above.