MCPcopy
hub / github.com/marimo-team/marimo / describe

Function describe

marimo/_cli/config/commands.py:58–127  ·  view source on GitHub ↗

Print documentation for all config options.

()

Source from the content-addressed store, hash-verified

56
57@click.command(cls=ColoredCommand, help="""Describe the marimo config.""")
58def describe() -> None:
59 """Print documentation for all config options."""
60 import inspect
61 from textwrap import indent
62
63 import marimo._config.config as marimo_config
64 from marimo._cli.print import echo, green, muted, yellow
65
66 def format_type_docs(cls: type, indent_level: int = 0) -> str:
67 """Recursively format type documentation."""
68 output: list[str] = []
69 # Get annotations and docs from the class
70 annotations = (
71 cls.__annotations__ if hasattr(cls, "__annotations__") else {}
72 )
73
74 # Get the docstring
75 doc = inspect.getdoc(cls)
76 if doc and indent_level == 0:
77 output.append(muted(f"# {doc}\n"))
78
79 for key, type_hint in annotations.items():
80 # Get field documentation if available
81 if hasattr(type_hint, "__forward_arg__"):
82 type_hint = type_hint.__forward_arg__
83 # Import from marimo._config.config
84 # If NotRequired, we need to get the type from the NotRequired
85 if str(type_hint).startswith("NotRequired["):
86 type_hint = type_hint[12:-1]
87
88 if type_hint in marimo_config.__dict__ and "TypedDict" in str(
89 type(marimo_config.__dict__[type_hint])
90 ):
91 config = marimo_config.__dict__[type_hint]
92 field_output = f"[{green(key)}]"
93 output.append(indent(field_output, " " * indent_level))
94 # Get the docstring for the nested TypedDict
95 nested_doc = inspect.getdoc(config)
96 if nested_doc:
97 output.append(
98 indent(
99 muted(f"# {nested_doc}"),
100 " " * (indent_level + 1),
101 )
102 )
103 output.append("")
104 output.append(
105 indent(
106 format_type_docs(config, indent_level + 1),
107 " " * indent_level,
108 )
109 )
110 elif indent_level == 0:
111 output.append(f"[{green(key)}]")
112 output.append(muted(f"# {type_hint}"))
113 output.append("")
114 else:
115 output.append(

Callers 15

cli.test.tsFile · 0.85
schema.test.tsFile · 0.85
index.test.tsFile · 0.85
python-ast.test.tsFile · 0.85
sql-parser.test.tsFile · 0.85
state.test.tsFile · 0.85

Calls 2

echoFunction · 0.90
format_type_docsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…