Repository navigation
fix(install): drop undeclared packaging import from the .mcp.json heal gate - #3909
Merged
Daniel Meppiel (danielmeppiel) merged 2 commits intoNov 19, 2026
Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
Daniel Meppiel (danielmeppiel) merged 2 commits into
Conversation
…l gate apm install failed with "No module named 'packaging'" when APM was installed without dev extras. lock_predates_root_mcp_json now reads the lock apm_version release with the standard library (same results as packaging for PEP 440 versions), and a static test checks that every third-party import under src/apm_cli maps to a declared runtime dependency. apm-spec-waiver: dependency-hygiene fix with no OpenAPM-observable behaviour change Fixes #3908 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 19, 2026 09:20
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change removing the undeclared packaging dependency from the MCP migration gate.
No open issues 🎉
What changed in this PR
Fixes #3908 by removing the undeclared packaging dependency from the lockfile gate used to migrate Copilot MCP configuration to root .mcp.json, restoring apm install without dev extras.
Changes:
- Replaces
packaging.versionparsing with a standard-library regex. - Adds a static guard checking third-party imports against declared runtime dependencies, with explicit exceptions.
- Documents the installation fix in the changelog.
| File | Description |
|---|---|
tests/unit/test_runtime_import_declarations.py |
Adds static checks for undeclared runtime imports. |
src/apm_cli/install/mcp/retired_destinations.py |
Removes the gate’s dependency on packaging. |
CHANGELOG.md |
Records the fix for installations without dev extras. |
Review effort: Balanced
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-fix-packaging-runtime-import
branch
November 19, 2026 09:35
5 of 14 tasks
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
apm installfailed with[x] Error installing dependencies: No module named 'packaging'when APM was installed without dev extras, for example withpip install apm-cli.lock_predates_root_mcp_jsoninsrc/apm_cli/install/mcp/retired_destinations.pyimportedpackaging.version, andpackagingis not a runtime dependency. The import came in with #3875; #3899 put it on every install path.The fix reads the PEP 440 release from the lock's
apm_versionwith a stdlib regex instead. I compared it withpackagingon 24 version strings (None, empty,unknown, pre-releases, dev and local versions, post releases, epochs, avprefix, garbage): the results are identical.New guard:
tests/unit/test_runtime_import_declarations.pystatically scanssrc/apm_cliand requires every third-party import root to map to a[project].dependenciesentry. The only exceptions arecertifiandurllib3, whichrequestshard-requires, and the unreachableimportlib_metadatafallback. It fails on main, namingpackaging.Why CI missed it: every CI job installs
--extra dev, and pytest and pylint bringpackagingin. The PyInstaller binary bundlespackagingbecause PyInstaller itself depends on it. No job exercised a plain runtime install. The static guard does not depend on the environment.Issue and approved scope
Issue: Fixes #3908
Human scope-approval comment: #3908 (comment)
Does this PR complete the issue, or what remains? It completes the issue.
Type of change
Testing
Commands and results:
uv venv /tmp/cleanvenv && VIRTUAL_ENV=/tmp/cleanvenv uv pip install ..import packagingraisesModuleNotFoundError, which confirmspackagingis not installed.apm installon a fixture with a 0.36.1 lock and a copilot MCP claim:[x] Error installing dependencies: No module named 'packaging'Installed 1 MCP server, exit code 0,.mcp.jsonwritten..venv/bin/python -m pytest tests/unit/test_runtime_import_declarations.py tests/unit/install/test_copilot_project_mcp_destination.py -p no:xdist -q: 44 passed. The guard fails with the fix reverted.Changelog
## [Unreleased]inCHANGELOG.md: user-visibleeffect first, 25 words or fewer, ending with
(#PR); see.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.