Skip to content

Commit 540d29c

Browse files
authored
Merge pull request #304 from has2k1/upgrade-griffe
chore: bump griffe to >=0.33
2 parents 1f4f9f3 + 3fcafc8 commit 540d29c

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dynamic = ["version"]
3232
requires-python = ">=3.9"
3333
dependencies = [
3434
"click",
35-
"griffe <= 0.32.3",
35+
"griffe >= 0.33",
3636
"sphobjinv >= 2.3.1",
3737
"tabulate >= 0.9.0",
3838
"importlib-metadata >= 5.1.0",

quartodoc/renderers/md_renderer.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from functools import wraps
77
from griffe.docstrings import dataclasses as ds
88
from griffe import dataclasses as dc
9+
from griffe import expressions as expr
910
from tabulate import tabulate
1011
from plum import dispatch
1112
from typing import Tuple, Union, Optional
@@ -14,13 +15,6 @@
1415
from .base import Renderer, escape, sanitize, convert_rst_link_to_md
1516

1617

17-
try:
18-
# Name and Expression were moved to expressions in v0.28
19-
from griffe import expressions as expr
20-
except ImportError:
21-
from griffe import dataclasses as expr
22-
23-
2418
def _has_attr_section(el: dc.Docstring | None):
2519
if el is None:
2620
return False
@@ -130,16 +124,16 @@ def render_annotation(self, el: None) -> str:
130124
return ""
131125

132126
@dispatch
133-
def render_annotation(self, el: expr.Name) -> str:
127+
def render_annotation(self, el: expr.ExprName) -> str:
134128
# TODO: maybe there is a way to get tabulate to handle this?
135129
# unescaped pipes screw up table formatting
136130
if self.render_interlinks:
137-
return f"[{sanitize(el.source)}](`{el.full}`)"
131+
return f"[{sanitize(el.name)}](`{el.canonical_path}`)"
138132

139-
return sanitize(el.source)
133+
return sanitize(el.canonical_path)
140134

141135
@dispatch
142-
def render_annotation(self, el: expr.Expression) -> str:
136+
def render_annotation(self, el: expr.Expr) -> str:
143137
return "".join(map(self.render_annotation, el))
144138

145139
# signature method --------------------------------------------------------

quartodoc/tests/test_renderers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_render_doc_attribute(renderer):
9494
attr = ds.DocstringAttribute(
9595
name="abc",
9696
description="xyz",
97-
annotation=exp.Expression(exp.Name("Optional", full="Optional"), "[", "]"),
97+
annotation=exp.ExprSubscript(exp.ExprName("Optional"), ""),
9898
value=1,
9999
)
100100

0 commit comments

Comments
 (0)