Conversation
- Add new trackers/cli/ package: __main__.py, track.py, eval.py, tune.py, download.py, progress.py - Rewrite all subcommands with click decorators; dynamic --tracker.X params appended via cmd.params.append(click.Option(..., expose_value=False, callback=...)) stored in ctx.obj - Add click>=8.0 to core dependencies (zero transitive deps on Linux/macOS) - Update pyproject.toml console-scripts entry point to trackers.cli.__main__:main - Replace scripts/ files with backward-compat shims re-exporting from cli/ - Rewrite test_download.py and test_tune.py CLI tests using click.testing.CliRunner; update imports in test_track.py and test_progress.py --- Co-authored-by: Claude Code <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Trackers CLI by introducing a new trackers.cli package implemented with click, switching the console-script entrypoint to the new CLI, and turning the legacy trackers.scripts modules into backward-compatibility shims.
Changes:
- Added a new
trackers.clipackage (track,eval,download,tune, plus sharedprogress) implemented withclick. - Updated packaging to depend on
clickand to route thetrackersconsole script totrackers.cli.__main__:main. - Migrated CLI tests to
click.testing.CliRunnerand updated imports to the new modules.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Locks click (and Windows-only colorama) into the dependency graph. |
| pyproject.toml | Adds click>=8.0 and points the trackers entrypoint to trackers.cli.__main__:main. |
| src/trackers/cli/init.py | Introduces the trackers.cli package. |
| src/trackers/cli/main.py | Defines the top-level Click group and registers subcommands. |
| src/trackers/cli/track.py | Click-based track command, including dynamic --tracker.* option generation. |
| src/trackers/cli/eval.py | Click-based eval command with single-sequence and benchmark modes. |
| src/trackers/cli/download.py | Click-based download command with --list and argument parsing. |
| src/trackers/cli/tune.py | Click-based tune command that delegates to trackers.tune.Tuner. |
| src/trackers/cli/progress.py | Progress UI utilities moved under the new CLI package. |
| src/trackers/scripts/main.py | Backward-compat shim delegating to the new CLI entrypoint. |
| src/trackers/scripts/track.py | Backward-compat shim re-exporting the new track implementation. |
| src/trackers/scripts/eval.py | Backward-compat shim re-exporting the new eval command. |
| src/trackers/scripts/download.py | Backward-compat shim re-exporting the new download implementation. |
| src/trackers/scripts/tune.py | Backward-compat shim re-exporting the new tune implementation. |
| src/trackers/scripts/progress.py | Backward-compat shim re-exporting the new progress utilities. |
| tests/scripts/test_download.py | Rewritten download CLI tests using CliRunner. |
| tests/scripts/test_tune.py | Rewritten tune CLI tests using CliRunner. |
| tests/scripts/test_track.py | Updates imports to reference trackers.cli.track. |
| tests/scripts/test_progress.py | Updates imports/patch paths to reference trackers.cli.progress. |
Comment on lines
+185
to
+187
| if model is not None and detections is not None: | ||
| raise click.UsageError("--model and --detections are mutually exclusive.") | ||
|
|
| "--track_ids", default=None, metavar="IDS", help="Filter output by track IDs (comma-separated, e.g., 1,3,5)" | ||
| ) | ||
| @click.option( | ||
| "--tracker", |
| runner = CliRunner() | ||
| result = runner.invoke(cli, ["download"]) | ||
| assert result.exit_code != 0 | ||
| assert "Please specify a dataset" in result.output |
- Fix parse-time crash: filter non-primitive tracker param types in _add_tracker_params (class defaults caused click to invoke them as callables at parse time) - Fix --detections-only mode: set --model default=None, apply DEFAULT_MODEL after mutex check so detections-only invocation no longer raises spurious UsageError - Add CliRunner smoke tests for track command covering help and missing-source paths - Extract shared metrics/threshold/seqmap/output decorators to _options.py; deduplicate ~50 LOC across eval.py and tune.py - Move logging.basicConfig to cli() group with -v/--verbose; replace print(stderr) with click.echo(err=True); sys.exit(rc) → click.exceptions.Exit(rc) in tune_command --- Co-authored-by: Claude Code <noreply@anthropic.com>
argparse→click
Member
Author
|
does not bring the expected simplification |
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.
This pull request introduces a new
trackers.clipackage implementing a modern, modular command-line interface (CLI) for the project using theclicklibrary, replacing the olderargparse-based CLI. It adds new CLI entrypoints for dataset downloading, evaluation, tracking, and hyperparameter tuning, and updates the project configuration to use the new CLI. The legacy CLI is now a thin wrapper for backward compatibility.Major changes:
New CLI implementation
trackers.clipackage with subcommands (download,eval,track,tune) using theclicklibrary for a more user-friendly, extensible CLI. Each subcommand is implemented in its own module for maintainability. [1] [2] [3] [4]progress.pyutility for rich, live progress display during tracking operations.Project configuration and entrypoint updates
pyproject.tomlto add a dependency onclick, and changed the CLI entrypoint to usetrackers.cli.__main__:maininstead of the old scripts location.trackers.scripts.__main__.pyis now a backward-compatibility shim that simply calls the new CLI.Miscellaneous
These changes modernize and modularize the CLI, making it easier to extend and maintain, and provide a better user experience.
Resolves #406