jbms / sphinx-immaterial

Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
https://jbms.github.io/sphinx-immaterial/
Other
177 stars 28 forks source link

Sphinx will have better support for multi-line python signatures. #265

Closed 2bndy5 closed 11 months ago

2bndy5 commented 1 year ago

I was just notified of an error when building with Sphinx (master branch):

Exception occurred:
  File "/home/mg/git/sphinx/sphinx/domains/python.py", line 575, in handle_signature
    signode += _parse_arglist(arglist, self.env, multi_line_parameter_list)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _monkey_patch_python_parse_arglist.<locals>.parse_arglist() takes from 1 to 2 positional arguments but 3 were given

This stems from https://github.com/sphinx-doc/sphinx/commit/86b07d4a97a225e79150d14e25a768ebc4c087cc

Concerns the monkey_patch for default values to args: https://github.com/jbms/sphinx-immaterial/blob/f5e3213c511e4960aa5b4758b92de4652d1807c0/sphinx_immaterial/apidoc/python/style_default_values_as_code.py#L9-L16

2bndy5 commented 11 months ago

This specific to sphinx v7.1.0

pradyunsg commented 11 months ago

FWIW, the Sphinx-side changes influence C, C++, JS and Python.

jbms commented 11 months ago

I think we will at least need some css changes to just directly support this option.

This theme has two forms of signature line wrapping:

They are basically independent, so we could remove the simple wrapping and leave the clang-format wrapping.

Our feature does have the advantage that it can be more selectively applied since it is configured using our object description options mechanism.

2bndy5 commented 11 months ago

we could remove the simple wrapping and leave the clang-format wrapping.

I'm leaning towards this idea. Better to rely on functionality in sphinx than maintain our hacky (monkeypatched) workaround with CSS.