Non-functions in the `See Also` section

オープン
#618 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
documentation

調査の方向性

numpydoc.docscrape と、issue に示されている FunctionDoc のラウンドトリップから始め、タグ付けされていない numpy.logaddexp の例を使用します。See Also エントリに :func: タグが付与される仕組みを追跡し、ラウンドトリップによって関数ではないオブジェクトへの参照が保持され、py:data オブジェクトとして正しくレンダリングされることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
354
フォーク
185
平均マージ
4分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

numpy/numpydoc のほかの issue

numpy/numpydoc の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。