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

Add support for singledispatchmethod class methods in MethodDocumenter #11284

Merged
merged 35 commits into from
Mar 14, 2024

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Apr 3, 2023

Fix #11278.
Fix #11531.

Details:

  • Add :classmethod: directive option for @classmethod combined with @singledispatchmethod.
  • Add tests.

There is some decision making to doc for this feature concerning the compatibility for Python versions up to 3.9 (excluded), so I want to get some feedback before merging.

Prior to Python 3.9

Legacy comment

If a method is decorated with @singledispatchmethod and @classmethod, the MethodDocumenter miserably fails to extract the correct signature or docstring. However, in order to properly extract the signature or the docstring, this would require a lot of changes in the sphinx.util.inspect or sphinx.ext.autodoc module which may break other things.

Therefore, I think it would be better to say "autodocumenting a singledispatched classmethod works assuming that Sphinx is running Python 3.9 or later".

@picnixz picnixz force-pushed the fix-11278 branch 2 times, most recently from 8035c62 to a859d30 Compare April 3, 2023 13:43
@picnixz picnixz marked this pull request as draft April 3, 2023 13:48
@picnixz picnixz marked this pull request as ready for review April 5, 2023 09:02
@picnixz picnixz marked this pull request as draft April 18, 2023 17:15
@picnixz picnixz marked this pull request as ready for review April 18, 2023 17:15
@AA-Turner AA-Turner added this to the some future version milestone Apr 29, 2023
@picnixz
Copy link
Member Author

picnixz commented Jul 27, 2023

Since we are dropping 3.8 support, I'll clean this PR when I've got time.

@picnixz picnixz closed this Aug 3, 2023
@picnixz picnixz deleted the fix-11278 branch August 3, 2023 09:26
@picnixz picnixz restored the fix-11278 branch August 3, 2023 09:36
@picnixz picnixz reopened this Aug 3, 2023
@picnixz
Copy link
Member Author

picnixz commented Aug 3, 2023

I wanted to rename some branch but it closed the PR. So I'll stick with an old name.

@picnixz
Copy link
Member Author

picnixz commented Mar 14, 2024

I've had this PR for a long time and nothing has ever changed, so let's merge this one now.

@picnixz picnixz merged commit c86e908 into sphinx-doc:master Mar 14, 2024
22 checks passed
@picnixz picnixz deleted the fix-11278 branch March 14, 2024 11:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants