Skip to content

Crossreferences to standard library in mypy docs #7652

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

Merged
merged 6 commits into from
Oct 8, 2019

Conversation

hoefling
Copy link
Contributor

@hoefling hoefling commented Oct 7, 2019

Added references to the following documents:

  • additional_features.rst
  • casts.rst
  • class_basics.rst
  • command_line.rst

This is part of splitting up the changes in #7624 into more readable PRs.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Thanks! Just two actionable nits.

have imprecise (too permissive) types. This will be fixed in future releases.

Mypy does not yet recognize aliases of ``dataclasses.dataclass``, and will
Mypy does not yet recognize aliases of :py:func:`dataclasses.dataclass`, and will
Copy link
Member

Choose a reason for hiding this comment

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

This one causes is a regression in rendering IMO. The :py:func: version gets rendered with a trailing () pair, while the original gets rendered without it. Since an alias to a function does not involve calling it, IMO it should be rendered without (). (Maybe one of the other :py: things link the same way but render without ()?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dang, missed that. Sure, the proper ref here would be

:py:func:`dataclasses.dataclass <dataclasses.dataclass>`

Will fix that!

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

LG! Will merge.

BTW What does the ~ in ~typing.Optional do?

@gvanrossum gvanrossum merged commit f86b422 into python:master Oct 8, 2019
@hoefling
Copy link
Contributor Author

hoefling commented Oct 8, 2019

The tilde removes the dotted path in the rendered text. E.g.

:py:class:`foo.bar.baz.Spam`

will render as foo.bar.baz.Spam, while

:py:class:`~foo.bar.baz.Spam`

will render as just Spam. However, the link will be identical in both cases.

@hoefling hoefling deleted the stdlib-crossref-1 branch October 8, 2019 23:15
JukkaL pushed a commit that referenced this pull request Jul 31, 2020
This adds crossrefs to the docs, a follow-up of #7652 (crossrefs to standard 
library items) and #7784 (crossrefs for command line options), only now for 
the config file values.

Signed-off-by: Oleg Höfling <[email protected]>
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.

2 participants