feat: add lazy CLI extensions - #863
Open
andreatnvidia wants to merge 2 commits into
Open
Conversation
Signed-off-by: Andre Manoel <amanoel@nvidia.com>
Signed-off-by: Andre Manoel <amanoel@nvidia.com>
andreatnvidia
marked this pull request as ready for review
August 13, 2026 16:42
Contributor
Greptile SummaryAdds metadata-only discovery and lazy loading of optional top-level CLI command groups.
|
| Filename | Overview |
|---|---|
| packages/data-designer/src/data_designer/cli/lazy_group.py | Implements metadata-only extension discovery, deferred compatibility validation and loading, and deterministic collision handling; no actionable defect was established. |
| packages/data-designer/src/data_designer/cli/main.py | Enables extension discovery only on the root CLI group while preserving existing lazy built-ins. |
| packages/data-designer-slurm/src/data_designer/slurm/cli.py | Adds the minimal Slurm Typer group factory required by the new entry-point contract. |
| packages/data-designer-slurm/pyproject.toml | Registers the Slurm command factory under the new data_designer.cli entry-point group. |
| packages/data-designer/tests/cli/test_lazy_group.py | Provides broad coverage of lazy loading, nested dispatch, compatibility failures, malformed registrations, and collisions. |
| scripts/test_slurm_package_install.py | Extends installed-wheel smoke tests to verify extension visibility, import isolation, dispatch, and CLI startup budgets. |
Sequence Diagram
sequenceDiagram
participant User
participant Root as Data Designer CLI
participant Metadata as Entry-point metadata
participant Factory as Extension factory
participant Command as Extension command
User->>Root: data-designer --help
Root->>Metadata: Discover names and summaries
Metadata-->>Root: Extension metadata
Root-->>User: Root help without imports
User->>Root: data-designer slurm ...
Root->>Metadata: Resolve selected provider
Root->>Root: Validate compatibility
Root->>Factory: Load and call selected factory
Factory-->>Root: click.Command
Root->>Command: Dispatch remaining arguments
Command-->>User: Output and exit status
Reviews (1): Last reviewed commit: "fix: isolate CLI extension failures" | Re-trigger Greptile
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.
Summary
Adds a minimal entry-point seam for optional packages to provide top-level
data-designercommand groups without importing their implementation until selected.Related issues
Closes #853
Depends on #856
Related to #850
Changes
data_designer.clientry-point metadata.Impact
A base-only install has no
slurmcommand. Installingdata-designer[slurm]addsdata-designer slurm, while root help and unrelated commands do not importdata_designer.slurmor compatibility-checking modules.F2 intentionally establishes the extension seam and an empty Slurm group. Leaf subcommands are owned by follow-up API work. A generic nested-command test proves the seam supports deeper command trees and preserves leaf exit codes.
This PR is stacked on #856 and should be retargeted to
mainafter F1 merges.Testing
.venv/bin/pytest packages/data-designer/tests packages/data-designer-slurm/tests -p no:cacheprovider(1146 passed, 1 skipped)make test-slurm-wheel-install(0.574 s base median, 0.568 s extension median; 1 s base and 100 ms overhead budgets).venv/bin/ruff check --fix ..venv/bin/ruff format .