Repository navigation
Python: Honor the legacy dependency --project selector - #9674
Closed
LI (ktz03) wants to merge 1 commit into
Closed
LI (ktz03) wants to merge 1 commit into
LI (ktz03) wants to merge 1 commit into
Conversation
LI (ktz03)
temporarily deployed
to
github-app-auth
October 24, 2026 16:04 — with
GitHub Actions
Inactive
LI (ktz03)
temporarily deployed
to
github-app-auth
October 24, 2026 16:04 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new regression tests are outside CI test discovery, so they do not provide automated protection against reintroducing the alias failure.
1 open issue
What changed in this PR
Fixes the Python dependency-management wrapper so the hidden legacy --project selector works without requiring --package.
Changes:
- Validates the shared selector value after parsing, preserving explicit empty-value handling.
- Adds eight regression cases covering selector spellings, precedence, required arguments, hidden help output, and
uv adddelegation.
| File | Description |
|---|---|
python/scripts/dependencies/tests/test_add_dependency_to_project.py |
Adds mocked command-line regression tests. |
python/scripts/dependencies/add_dependency_to_project.py |
Moves selector validation after parsing to support the legacy alias. |
Review effort: Balanced
Comment on lines
+36
to
+38
| def test_main_accepts_selector_spellings( | ||
| monkeypatch: pytest.MonkeyPatch, selector_args: list[str], expected_selector: str | ||
| ) -> None: |
4 of 7 tasks
This branch was previously deployed
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.

Motivation & Context
add_dependency_to_project.pyretains--projectas a hidden compatibility alias, but--project core --dependency httpxexits with an argparse error. The required flag is attached only to the separate-P/--packageaction, so setting the shared destination through the alias does not satisfy it.Description & Review Guide
uv adddelegation are preserved.is Nonecheck preserves existing handling of explicit empty values. The focused tests call the actual wrappermain(), with package resolution and subprocess execution mocked. The baseline has one failure (legacy alias alone) and seven passing controls; the fix passes all eight. No realuv add, dependency mutation, SDK/provider call, build, or full workspace suite was run.Related Issue
N/A - trivial change. This corrects the existing source's explicit compatibility promise without changing selector resolution, dependency handling, or subprocess execution.
AI Assistance
AI assistance details: Codex: code, regression tests, and this PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.