Skip to content

Crossreferences to standard library in mypy docs, part 3 #7677

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 3 commits into from
Oct 10, 2019

Conversation

hoefling
Copy link
Contributor

@hoefling hoefling commented Oct 9, 2019

Added references to the following documents:

  • error_code_list.rst
  • error_code_list2.rst
  • extending_mypy.rst
  • faq.rst
  • final_attrs.rst
  • getting_started.rst

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

@@ -415,11 +415,11 @@ Example:
# Error: Dict entry 0 has incompatible type "str": "str"; expected "str": "int" [dict-item]
d: Dict[str, int] = {'key': 'value'}

Check TypedDict items [typeddict-item]
--------------------------------------
Check ``TypedDict`` items [typeddict-item]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please advise whether verbatim texts in section headers are useful. This renders as:

image

The side effect is also verbatim text in the table of contents:

image

Copy link
Member

Choose a reason for hiding this comment

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

I think it looks better without the heavy formatting. TBH I find most CSS styling for code blocks over the top, and red is particularly bad in a heading. I also don't care about the box (or shading in other CSS setups).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. IMO the best solution is simply use monospaced font for verbatim formatting like Python stdlib docs do that (and afaik Javadoc too). If you don't mind, I will also replace other occurences of verbatim text in section titles in this PR.


**get_attribute_hook** overrides instance member field lookups and property
**get_attribute_hook()** overrides instance member field lookups and property
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All other paragraphs use parentheses in hook names, I suppose they were omitted by mistake here.

Copy link
Member

Choose a reason for hiding this comment

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

+1

module. For example, to indicate that some function can accept a list of
strings, use the ``List`` type from the ``typing`` module:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Second change unrelated to referencing. IMO with the List reference, there's no need to mention the module again - it's also referenced one line above that. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

+1

(PS. When commenting on a diff chunk, please attach the comment to the last line, so the context in email or in the Conversation view is clearer. I think you can now also shift-click to attach a comment to a range of lines.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it!

@@ -164,7 +163,7 @@ monkey patching of methods.
How is mypy different from Cython?
**********************************

`Cython :doc:<cython:index>` is a variant of Python that supports
:doc:`Cython <cython:index>` is a variant of Python that supports
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing my own errors here. No idea why Sphinx didn't catch this on build.

Copy link
Member

Choose a reason for hiding this comment

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

Didn't you have to run it with special flags to check errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did (using sphinx-build -WEan), however Sphinx ignores markup errors and just renders the text as-is. Neither does doc8 nor restructuredtext-lint, sadly.

@@ -98,7 +98,7 @@ High-level overview
*******************

Every entry point function should accept a single string argument
that is a full mypy version and return a subclass of ``mypy.plugins.Plugin``:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One of two changes in this PR that are not related to referencing, typo fix.

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.

Didn't mean to send every comment as a separate email. And I'm not done, but wanted to reply to all your questions first.

module. For example, to indicate that some function can accept a list of
strings, use the ``List`` type from the ``typing`` module:
Copy link
Member

Choose a reason for hiding this comment

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

+1

(PS. When commenting on a diff chunk, please attach the comment to the last line, so the context in email or in the Conversation view is clearer. I think you can now also shift-click to attach a comment to a range of lines.)

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.

Looks good, except I think you should get rid of all the code markup in headings.

@@ -164,7 +163,7 @@ monkey patching of methods.
How is mypy different from Cython?
**********************************

`Cython :doc:<cython:index>` is a variant of Python that supports
:doc:`Cython <cython:index>` is a variant of Python that supports
Copy link
Member

Choose a reason for hiding this comment

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

Didn't you have to run it with special flags to check errors?

Signed-off-by: Oleg Höfling <[email protected]>
@gvanrossum gvanrossum merged commit 742d33a into python:master Oct 10, 2019
@hoefling hoefling deleted the stdlib-crossref-3 branch October 10, 2019 21:36
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