sphinx-doc / sphinx-doc/sphinx
special-members doesn't work
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I have a class histogram with a method __eq__, which I'd like to document.
When I write
.. autoclass:: histogram
:members:
:special-members: __eq__
it doesn't work (no such method appears in the documentation). I tried to add __eq__ to the list of :members: as suggested here, but it didn't work.
However, when I use a directive .. automethod::, it works, which looks like a bug. This works:
.. autoclass:: histogram
:members:
.. automethod:: __eq__
How to Reproduce
$ git clone https://github.com/ynikitenko/lena
$ cd lena
$ pip install -r requirements.txt
$ cd docs
$ # change the file
$ vi sources/structures.py +55
$ make html
$ # open _build/html/index and see that it works / doesn't work
Expected behavior
special-members should work.
Your project
https://github.com/ynikitenko/lena
Screenshots
No response
OS
Arch Linux, 5.10.75-1-lts
Python version
3.9.7
Sphinx version
3.4.0
Sphinx extensions
'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.coverage', 'sphinx.ext.graphviz', 'sphinx.ext.mathjax', 'sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinxcontrib.napoleon',
Extra tools
No response
Additional context
Currently my readthedocs pages don't work because of another bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the lena documentation using sources/structures.py, the autoclass directive, and :special-members: eq, then compare it with the working nested automethod example. Run make html and inspect the generated documentation; done means eq appears when requested through special-members.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100