Skip to content
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

Remove unnecessary paths from Sphinx directives. #132

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

perrygoy
Copy link
Member

@perrygoy perrygoy commented Feb 21, 2024

I just found out yesterday that when you're in the class, you don't need to supply the path to the method! You can just do

:meth:`methodname`

Life-changing. But more life-changing is our decision to document aliases differently, mentioning them in the base class and skipping their documentation in the ... documentation. This PR does both of those things!

@perrygoy perrygoy requested a review from a team February 21, 2024 18:10

.. autoclass:: Either
:members:
:exclude-members: except_, else_, otherwise, alternatively, failing_that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my knowledge; what does this do?

Copy link
Member Author

@perrygoy perrygoy Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tells autodoc-sphinx to not add these methods to the auto-generated documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods are the aliases of the original method, so it will just say the same thing N times, which is very confusing to read in my opinion. We document the aliases in the docstring of the original, so they will show. Here's what it looks like now:
Screenshot 2024-02-22 at 1 15 28 AM
here's what it looks like after the PR:
Screenshot 2024-02-22 at 1 16 10 AM

@bandophahita
Copy link
Contributor

Looks like mypy doesn't currently support aliases this way.

python/mypy#6700

@perrygoy perrygoy merged commit 86f9176 into trunk Apr 30, 2024
24 checks passed
@perrygoy perrygoy deleted the slim-down-sphinx-doc-directives branch April 30, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants