-
-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Description
Describe the bug
separate_signature: true
black formatting is broken with griffe 0.32.0. I created a minimal reproducer in https://github.com/gotmax23/mkdocstrings-python-reproducer.
To Reproduce
Steps to reproduce the behavior:
- git clone https://github.com/gotmax23/mkdocstrings-python-reproducer.git
- Run
nox -e "build(version='broken')"
to build with the latest griffe that's broken - Run
nox -e "build(version='functional')"
to build withgriffe < 0.32.0
The mkdocs page contains API docs for a single function in https://github.com/gotmax23/mkdocstrings-python-reproducer/blob/main/tester.py.
Expected behavior
A successful build with griffe 0.32.1.
Actual behavior
Traceback (most recent call last):
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/bin/mkdocs", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocs/__main__.py", line 250, in build_command
build.build(cfg, dirty=not clean)
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocs/commands/build.py", line 308, in build
_populate_page(file.page, config, files, dirty)
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocs/commands/build.py", line 181, in _populate_page
page.render(config, files)
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocs/structure/pages.py", line 270, in render
self.content = md.convert(self.markdown)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/markdown/core.py", line 264, in convert
root = self.parser.parseDocument(self.lines).getroot()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/markdown/blockparser.py", line 90, in parseDocument
self.parseChunk(self.root, '\n'.join(lines))
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/markdown/blockparser.py", line 105, in parseChunk
self.parseBlocks(parent, text.split('\n\n'))
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/markdown/blockparser.py", line 123, in parseBlocks
if processor.run(parent, blocks) is not False:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings/extension.py", line 127, in run
html, handler, data = self._process_block(identifier, block, heading_level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings/extension.py", line 213, in _process_block
rendered = handler.render(data, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/handler.py", line 328, in render
return template.render(
^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/module.html", line 1, in top-level template code
{% extends "_base/module.html" %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/_base/module.html", line 55, in top-level template code
{% block contents scoped %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/_base/module.html", line 62, in block 'contents'
{% block children scoped %}
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/_base/module.html", line 66, in block 'children'
{% include "children.html" with context %}
^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/children.html", line 1, in top-level template code
{% extends "_base/children.html" %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/_base/children.html", line 76, in top-level template code
{% include function|get_template with context %}
^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/function.html", line 1, in top-level template code
{% extends "_base/function.html" %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/_base/function.html", line 45, in top-level template code
{% block signature scoped %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/templates/material/_base/function.html", line 47, in block 'signature'
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/rendering.py", line 105, in do_format_signature
signature = _format_signature(callable_path, signature, line_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/rendering.py", line 76, in _format_signature
formatted = formatter(formatable, line_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gotmax/dev/repros/mkdocstrings-python/.nox/build-version-broken/lib/python3.11/site-packages/mkdocstrings_handlers/python/rendering.py", line 266, in formatter
return format_str(code, mode=mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "src/black/__init__.py", line 1085, in format_str
File "src/black/__init__.py", line 1095, in _format_str_once
File "src/black/parsing.py", line 100, in lib2to3_parse
black.parsing.InvalidInput: Cannot parse: 1:50: def xxx(schemes: Collection[str] | None = 'http', 'ftp', 'file', 'https') -> str | None: pass
System (please complete the following information):
mkdocstrings-python
version: 1.2.0- Python version: 3.11
- OS: Linux
Metadata
Metadata
Assignees
Labels
No labels