Skip to content

fix(packaging): name the extra when an optional entry point is missing - #75

Merged
lexasub merged 1 commit into
mainfrom
fix/console-scripts-without-extras
Aug 25, 2026
Merged

fix(packaging): name the extra when an optional entry point is missing#75
lexasub merged 1 commit into
mainfrom
fix/console-scripts-without-extras

Conversation

@r0h1tb

@r0h1tb r0h1tb commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Description

[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.

Each shim now guards on find_spec and falls back to a main that prints
the install line. ast_rag.cli was already fixed this way in the
test_optional_watchdog work; this covers the two entry points that test
does not reach.

On a clean pip install -e . with neither package present:

before:  ModuleNotFoundError: No module named 'mcp'        (traceback, exit 1)
after:   The AST-RAG MCP server needs the optional 'mcp' package, which is not installed.
         Install it with:  pip install 'ast-rag[mcp]'      (exit 1)

Related Issue

None filed — found while auditing the install path.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • My code follows the code style of this project
  • I have added tests that prove my fix works
  • All new and existing tests passed
  • I have updated the documentation accordingly
  • I have run ast-rag evaluate --all — needs live Neo4j/Qdrant; unaffected by this change (no query path touched)
  • My changes generate no new warnings

Testing

New tests/test_console_scripts_without_extras.py blocks mcp and watchdog
via a meta_path finder 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:

FAILED test_console_script_imports_without_optional_extras[ast-rag-mcp-ast_rag.ast_rag_mcp:main]
FAILED test_console_script_imports_without_optional_extras[ast-rag-watch-ast_rag.watcher:main]
FAILED test_optional_script_names_the_extra_instead_of_crashing[ast-rag-mcp-...]
FAILED test_optional_script_names_the_extra_instead_of_crashing[ast-rag-watch-...]

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, not
only the subprocess simulation — that produced the before/after above.

`[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.
@r0h1tb
r0h1tb requested a review from lexasub as a code owner August 24, 2026 20:31
@github-project-automation github-project-automation Bot moved this to Backlog in raged kanban Aug 24, 2026
@lexasub
lexasub merged commit 46a6cd6 into main Aug 25, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in raged kanban Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants