Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring signature in method or function signature is ignored if overloads present #10436

Open
laurensvalk opened this issue May 9, 2022 · 2 comments

Comments

@laurensvalk
Copy link

laurensvalk commented May 9, 2022

Describe the bug

When a method or function has overloads, the signature(s) in the docstrings are ignored.

The behavior is already correct for classes (__init__), but not for methods and functions.

See screenshot below for a visual description.

Context: we use overloads for correct type hints, but we use the docstrings to create human-readable documentation.

How to Reproduce

This is a minimal repo created for several Sphinx bug reports.

RTD-theme and napoleon are enabled, but it is also reproducable without them.

$ git clone https://github.com/pybricks/sphinx-issues-minimal
$ cd sphinx-issues-minimal
# Optional if you don't have Sphinx dev version and RTD theme  1.0.0 already:
# poetry install
$ make clean html
$ # Open build/html/bugs.html to see above output
$ # See src/bugs/__init__.py for the offending Python source code

Expected behavior

The behavior in the __init__ is correct. Expect the same in methods.

Context: we use overloads for correct type hints, but we use the docstrings to create human-readable documentation.

Your project

https://github.com/pybricks/sphinx-issues-minimal

Screenshots

image

OS

Ubuntu

Python version

3.8.3

Sphinx version

5.0 / 5.1.0b1 / 1222bed

Sphinx extensions

'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx_rtd_theme'

Extra tools

No response

Additional context

No response

@AA-Turner
Copy link
Member

@laurensvalk there is no Sphinx 5.1! Are you using 4.5, or the beta of 5.0?

A

@laurensvalk
Copy link
Author

laurensvalk commented May 9, 2022

I used 5.1b0, which got pushed yesterday. I used the latest master branch to make sure it wasn't already fixed.

The same issue happens in 4.4 though.

laurensvalk added a commit to pybricks/sphinx that referenced this issue May 27, 2022
laurensvalk added a commit to pybricks/sphinx that referenced this issue May 27, 2022
@AA-Turner AA-Turner added this to the some future version milestone Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants