Skip to content

Commit 8e68524

Browse files
authored
Quartodoc 0.7.6 (#1636)
1 parent a632159 commit 8e68524

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ clean-build: FORCE
3939
rm -fr dist/
4040
rm -fr .eggs/
4141
find . -name '*.egg-info' -exec rm -fr {} +
42-
find . -name '*.egg' -exec rm -f {} +
42+
find . -name '*.egg' -exec rm -rf {} +
4343

4444
# Remove Python file artifacts
4545
clean-pyc: FORCE

docs/_renderer.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@
99
from typing import Literal, Optional, TypedDict, Union
1010

1111
import quartodoc.ast as qast
12-
from griffe import dataclasses as dc
13-
from griffe import expressions as exp
14-
from griffe.docstrings import dataclasses as ds
12+
from griffe import (
13+
Alias,
14+
DocstringAttribute,
15+
DocstringParameter,
16+
DocstringSectionParameters,
17+
DocstringSectionText,
18+
Expr,
19+
ExprName,
20+
Function,
21+
Object,
22+
)
1523
from plum import dispatch
1624
from quartodoc import MdRenderer
1725
from quartodoc.pandoc.blocks import DefinitionList
@@ -42,7 +50,7 @@ def render(self, el: qast.DocstringSectionSeeAlso):
4250
return prefix_bare_functions_with_func(el.value)
4351

4452
@dispatch
45-
def render(self, el: Union[dc.Object, dc.Alias]):
53+
def render(self, el: Union[Object, Alias]):
4654
# If `el` is a protocol class that only has a `__call__` method,
4755
# then we want to display information about the method, not the class.
4856
if len(el.members) == 1 and "__call__" in el.members.keys():
@@ -78,7 +86,7 @@ def render(self, el: Union[dc.Object, dc.Alias]):
7886
return converted
7987

8088
@dispatch
81-
def render(self, el: ds.DocstringSectionText):
89+
def render(self, el: DocstringSectionText):
8290
# functions like shiny.ui.tags.b have html in their docstrings, so
8391
# we escape them. Note that we are only escaping text sections, but
8492
# since these cover the top text of the docstring, it should solve
@@ -93,7 +101,7 @@ def render_annotation(self, el: str):
93101
# TODO-future; Can be removed once we use quartodoc 0.3.5
94102
# Related: https://github.com/machow/quartodoc/pull/205
95103
@dispatch
96-
def render(self, el: ds.DocstringAttribute):
104+
def render(self, el: DocstringAttribute):
97105
row = [
98106
sanitize(el.name),
99107
self.render_annotation(el.annotation),
@@ -106,23 +114,23 @@ def render_annotation(self, el: None):
106114
return ""
107115

108116
@dispatch
109-
def render_annotation(self, el: exp.Expr):
110-
# an expression is essentially a list[exp.ExprName | str]
117+
def render_annotation(self, el: Expr):
118+
# an expression is essentially a list[ExprName | str]
111119
# e.g. Optional[TagList]
112120
# -> [Name(source="Optional", ...), "[", Name(...), "]"]
113121

114122
return "".join(map(self.render_annotation, el))
115123

116124
@dispatch
117-
def render_annotation(self, el: exp.ExprName):
125+
def render_annotation(self, el: ExprName):
118126
# e.g. Name(source="Optional", full="typing.Optional")
119127
return f"[{el.name}](`{el.canonical_path}`)"
120128

121129
@dispatch
122130
# Overload of `quartodoc.renderers.md_renderer` to fix bug where the descriptions
123131
# are cut off and never display other places. Fixing by always displaying the
124132
# documentation.
125-
def summarize(self, obj: Union[dc.Object, dc.Alias]) -> str:
133+
def summarize(self, obj: Union[Object, Alias]) -> str:
126134
# get high-level description
127135
doc = obj.docstring
128136
if doc is None:
@@ -131,7 +139,7 @@ def summarize(self, obj: Union[dc.Object, dc.Alias]) -> str:
131139
docstring_parts = doc.parsed
132140

133141
if len(docstring_parts) and isinstance(
134-
docstring_parts[0], ds.DocstringSectionText
142+
docstring_parts[0], DocstringSectionText
135143
):
136144
description = docstring_parts[0].value
137145

@@ -164,7 +172,7 @@ def summarize(self, obj: Union[dc.Object, dc.Alias]) -> str:
164172

165173
# Consolidate the parameter type info into a single column
166174
@dispatch
167-
def render(self, el: ds.DocstringParameter):
175+
def render(self, el: DocstringParameter):
168176
param = f'<span class="parameter-name">{el.name}</span>'
169177
annotation = self.render_annotation(el.annotation)
170178
if annotation:
@@ -178,14 +186,14 @@ def render(self, el: ds.DocstringParameter):
178186
return (param, el.description)
179187

180188
@dispatch
181-
def render(self, el: ds.DocstringSectionParameters):
189+
def render(self, el: DocstringSectionParameters):
182190
rows = list(map(self.render, el.value))
183191
# rows is a list of tuples of (<parameter>, <description>)
184192

185193
return str(DefinitionList(rows))
186194

187195
@dispatch
188-
def signature(self, el: dc.Function, source: Optional[dc.Alias] = None):
196+
def signature(self, el: Function, source: Optional[Alias] = None):
189197
if el.name == "__call__":
190198
# Ex: experimental.ui._card.ImgContainer.__call__(self, *args: Tag) -> Tagifiable
191199
sig = super().signature(el, source)
@@ -302,7 +310,7 @@ def is_no_ex_decorator(x):
302310
# Don't throw for things that can't be decorated
303311
return
304312

305-
if not el.is_explicitely_exported:
313+
if not el.is_exported:
306314
# Don't require examples on "implicitly exported" functions
307315
# In practice, this covers methods of exported classes (class still needs ex)
308316
return

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ doc = [
120120
"tabulate",
121121
"shinylive",
122122
"pydantic>=2.7.4",
123-
"quartodoc==0.7.5",
124-
"griffe<1.0.0",
123+
"quartodoc>=0.7.6",
124+
"griffe>=1.1.1",
125125
]
126126

127127
[project.urls]

0 commit comments

Comments
 (0)