Repository navigation
salli-server runs with Typer 0.29: the --json flag built from a declaration - #222
Merged
Merged
Conversation
…a declaration with_json_option called TyperOption(...) directly, and Typer 0.29 made type_descriptor a required argument of it, so every command failed with a TypeError wherever 0.29 was installed (a pip install of the wheel today; salli-hosted's test job). The lock's 0.26.7 hid it. _json_flag now declares the option with typer.Option on a throwaway command and takes the option Typer builds, so it depends on no constructor's arguments: still eager, not exposed, the same help text and _enable_json itself as its callback. Every help page is byte-identical to main's under 0.26.7, and the CLI tests pass with Typer 0.26.7, 0.26.8, 0.27.0, 0.27.3, 0.28.0 and 0.29.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in CI Typer forces a terminal where GITHUB_ACTIONS (or FORCE_COLOR) is set, and the highlighter splits "--json" with escape codes, so the assertion failed in CI and passed locally. Strip the SGR codes before looking for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
with_json_option(src/salli/interfaces/cli/support.py) constructedTyperOption(...)itself to add--jsonto every command. Typer 0.29 madetype_descriptora required argument of that constructor, so wherever 0.29 is installed everysalli-servercommand fails at start-up:The lock pins 0.26.7, so this repository's CI, the image and the Render build were fine. A pip install of the wheel resolves
typer[all]>=0.12to 0.29, and so did salli-hosted's test job (leafmonkeylabs/salli#31).typer.main.get_click_param, the other candidate, does not survive either: 0.29 renamed it to the private_get_param.The fix.
_json_flag()declares the option withtyper.Optionon a throwaway command and takes the option Typer builds from it, as it builds every other option. Nothing depends on a constructor's arguments, only ontyper.Typer,typer.Optionandtyper.main.get_command, whichmain.cli()already uses. Behaviour is unchanged: the flag is eager, not exposed, has the same help text, shows no default or env var, and its callback is_enable_jsonitself. No upper bound on Typer.Tests. A new unit test checks each command's flag (opts, eager, not exposed, the callback, the help text) and that
--helpshows it.Checked locally:
--helppage (28: the root, the groups, every command) is byte-identical to main's under the lock's 0.26.7.salli-server --help,db upgrade --json,db current --jsonanddoctor --jsonagainst a scratch Postgres exit 0 with JSON on stdout and messages on stderr, under both 0.26.7 and 0.29.0. Main's code under 0.29.0 fails with theTypeErrorabove.uv run --with typer==X).🤖 Generated with Claude Code