Skip to content

Fixes wrong negative argparse.BooleanOptionalAction argument name - #6560

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
pchemguy:bad-auto-neg-arg
Jun 22, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
pchemguy:bad-auto-neg-arg

Conversation

@pchemguy

Copy link
Copy Markdown
Contributor

studio.backend.run.main adds "--secure" argument via argparse.BooleanOptionalAction, which automatically creates negative --no-secure, that is with NO prefix, instead of NOT.

studio.backend.run.__main__ adds "--secure" argument via argparse.BooleanOptionalAction, which automatically creates negative --no-secure, that is with **NO** prefix, instead of **NOT**.
@pchemguy
pchemguy requested a review from danielhanchen as a code owner June 22, 2026 08:59
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request renames the --not-secure CLI flag to --no-secure across the codebase, including CLI definitions, argument forwarding, error messages, help text, and corresponding unit tests. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@pchemguy pchemguy changed the title Correct wrong negative argparse.BooleanOptionalAction argument name Fixes wrong negative argparse.BooleanOptionalAction argument name Jun 22, 2026
@danielhanchen
danielhanchen merged commit 52c2cf8 into unslothai:main Jun 22, 2026
1 check passed
@danielhanchen

Copy link
Copy Markdown
Member

Thanks!

danielhanchen added a commit that referenced this pull request Jun 22, 2026
…6568)

* Studio: accept --not-secure as a back-compat alias for --no-secure

PR #6560 renamed the negative secure flag from --not-secure to --no-secure
to match argparse.BooleanOptionalAction. Re-add --not-secure as a hidden,
deprecated alias at both CLI layers so existing scripts and muscle memory
keep working, while --no-secure stays the documented spelling.

- studio/backend/run.py: extract the CLI parser into _build_arg_parser() so
  the flag wiring is unit-testable, and register --not-secure as a hidden
  store_false alias for --no-secure. Last flag wins, matching
  BooleanOptionalAction semantics.
- unsloth_cli/commands/studio.py: add a hidden --not-secure option to
  `unsloth studio` and `unsloth studio run`; it forces secure off and
  forwards the canonical --no-secure to the backend.
- Tests at both layers for the alias and its polarity.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: address review on --not-secure alias

- run.py: use argparse.SUPPRESS for the --not-secure default so the alias
  never contributes a namespace default (the canonical --secure owns it).
- studio.py: resolve --not-secure last-wins from argv via _resolve_secure()
  so `--not-secure --secure` keeps secure on, matching the backend's
  BooleanOptionalAction and how --secure/--no-secure already behave.
- Add a CLI last-wins test covering both flag orders.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@pchemguy
pchemguy deleted the bad-auto-neg-arg branch June 22, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants