sphinx-doc / sphinx-doc/sphinx

Remove a docstring from members of namedtuple

Open
#7,353 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:autodoc type:enhancement
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
All members of namedtuple have a similar docstring: "Alias for field number N".

$ python
Python 3.8.1 (default, Feb 13 2020, 13:34:23)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import namedtuple
>>>
>>> Coordinate = namedtuple('Coordinate', 'X Y')
>>> Coordinate.__doc__
'Coordinate(X, Y)'
>>> Coordinate.X.__doc__
'Alias for field number 0'
>>> Coordinate.Y.__doc__
'Alias for field number 1'

This would be helpful for online document tool like help(). But it is a bit redundant for the built document.
https___qiita-image-store s3 ap-northeast-1 amazonaws com_0_57661_68445eb3-ff98-dbb9-d844-e5f2aac31139

Describe the solution you'd like
Remove a docstring from members of namedtuple.

Describe alternatives you've considered
N/A

Additional context
refs: https://chrisdown.name/2015/09/20/removing-namedtuple-docstrings-from-sphinx.html

  • [e.g. URL or Ticket]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the Python namedtuple example and trace how Sphinx documents namedtuple members; done should mean the generated member docstrings are omitted while the namedtuple class documentation remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.