Closed casperdcl closed 2 years ago
Hey @casperdcl , it appears you're doing some custom docstring preprocessing. Starting with Pydoc-Markdown 4.6.0, it depends on docspec 2.x, where the ApiObject.docstring
is actually a Docstring
object rather than a plain string.
While technically this was already the case in later docspec 1.x versions, the Docstring
class there was a subclass of str
, hoping it would act sufficiently backwards compatible, though actually it caused issues like this: #219
The processor code in Pydoc-Markdown was updated to read and write the documentation string from/to Docstring.content
.
Hope this helps 🤞
yes updated title & description. Now getting an even weirder error.
Also recently I added back automatic formatting of function signature code blocks using Yapf. The issue appears to be an invalid syntax in the function signature. That may be a bug in docspec_python.format_arglist()
.
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/yapf/yapflib/yapf_api.py", line 183, in FormatCode
tree = pytree_utils.ParseCodeToTree(unformatted_source)
File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/yapf/yapflib/pytree_utils.py", line 131, in ParseCodeToTree
raise e
File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/site-packages/yapf/yapflib/pytree_utils.py", line 129, in ParseCodeToTree
ast.parse(code)
File "/opt/hostedtoolcache/Python/3.10.2/x64/lib/python3.10/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "<unknown>", line 2
async def gather(cls, *fs, *, loop=None, timeout=None, total=None, **tqdm_kwargs): pass
^
I'll have time to look into that later today. In the meantime, you can try setting format_code: false
in the MarkdownRenderer
.
EDIT: actually async def gather(cls, *fs, *, loop=None, ...)
is indeed invalid - but I don't know where it comes from. In the codebase it's async def gather(cls, *fs, loop=None, ...)
Hey @casperdcl , if you try again then docspec 2.0.1
should be installed instead of docspec 2.0.0
, and in that newer version the arglist formatting should be fixed.
Great, confirmed working!
Any ideas about the [WARNING - pydoc_markdown.main]: Unknown configuration options
though?
[WARNING - pydoc_markdown.main]: Unknown configuration options:
- $ (ObjectType(pydoc_markdown.PydocMarkdown)) [pydoc-markdown.yml]
- .renderer (UnionType(pydoc_markdown.interfaces.Renderer))
- $ (ObjectType(pydoc_markdown.contrib.renderers.mkdocs.MkdocsRenderer))
- .pages (ListType(ObjectType(pydoc_markdown.util.pages.Page), python_type=Pages))
- .7 (ObjectType(pydoc_markdown.util.pages.Page))
- .children (ListType(ObjectType(pydoc_markdown.util.pages.Page)))
- .0 (ObjectType(pydoc_markdown.util.pages.Page))
- .directory (UnknownType())
Probably refers to this only mention of the "directory" key in your config, and that it is not recognized as a valid key in the configuration.
Environment
Describe the bug
node.docstring
=>node.docstring.content
)There's an odd config warning in all runs.
not sure if related to #246