Skip to content

pip: declare click, which typer no longer pulls in - #7504

Merged
danielhanchen merged 1 commit into
pipfrom
fix/declare-click
Jul 27, 2026
Merged

danielhanchen merged 1 commit into
pipfrom
fix/declare-click

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

unsloth_cli/commands/start.py:25 imports click at module scope, and unsloth_cli/__init__.py:36 imports that module, so every unsloth command needs click before it does anything. It is used for real: click.Context in parse_args and click.clear() in the connection output.

It was never declared. typer supplied it, until it stopped:

typer 0.12.0  click requirement -> NONE
typer 0.15.4  click requirement -> click<8.2,>=8.0.0
typer 0.19.0  click requirement -> click>=8.0.0
typer 0.27.0  click requirement -> NONE

The declared floor is typer>=0.12.0, so a fresh resolve today installs typer 0.27 and no click. The wheel still works because huggingface_hub requires click<9,>=8.4.2, so click arrives transitively. That is luck, not a declaration, and it is the same shape as the structlog gap in #7493: an undeclared import that something else happened to satisfy until it did not.

How it showed up

Building a wheel from a dependency list that has typer but not huggingface_hub, and installing it into a fresh venv:

$ unsloth --help
  File ".../unsloth_cli/commands/start.py", line 25, in <module>
    import click
ModuleNotFoundError: No module named 'click'

Not one command, all of them, before argument parsing.

Changes

  • click>=8.0 becomes a core dependency.
  • tests/studio/install/test_studio_extra_matches_requirements.py now checks click alongside structlog, so the next import that a transitive dependency happens to satisfy does not go unnoticed.

Testing

Wheel built from this branch: 29 core Requires-Dist entries with click>=8.0 and structlog>=24.1.0 both present, Provides-Extra: studio intact, torch and the rest of the ML stack unchanged. Drift test 4 passed. Fresh install of the fixed wheel: unsloth --help exits 0 with click 8.4.2.

Related: #7493

unsloth_cli/commands/start.py imports click at module scope, and
unsloth_cli/__init__.py imports that module, so every unsloth command needs
it. typer carried click through 0.19 and dropped it in 0.27, and the declared
floor is typer>=0.12.0, so a fresh resolve gets none. The wheel still works
today only because huggingface_hub requires click<9,>=8.4.2, which is luck
rather than a declaration.

Verified on a wheel built from a dependency list without that transitive
provider: every command, including `unsloth --help`, died with
ModuleNotFoundError for click. Same class as the structlog gap in #7493, so
the drift test covers both now.
@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.
Repo admins can enable using credits for code reviews in their settings.

@danielhanchen
danielhanchen merged commit 2bea786 into pip Jul 27, 2026
49 of 54 checks passed
@danielhanchen
danielhanchen deleted the fix/declare-click branch July 27, 2026 13:50
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.

1 participant