Skip to content

fix(cli): drop deprecated --nodata/--autosave and warn on legacy flag aliases - #2245

Merged
wkentaro merged 1 commit into
mainfrom
fix/2232-deprecated-cli-flags
Jun 23, 2026
Merged

wkentaro merged 1 commit into
mainfrom
fix/2232-deprecated-cli-flags

Conversation

@wkentaro

Copy link
Copy Markdown
Owner

Closes #2232

Part of the v7 effort. The CLI is the one public contract that gets deprecate-then-remove discipline, so the two flag categories are treated differently.

Summary

  • Remove --nodata and --autosave: they already warned and were no-ops (image-data-off and autosave-on are the defaults). They now error as unknown arguments.
  • --nosortlabels, --labelflags, --validatelabel keep working but now emit a FutureWarning pointing to the canonical --no-sort-labels / --label-flags / --validate-label. Removal is deferred to v8.
  • The warning is emitted by a small argparse.Action (_DeprecatedAlias) that fires at parse time based on the matched option_string, so the alias list lives only in the add_argument calls (single source of truth) and abbreviations / =value forms are covered too.

Test plan

  • tests added: tests/unit/__main___test.py (removed flags error with exit 2; each alias warns pointing to its canonical, incl. an argparse abbreviation; canonical flags emit no warning)
  • manual CLI: --nodata/--autosave -> unknown-argument error; --nosortlabels/--validatelabel=exact/--nosort -> FutureWarning; --validate-label exact -> no warning; --validatelabel bad -> invalid-choice error
  • full suite green: uv run pytest tests/ (628 passed)
  • make lint (ruff format/check, ty, taplo)

@wkentaro wkentaro self-assigned this Jun 20, 2026
@wkentaro wkentaro added this to the v7.0.0 milestone Jun 23, 2026
@wkentaro
wkentaro force-pushed the fix/2232-deprecated-cli-flags branch 2 times, most recently from c1e4a57 to 27b7765 Compare June 23, 2026 11:57
@wkentaro
wkentaro force-pushed the fix/2232-deprecated-cli-flags branch from 27b7765 to fe84b73 Compare June 23, 2026 12:05
@wkentaro

Copy link
Copy Markdown
Owner Author

This was generated by AI during PR processing.

Verdict: recommend-merge

Own PR finalize, all checks pass.

  • Matches issue Clean up deprecated CLI flags for v7 (--nodata/--autosave removal; warn aliases) #2232 acceptance criteria exactly: --nodata/--autosave removed (now error as unknown args); --nosortlabels/--labelflags/--validatelabel still work but emit a FutureWarning pointing to the canonical flag; the canonical flags are unchanged; tests cover both paths.
  • Rebase: skipped. main gained 0 commits since the merge-base and merge state is CLEAN/MERGEABLE, so the existing green CI already reflects the merged result.
  • Code review (medium gate): no correctness bugs. Only minor stylistic nits (a descriptive docstring, the forced nargs==0 branch in _DeprecatedAlias, one # argparse abbreviation comment) within existing repo conventions, so /review-fix was skipped.
  • Commits: single clean conventional commit, no reshaping needed.
  • Verify (local smoke): 11 passed; labelme --nodataerror: unrecognized arguments: --nodata; labelme --nosortlabels --version → FutureWarning to --no-sort-labels; labelme --no-sort-labels --version → no warning.
  • CI: all 8 checks green (lint, cla, test matrix across ubuntu/macos/windows × 3.11/3.14).

No spin-off issues; the change is self-contained.

@wkentaro wkentaro added the recommend-merge pr: Agent finalized and endorses it: review and merge label Jun 23, 2026
@wkentaro

Copy link
Copy Markdown
Owner Author

This was generated by AI.

Follow-up: migrated the example docs off the deprecated flag spellings too, so the documented commands no longer emit FutureWarning after this change:

  • examples/instance_segmentation/README.md: --validatelabel--validate-label, --labelflags--label-flags
  • examples/semantic_segmentation/README.md: --validatelabel--validate-label

Folded into the existing commit and force-pushed (27b77654fe84b73d).

@wkentaro
wkentaro merged commit 8575c33 into main Jun 23, 2026
8 checks passed
@wkentaro
wkentaro deleted the fix/2232-deprecated-cli-flags branch June 23, 2026 12:07
pull Bot pushed a commit to Mu-L/labelme that referenced this pull request Jul 1, 2026
Adds the missing [Unreleased] entries for color theme / dark mode (wkentaro#2260),
out-of-bounds points (wkentaro#2223), import-surface privatization (wkentaro#2253),
--autosave/--nodata removal (wkentaro#2245), and nine bug fixes. Never-released
regressions fixed within the Qt6 cycle are intentionally omitted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recommend-merge pr: Agent finalized and endorses it: review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up deprecated CLI flags for v7 (--nodata/--autosave removal; warn aliases)

1 participant