-
-
Notifications
You must be signed in to change notification settings - Fork 167
ENH: Add support for dict show_inherited_class_members #415
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
Conversation
For an example in the wild, this is our current docstring with a bunch of https://mne.tools/dev/generated/mne.Forward.html And this is it with no |
And we actually have a use case where we want to document some subclass methods (from our own mixin classes) but not others (from subclassing dict)... but I'm not sure a good API for this, or how to get autosummary to play nicely with it. |
I'll admit I have to look up how autosummary/autodoc work together every time I think about them so I may be thinking about this completely wrong, but is there a way to generate the stubs via I'm just trying to think of ways to do this with the existing machinery, but I'm no sphinx expert so maybe it isn't possible (or is extra hacky). The approach taken here in conjunction with mne-tools/mne-python#10911 seems like a good way to go about this, so if IYO this is the best way then I think this is reasonable. |
I tried messing with autoclass options and Jinja templates for some time but couldn't make it work that way |
Okay since there are some approvals I'll go ahead and merge, thanks for looking @jarrodmillman @rossbar ! |
) Bumps [numpydoc](https://github.com/numpy/numpydoc) from 1.4.0 to 1.5.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/numpy/numpydoc/blob/main/doc/release_notes.rst">numpydoc's changelog</a>.</em></p> <blockquote> <h2>1.5.0</h2> <p>Release date: 8 October 2022</p> <p>Requires Python 3.7+ and Sphinx 4.2+.</p> <p><code>Full Changelog <https://github.com/numpy/numpydoc/compare/v1.4.0...v1.5.0></code>__</p> <p>Fixed bugs</p> <pre><code> - Parsing ``returns`` section with several types and no name `[#428](numpy/numpydoc#428) <https://github.com/numpy/numpydoc/issues/428>`__ - BUG: Fix returns parsing no name `[#429](numpy/numpydoc#429) <https://github.com/numpy/numpydoc/pull/429>`__ (`rossbar <https://github.com/rossbar>`__) <p>Closed issues </code></pre></p> <ul> <li>readthedocs build failing <code>[#439](numpy/numpydoc#439) <https://github.com/numpy/numpydoc/issues/439></code>__</li> <li>Exclude class properties from being listed under METHODS section <code>[#339](numpy/numpydoc#339) <https://github.com/numpy/numpydoc/issues/339></code>__</li> <li>BUG: Numpydoc doesn’t render attributes decorated with <code>cached\_property</code> in the Attributes section <code>[#432](numpy/numpydoc#432) <https://github.com/numpy/numpydoc/issues/432></code>__</li> <li>Is numpydoc_use_blockquotes deprecated or not yet? <code>[#420](numpy/numpydoc#420) <https://github.com/numpy/numpydoc/issues/420></code>__</li> <li>No light theme available in docs <code>[#413](numpy/numpydoc#413) <https://github.com/numpy/numpydoc/issues/413></code>__</li> <li>1.4.0 release plan <code>[#408](numpy/numpydoc#408) <https://github.com/numpy/numpydoc/issues/408></code>__</li> </ul> <p>Merged pull requests</p> <pre><code> - Update doc requirements `[#441](numpy/numpydoc#441) <https://github.com/numpy/numpydoc/pull/441>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Update pydata-sphinx-theme `[#440](numpy/numpydoc#440) <https://github.com/numpy/numpydoc/pull/440>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Support Python 3.11 `[#438](numpy/numpydoc#438) <https://github.com/numpy/numpydoc/pull/438>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Update precommit hooks `[#437](numpy/numpydoc#437) <https://github.com/numpy/numpydoc/pull/437>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Use Python 3.10 to build docs `[#436](numpy/numpydoc#436) <https://github.com/numpy/numpydoc/pull/436>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Use `requirements/*.txt` files for CI `[#435](numpy/numpydoc#435) <https://github.com/numpy/numpydoc/pull/435>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Fix front page `[#434](numpy/numpydoc#434) <https://github.com/numpy/numpydoc/pull/434>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Add cached property support `[#433](numpy/numpydoc#433) <https://github.com/numpy/numpydoc/pull/433>`__ (`rossbar <https://github.com/rossbar>`__) - ENH: Update validate.py to allow parameters with trailing underscores. `[#425](numpy/numpydoc#425) <https://github.com/numpy/numpydoc/pull/425>`__ (`stefmolin <https://github.com/stefmolin>`__) - DOC: Use ``:ref:`` when referring to section headers `[#424](numpy/numpydoc#424) <https://github.com/numpy/numpydoc/pull/424>`__ (`namurphy <https://github.com/namurphy>`__) - Remove numpydoc_use_blockquotes `[#422](numpy/numpydoc#422) <https://github.com/numpy/numpydoc/pull/422>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Require sphinx>=4.2 (cleanup) `[#421](numpy/numpydoc#421) <https://github.com/numpy/numpydoc/pull/421>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - docs: fix validation include line numbers `[#418](numpy/numpydoc#418) <https://github.com/numpy/numpydoc/pull/418>`__ (`thatlittleboy <https://github.com/thatlittleboy>`__) - Update precommit linters `[#417](numpy/numpydoc#417) <https://github.com/numpy/numpydoc/pull/417>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Update GH actions `[#416](numpy/numpydoc#416) <https://github.com/numpy/numpydoc/pull/416>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - ENH: Add support for dict show_inherited_class_members `[#415](numpy/numpydoc#415) <https://github.com/numpy/numpydoc/pull/415>`__ (`larsoner <https://github.com/larsoner>`__) - DOC: Add theme switcher and default to lightmode. `[#414](numpy/numpydoc#414) <https://github.com/numpy/numpydoc/pull/414>`__ (`rossbar <https://github.com/rossbar>`__) - Require sphinx>=4.2 `[#411](numpy/numpydoc#411) <https://github.com/numpy/numpydoc/pull/411>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) <p>* <em>This Changelog was automatically generated by</em>\ <code>github_changelog_generator &lt;https://github.com/github-changelog-generator/github-changelog-generator&gt;</code>__ </code></pre></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/numpy/numpydoc/commit/3a8a96cda5e04ef77caa076be1fcd115e3987b62"><code>3a8a96c</code></a> Designate 1.5.0 release</li> <li><a href="https://github.com/numpy/numpydoc/commit/c6338c7607355f38c382017e5f492f50e1b44da9"><code>c6338c7</code></a> Update doc requirements (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/441">#441</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/72e9cd4dae1d451ca24f06e0fa7a82285b381139"><code>72e9cd4</code></a> Update pydata-sphinx-theme (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/440">#440</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/8b983feb66ffcbebebe58aa5d10fea6c2a66207f"><code>8b983fe</code></a> Bump version</li> <li><a href="https://github.com/numpy/numpydoc/commit/26cfa5847df5cdd6c0fa49c9be410fdfac2c7afe"><code>26cfa58</code></a> Designate 1.5.0rc1 release</li> <li><a href="https://github.com/numpy/numpydoc/commit/664e7144ece8f0779b18f6282ed7a42e35f130ab"><code>664e714</code></a> Suport Python 3.11 (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/438">#438</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/4c74647afc82a1b352701a52f0f1a33891dbd3ff"><code>4c74647</code></a> Fix front page (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/434">#434</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/ddcf0fea7a68d9f826ed863588ecc494b11d83a4"><code>ddcf0fe</code></a> Add cached property support (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/433">#433</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/94b7a844a8ed956a2fc2f17cf0630ae54af323ea"><code>94b7a84</code></a> Update precommit hooks (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/437">#437</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/db404754f0cd7bb0927280e769bc8c9d95a2e42d"><code>db40475</code></a> Use Python 3.10 to build docs (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/436">#436</a>)</li> <li>Additional commits viewable in <a href="https://github.com/numpy/numpydoc/compare/v1.4.0...v1.5.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…103) Bumps [numpydoc](https://github.com/numpy/numpydoc) from 1.4.0 to 1.5.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/numpy/numpydoc/blob/main/doc/release_notes.rst">numpydoc's changelog</a>.</em></p> <blockquote> <h2>1.5.0</h2> <p>Release date: 8 October 2022</p> <p>Requires Python 3.7+ and Sphinx 4.2+.</p> <p><code>Full Changelog <https://github.com/numpy/numpydoc/compare/v1.4.0...v1.5.0></code>__</p> <p>Fixed bugs</p> <pre><code> - Parsing ``returns`` section with several types and no name `[#428](numpy/numpydoc#428) <https://github.com/numpy/numpydoc/issues/428>`__ - BUG: Fix returns parsing no name `[#429](numpy/numpydoc#429) <https://github.com/numpy/numpydoc/pull/429>`__ (`rossbar <https://github.com/rossbar>`__) <p>Closed issues </code></pre></p> <ul> <li>readthedocs build failing <code>[#439](numpy/numpydoc#439) <https://github.com/numpy/numpydoc/issues/439></code>__</li> <li>Exclude class properties from being listed under METHODS section <code>[#339](numpy/numpydoc#339) <https://github.com/numpy/numpydoc/issues/339></code>__</li> <li>BUG: Numpydoc doesn’t render attributes decorated with <code>cached\_property</code> in the Attributes section <code>[#432](numpy/numpydoc#432) <https://github.com/numpy/numpydoc/issues/432></code>__</li> <li>Is numpydoc_use_blockquotes deprecated or not yet? <code>[#420](numpy/numpydoc#420) <https://github.com/numpy/numpydoc/issues/420></code>__</li> <li>No light theme available in docs <code>[#413](numpy/numpydoc#413) <https://github.com/numpy/numpydoc/issues/413></code>__</li> <li>1.4.0 release plan <code>[#408](numpy/numpydoc#408) <https://github.com/numpy/numpydoc/issues/408></code>__</li> </ul> <p>Merged pull requests</p> <pre><code> - Update doc requirements `[#441](numpy/numpydoc#441) <https://github.com/numpy/numpydoc/pull/441>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Update pydata-sphinx-theme `[#440](numpy/numpydoc#440) <https://github.com/numpy/numpydoc/pull/440>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Support Python 3.11 `[#438](numpy/numpydoc#438) <https://github.com/numpy/numpydoc/pull/438>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Update precommit hooks `[#437](numpy/numpydoc#437) <https://github.com/numpy/numpydoc/pull/437>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Use Python 3.10 to build docs `[#436](numpy/numpydoc#436) <https://github.com/numpy/numpydoc/pull/436>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Use `requirements/*.txt` files for CI `[#435](numpy/numpydoc#435) <https://github.com/numpy/numpydoc/pull/435>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Fix front page `[#434](numpy/numpydoc#434) <https://github.com/numpy/numpydoc/pull/434>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Add cached property support `[#433](numpy/numpydoc#433) <https://github.com/numpy/numpydoc/pull/433>`__ (`rossbar <https://github.com/rossbar>`__) - ENH: Update validate.py to allow parameters with trailing underscores. `[#425](numpy/numpydoc#425) <https://github.com/numpy/numpydoc/pull/425>`__ (`stefmolin <https://github.com/stefmolin>`__) - DOC: Use ``:ref:`` when referring to section headers `[#424](numpy/numpydoc#424) <https://github.com/numpy/numpydoc/pull/424>`__ (`namurphy <https://github.com/namurphy>`__) - Remove numpydoc_use_blockquotes `[#422](numpy/numpydoc#422) <https://github.com/numpy/numpydoc/pull/422>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Require sphinx>=4.2 (cleanup) `[#421](numpy/numpydoc#421) <https://github.com/numpy/numpydoc/pull/421>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - docs: fix validation include line numbers `[#418](numpy/numpydoc#418) <https://github.com/numpy/numpydoc/pull/418>`__ (`thatlittleboy <https://github.com/thatlittleboy>`__) - Update precommit linters `[#417](numpy/numpydoc#417) <https://github.com/numpy/numpydoc/pull/417>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - Update GH actions `[#416](numpy/numpydoc#416) <https://github.com/numpy/numpydoc/pull/416>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) - ENH: Add support for dict show_inherited_class_members `[#415](numpy/numpydoc#415) <https://github.com/numpy/numpydoc/pull/415>`__ (`larsoner <https://github.com/larsoner>`__) - DOC: Add theme switcher and default to lightmode. `[#414](numpy/numpydoc#414) <https://github.com/numpy/numpydoc/pull/414>`__ (`rossbar <https://github.com/rossbar>`__) - Require sphinx>=4.2 `[#411](numpy/numpydoc#411) <https://github.com/numpy/numpydoc/pull/411>`__ (`jarrodmillman <https://github.com/jarrodmillman>`__) <p>* <em>This Changelog was automatically generated by</em>\ <code>github_changelog_generator &lt;https://github.com/github-changelog-generator/github-changelog-generator&gt;</code>__ </code></pre></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/numpy/numpydoc/commit/3a8a96cda5e04ef77caa076be1fcd115e3987b62"><code>3a8a96c</code></a> Designate 1.5.0 release</li> <li><a href="https://github.com/numpy/numpydoc/commit/c6338c7607355f38c382017e5f492f50e1b44da9"><code>c6338c7</code></a> Update doc requirements (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/441">#441</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/72e9cd4dae1d451ca24f06e0fa7a82285b381139"><code>72e9cd4</code></a> Update pydata-sphinx-theme (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/440">#440</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/8b983feb66ffcbebebe58aa5d10fea6c2a66207f"><code>8b983fe</code></a> Bump version</li> <li><a href="https://github.com/numpy/numpydoc/commit/26cfa5847df5cdd6c0fa49c9be410fdfac2c7afe"><code>26cfa58</code></a> Designate 1.5.0rc1 release</li> <li><a href="https://github.com/numpy/numpydoc/commit/664e7144ece8f0779b18f6282ed7a42e35f130ab"><code>664e714</code></a> Suport Python 3.11 (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/438">#438</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/4c74647afc82a1b352701a52f0f1a33891dbd3ff"><code>4c74647</code></a> Fix front page (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/434">#434</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/ddcf0fea7a68d9f826ed863588ecc494b11d83a4"><code>ddcf0fe</code></a> Add cached property support (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/433">#433</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/94b7a844a8ed956a2fc2f17cf0630ae54af323ea"><code>94b7a84</code></a> Update precommit hooks (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/437">#437</a>)</li> <li><a href="https://github.com/numpy/numpydoc/commit/db404754f0cd7bb0927280e769bc8c9d95a2e42d"><code>db40475</code></a> Use Python 3.10 to build docs (<a href="https://github-redirect.dependabot.com/numpy/numpydoc/issues/436">#436</a>)</li> <li>Additional commits viewable in <a href="https://github.com/numpy/numpydoc/compare/v1.4.0...v1.5.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Over in MNE-Python we subclass some standard types like
list
anddict
(I know, not a recommended practice) and for these few cases we don't want to show inherited class members. For all other classes, we do.This PR adds support for
numpydoc_show_inherited_class_members
as a dict allowing mapping on an individual-class-name basis.If people agree this is a reasonable way to go, I'll add a test then it should be good to go.I was hoping just adding
:no-inherited-members:
to a new autosummary templateclass_no_inherited_members.rst
and using it for the few classes where I need it would be enough, but I don't see a way to get/see this switch inside NumpyDoc.