Skip to content

Apply instantiators to auto_cli class components and make instantiators keyword-only - #996

Merged
mauvilsa merged 1 commit into
v4from
call-scoped-instantiators-fixes-v4
Oct 1, 2026
Merged

mauvilsa merged 1 commit into
v4from
call-scoped-instantiators-fixes-v4

Conversation

@mauvilsa

@mauvilsa mauvilsa commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Follow-up to #994

  • auto_cli built class components directly, so custom instantiators never reached them. This applied to return_instance=True and to class-method subcommands. They now go through the instantiators passed to auto_cli and the global ones.
  • auto_cli now gives the instantiators to instantiate as context instead of as a keyword. A parser_class that overrides instantiate with the old signature therefore keeps working when instantiators is given.
  • instantiators is now keyword-only in ArgumentParser.instantiate, auto_cli and FromConfigMixin.from_config. Since v4.53.0 is unreleased, this breaks nothing, and v5 keeps the same signature.

Before submitting

  • Did you read the contributing guideline?
  • If you used a coding agent, did you fully understand and validate all generated code and ensure it follows the contributing guidelines?
  • [n/a] Did you update the documentation? (readme and public docstrings)
  • Did you write unit tests such that there is 100% coverage on related code? (required for bug fixes and new features)
  • Did you verify that new and existing tests pass locally?
  • If this is a bug fix, did you verify that the tests fail without the code fix?
  • Did you make sure that all changes preserve backward compatibility?
  • Did you update the CHANGELOG including a pull request link? (not for typos, docs, test updates, or minor internal changes/refactors)

@mauvilsa mauvilsa added the bug Something isn't working label Oct 1, 2026
@mauvilsa
mauvilsa deployed to sonarcloud October 1, 2026 19:33 — with GitHub Actions Active
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bc5d73c) to head (7c57311).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##                v4      #996   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           28        28           
  Lines         9457      9462    +5     
=========================================
+ Hits          9457      9462    +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes how instantiators are passed to CLI and config functions.

The PR appears safe to merge; no actionable regression was established.

Summary

This PR routes auto_cli class-component construction through custom instantiators and makes the newly introduced instantiators parameters keyword-only.

  • Passes call-scoped instantiators through parser context so parser subclasses with older instantiate overrides remain compatible.
  • Adds coverage for class returns, class-method subcommands, global instantiators, and context isolation.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[auto_cli] --> B[Parse arguments]
  B --> C[Instantiate parsed configuration]
  C --> D{Class component?}
  D -->|Yes| E[Select scoped, parser, or global instantiator]
  E --> F[Construct class and optionally invoke method]
  D -->|No| G[Invoke function component]
Loading

Reviews (1) · Last reviewed commit: "Apply instantiators to auto_cli class co..."

@mauvilsa
mauvilsa merged commit aab9ea8 into v4 Oct 1, 2026
31 checks passed
@mauvilsa
mauvilsa deleted the call-scoped-instantiators-fixes-v4 branch October 1, 2026 19:36

This branch was successfully deployed

1 active deployment
sonarcloud — 7c573116 Deployed Oct 1, 2026 by mauvilsa via sonarcloud #929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant