numpy / numpy/numpydoc

Non-functions in the `See Also` section

Open
#618 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
355
Forks
181
Avg merge
1d 9h
Merged PRs (30d)
3

Description

The See Also section should be explicitly allowed to contain references to any object.

The current situation is murky:

  • The documentation exclusively mentions functions, without explicitly ruling out other entities.
    https://numpydoc.readthedocs.io/en/latest/format.html#see-also
  • numpydoc parses untagged entries in the section to match anything
  • numpydoc.docscrape automatically adds the :func: tag to untagged entries, but otherwise accepts other entries.

This causes problems for example with https://github.com/numpy/numpy/issues/28734.
This works with intersphinx:


def f():
    """
    See Also
    --------
    numpy.logaddexp
    """

However, a round-trip through docscrape breaks it:


def f():
    """
    See Also
    --------
    numpy.logaddexp
    """

from numpydoc.docscrape import FunctionDoc
f.__doc__ = str(FunctionDoc(f))

Now f.__doc__ has been changed to

.. function:: f
    




See Also
--------

:func:`numpy.logaddexp`
    ..

Which encroaches on https://github.com/numpy/numpy/issues/28734 and breaks the rendering, because numpy.logaddexp is actually a py:data object.

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

Start with numpydoc.docscrape and the FunctionDoc round-trip shown in the issue, using the untagged numpy.logaddexp example. Trace how See Also entries receive the :func: tag and verify that a round-trip preserves references to non-function objects and renders correctly as a py:data object.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.