A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
chore(deps): unpin mkdocs-material, require click>=8.4 for docs (#10333)
Thomas Schmelzerb519d4b7c684
diff --git a/marimo/_cli/help_formatter.py b/marimo/_cli/help_formatter.pyindex d8a2da1d23..fe61b93c88 100644--- a/marimo/_cli/help_formatter.py+++ b/marimo/_cli/help_formatter.py@@ -12,7 +12,7 @@ import clickfrom click.utils import make_strfrom marimo._cli.print import bright_green, light_blue-from marimo._cli.suggestions import suggest_commands, suggest_short_options+from marimo._cli.suggestions import suggest_commandsdef _split_option_token(token: str) -> tuple[str, str]:@@ -25,49 +25,9 @@ def _split_option_token(token: str) -> tuple[str, str]:return first, token[1:]-def _collect_short_options(- command: click.Command, ctx: click.Context-) -> list[str]:- """Collect all short flag names (e.g. -p) declared on a command."""- options: set[str] = set()- for param in command.get_params(ctx):- if not isinstance(param, click.Option):- continue- for option in [*param.opts, *param.secondary_opts]:- if option.startswith("-") and not option.startswith("--"):- options.add(option)- return sorted(options)---def _augment_short_option_error(- command: click.Command,- ctx: click.Context,- error: click.NoSuchOption,-) -> None:- """Populate click's possibilities for misspelled short flags."""- if error.possibilities:- return- if not error.option_name.startswith("-") or error.option_name.startswith(- "--"- ):- return-- short_options = _collect_short_options(command, ctx)- suggestions = suggest_short_options(error.option_name, short_options)- if suggestions:- error.possibilities = suggestions--class ColoredCommand(click.Command):"""Click Command with colored help output (cargo-style)."""- def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:- try:- return super().parse_args(ctx, args)- except click.NoSuchOption as error:- _augment_short_option_error(self, ctx, error)- raise-def format_usage(self, ctx: click.Context, formatter: click.HelpFormatter) -> None:@@ -110,13 +70,6 @@ class ColoredGroup(click.Group):command_class = ColoredCommand- def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:- try:- return super().parse_args(ctx, args)- except click.NoSuchOption as error:- _augment_short_option_error(self, ctx, error)- raise-def resolve_command(self, ctx: click.Context, args: list[str]) -> tuple[str | None, click.Command | None, list[str]]:diff --git a/marimo/_cli/parser_ux.py b/marimo/_cli/parser_ux.pyindex 4a02245d29..cdc63343e7 100644--- a/marimo/_cli/parser_ux.py+++ b/marimo/_cli/parser_ux.py@@ -6,6 +6,32 @@ from typing import Anyimport clickfrom marimo._cli.print import red+from marimo._cli.suggestions import suggest_short_options+++def _collect_short_options(ctx: click.Context) -> list[str]:+ """Collect all short flag names (e.g. -p) declared on the command."""+ options: set[str] = set()+ for param in ctx.command.get_params(ctx):+ if not isinstance(param, click.Option):+ continue+ for option in [*param.opts, *param.secondary_opts]:+ if option.startswith("-") and not option.startswith("--"):+ options.add(option)+ return sorted(options)+++def _short_option_possibilities(error: click.NoSuchOption) -> list[str]:+ """Suggest short flags for a misspelled short option.++ Click only fills in `possibilities` for long options, so short flags get+ their suggestions here.+ """+ if error.ctx is None:+ return []+ return suggest_short_options(+ error.option_name, _collect_short_options(error.ctx)+ )def _normalize_usage_message(message: str) -> str:@@ -29,8 +55,11 @@ def _format_no_such_option(error: click.NoSuchOption) -> list[str]:lines = [f"{red('error')}: unexpected argument {error.option_name!r} found"]- if error.possibilities:- lines.extend(["", _format_suggestion_tip(list(error.possibilities))])+ possibilities = list(+ error.possibilities or _short_option_possibilities(error)+ )+ if possibilities:+ lines.extend(["", _format_suggestion_tip(possibilities)])return linesdiff --git a/pyproject.toml b/pyproject.tomlindex 24db01fc12..2c57879611 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -271,8 +271,15 @@ docs = ["marimo_docs","ruff>=0.15.18","mkdocs>=1.6.1",- # Live reloading broken in >= 9.6.21: https://github.com/squidfunk/mkdocs-material/issues/8478- "mkdocs-material==9.6.20",+ # `mkdocs serve` silently loses live reload on click 8.3.x: MkDocs declares+ # --no-livereload/--livereload as a feature switch group, and click 8.3+ # dropped the explicit `default=True` on the second option. Fixed in click+ # 8.4.0, so require that here rather than pinning mkdocs-material back to+ # 9.6.20 (the last release that capped click<8.2.2, which used to mask it).+ # https://github.com/squidfunk/mkdocs-material/issues/8478+ "click>=8.4",+ # 9.7.5+ drops the `pymdown-extensions~=10.2` cap and caps `mkdocs<2`.+ "mkdocs-material>=9.7.5","mkdocstrings[python]>=0.27.0","mkdocs-material-extensions>=1.3.1","mkdocs-autorefs>=1.2.2",