Skip to content

fix: support conditional arrays for untyped environment overrides - #2453

Open
anshurajbisoyi98-ctrl wants to merge 4 commits into
pypa:masterfrom
anshurajbisoyi98-ctrl:fix-2058-untyped-option-overrides
Open

anshurajbisoyi98-ctrl wants to merge 4 commits into
pypa:masterfrom
anshurajbisoyi98-ctrl:fix-2058-untyped-option-overrides

Conversation

@anshurajbisoyi98-ctrl

Copy link
Copy Markdown

Fixes #2058

Untyped environment plugin options previously accepted a single override table but rejected an array of conditional tables. This allows an array during override finalization, after plugin types are available. Each matching entry replaces the whole value, with the last matching entry taking precedence.

Typed plugin options keep their existing handling. Invalid entries report their array position, and condition validation uses the existing resolver. The documentation explains the replacement behavior, and the changelog records the fix.

Verification

  • Configuration tests: 522 passed, including eight new regression and validation cases. The four main regression cases failed without the fix.
  • Project tests: 653 passed.
  • Full suite on macOS / Python 3.13: 2,584 passed, 50 skipped, 12 existing HTTPX deprecation warnings.
  • Repository CI lint command, hatch fmt --check: passed; 407 files formatted correctly.
  • hatch run types:check: passed for 388 source files.
  • git diff --check: passed.

The full suite was run through the test environment's bin/python3. Running through bin/python caused an interpreter-discovery failure in test_new_selected_python, which also reproduced on unchanged upstream. The python3 run passed without changing that test. The newer hatch check command uses a different generated lint configuration and reports existing findings; the repository's configured CI lint command passes.

AI assistance

Codex assisted with investigation, implementation, regression tests and local verification.

Signed-off-by: Anshu Raj Bisoyi <anshurajbisoyi98@gmail.com>
@cjames23

cjames23 commented Oct 4, 2026

Copy link
Copy Markdown
Member

This is not really the fix I want to see for that issue, the first proposed solution is what I want to see which is adding types to all known options with some sort of backwards compatibility for a set of time before we remove that and fully enforce types

@anshurajbisoyi98-ctrl

Copy link
Copy Markdown
Author

Thanks for clarifying. I took the second approach from the issue, but I understand you want known options typed with backwards compatibility for existing override syntax. I’ll revise the implementation in that direction. Is there an established deprecation policy I should follow for the compatibility period?

This branch has not been deployed

No deployments
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.

cannot use array of overrides for some options (like e.g. extra-args)

2 participants