Repository navigation
build: lift the Typer, Click and Rich version holds - #535
Merged
Merged
Conversation
Raise typer to >=0.29.2 and rich to >=13.9.4 with no upper bound, and drop the direct click==8.1.7 pin. Typer vendors Click since 0.26.0, so nothing in hyperglass imports click any more; uvicorn, litestar and black still pull it in. - onboard: the port prompt passed click.IntRange to typer.prompt, which Typer 0.29 no longer accepts (AssertionError on input). Use an Annotated int with Pydantic bounds, which Typer validates. - run() called typer.run(cli()); call cli() directly. - Rename the duplicate _version callback and make --version eager. - Drop is_flag from the plugins options; Typer deprecates it. - Tests: CliRunner no longer takes mix_stderr (Click 8.2). Add --help tests for every command and subcommand, a check that the list covers every registered command, --version, the no-argument usage, the Inspect-based commands against test state, and the port prompt range. rich._inspect.Inspect stays: rich.inspect() only prints, and the devices/directives commands need the renderable for Columns. Closes #531
WilhelmZA
approved these changes
Nov 21, 2026
WilhelmZA
left a comment
Collaborator
There was a problem hiding this comment.
Approving at 0c125ddd.
I read the dependency changes, the lock file and the CLI changes. Nothing in hyperglass/ imports click directly any more, the hyperglass.console:run entry point still resolves, and the new lock entries (annotated-doc, shellingham) have permissive licences. CI gate passes and every commit is verified.
#526 also regenerates uv.lock, so the second one to merge needs a re-lock.
Nits:
- The body has a Changelog entry but
CHANGELOG.mdis not edited. The no-argument exit status changes from 0 to 2, which scripts can depend on, so please add the entry under[Unreleased], here or in the release PR. hyperglass/cli/tests/test_help.py:test_no_arguments_shows_helpdoes not assert the exit code.assert result.exit_code == 2would pin the documented behaviour.hyperglass/cli/tests/test_help.py: thepluginscase intest_inspect_commandsexpects"", which every string contains, so only the exit code is checked for that case.
This was referenced Nov 21, 2026
This was referenced Nov 21, 2026
jsenecal
added a commit
that referenced
this pull request
Nov 21, 2026
Typer 0.29 ships its own CliRunner, which takes only charset and env, so CliRunner(mix_stderr=False) in test_healthcheck.py raised TypeError at collection once #535 lifted the Typer hold, and main's CI broke. The healthcheck command prints only to stdout and the tests check exit codes, so a plain CliRunner() is enough. That collection error also hid test_help.py::test_commands_cover_cli, which fails because COMMANDS lacked healthcheck (#524); it is added.
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.
Problem
pyproject.tomlheld the CLI dependencies at old versions:typer>=0.9.0,<0.10.0(locked 0.9.4),click==8.1.7andrich<=14.0.0(locked 13.9.4). #394 added the holds because Typer 0.9 breaks with Click 8.2+. Now that Renovate manages Python (#528), it proposes updates that the holds block.Change
pyproject.toml:typer>=0.29.2,rich>=13.9.4, no upper bounds. The directclickdependency is removed. Typer 0.26.0 vendors Click and no longer depends on it (release notes), and after the change below no hyperglass code importsclick. Click stays in the lock through uvicorn, litestar (rich-click) and black.uv.lock:uv lock --upgrade-package typer --upgrade-package click --upgrade-package rich. Changed packages only:hyperglass/cli/onboard/prompts.py: theonboard deviceport prompt passedclick.IntRange(1, 65535)totyper.prompt. Typer 0.29 validates prompt input with Pydantic (0.29.0 notes) and no longer accepts Click types (Vendored Click): with the old code, every answer to the port prompt raisedAssertionError. The prompt now usesAnnotated[int, Field(ge=1, le=65535)]. It asks again when the input is out of range or not an integer, as before.hyperglass/cli/main.py:run()calledtyper.run(cli()).cli()parsessys.argvand exits by itself, so the outertyper.runnever ran. It now callscli()._version: the--versioncallback, and the app callback that replaced it. The callback is now_print_version, the app callback is_main, and--versionisis_eagerso it runs before other parameters.plugins --input/--output: removedis_flag=True. Typer deprecated it (0.13.0) and 0.29.2 warns about it.booloptions are already flags.rich._inspect.Inspectstays, with a comment. It still exists in Rich 15 with the same signature. The publicrich.inspect()prints and returnsNone, anddevices/directivesneed the renderable to lay panels out inColumns. The new tests run these commands, so a Rich change that removes it fails CI.CliRunner(mix_stderr=False)→CliRunner(). Click 8.2.0 removedmix_stderrand always keepsstderrseparate (Click CHANGES, 8.2.0).Tests
New in
hyperglass/cli/tests/(27 tests):test_command_help:--helpfor each of the 11 commands, theonboardgroup and its 4 subcommands (16 cases).test_commands_cover_cli: that list equals the registered commands and subcommands, so a new command without a help test fails.test_version,test_no_arguments_shows_help.test_inspect_commands:devices,devices test1,directives,directives juniper_bgp_route,params,params messages.no_input,pluginsagainst the test state (fakeredis), checking the output and that the device password does not appear.test_port_prompt_rejects_out_of_range_values:0,65536,sshare rejected, then2222is accepted.hyperglass/cliand the support-bundle tests also pass on Python 3.11 (83 passed).mainhas 4146 tests; the 27 above are the difference.Entrypoint from the venv:
hyperglass --versionprints3.0.0rc2, andhyperglass <command> --helpexits 0 for all 16 commands and subcommands.Image:
Changelog
hyperglasswith no arguments now exits with status 2 after printing the help.Notes
Visible CLI changes, all from upstream releases:
hyperglasswith no arguments prints the help and exits with status 2 instead of 0. Click 8.2.0: "If help is shown becauseno_args_is_helpis enabled …, the exit code is 2 instead of 0."--helplists commands in definition order instead of alphabetically (Typer 0.13.0, "Show help items in order of definition"), and shows a type column such as<bool>(Typer 0.27.0, "Update metavar printing").NO_COLORorFORCE_COLORas unset. Nothing in this repository sets them.Not changed here:
.tests/ga-backend-app.shrunshyperglass.console setup -d.setuphas no-doption with either Typer version, and the script ignores the failure. That is unrelated to this change and stays as it is.Closes #531