Repository navigation
MAINT: Remove the legacy flag-style pyrit_scan invocations - #4429
Roman Lutz (romanlutz) merged 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The benchmark pipeline still uses the removed --start-server invocation, causing the job to exit before benchmarks run; it must be migrated to the start-server subcommand.
1 open issue
What changed in this PR
Removes deprecated flag-style pyrit_scan invocations for the 1.3.0 release, completing the CLI’s transition to explicit subcommands.
Changes:
- Removes legacy argument rewrites while preserving global-option placement and help behavior.
- Returns usage errors for commandless arguments and adds regression tests for removed forms.
- Updates two docstring references to use
list-scenarios.
| File | Description |
|---|---|
tests/unit/cli/test_pyrit_scan.py |
Replaces legacy-mapping tests with rejection, verb-placement, and bare-invocation help tests. |
pyrit/setup/initializers/preload_scenario_metadata.py |
Updates a docstring to name the current subcommand. |
pyrit/scenario/core/scenario.py |
Updates a docstring to name the current subcommand. |
pyrit/cli/pyrit_scan.py |
Removes legacy translation and rejects arguments without a command. |
Review effort: Balanced
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Roman Lutz (romanlutz)
left a comment
There was a problem hiding this comment.
Reviewed: deprecation window honored (warned since v1.1.0, due in 1.3.0), repo-wide sweep clean, every removed form now exits 2 with a clear usage error, and the benchmark pipeline migration is covered by a unit test. 174 CLI tests pass on the updated branch.
|
Thanks for the review, the clearer usage error and the merge, Roman Lutz (@romanlutz). |

Description
Removes the legacy flag-style
pyrit_scaninvocations, due in 1.3.0. Closes #4393._LEGACY_COMMAND_FLAGS,_warn_legacyand the three legacy rewrites. What remains of_translate_legacy_argv(moving a verb that follows global options to the front, and leaving--helpto argparse) is now_move_verb_to_front, and theparse_argsand_build_global_parserdocstrings are updated.main(): arguments without a verb are now a usage error (exit 2, "a command is required"). Without this,pyrit_scan --start-serverandpyrit_scan --list-scenarioswould print the top-level help and exit 0. A barepyrit_scanstill prints the help and exits 0.--list-*,--add-initializer,--stop-server, an implicit<scenario>run, a standalone--start-server) exits 2 without running a command, plus tests that--server-url X list-scenariosand--start-server list-targetsstill work.--list-scenariosnow saylist-scenarios.pyrit_scan start-server(with a unit test for that command line), and the doc examples indoc/scanner/garak,doc/scanner/airtanddoc/code/scenarios/3_adaptive_scenarios(.py and .ipynb) usepyrit_scan run ....