-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Crossreferences to standard library in mypy docs, part 4 #7685
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ Using installed packages | |
======================== | ||
|
||
:pep:`561` specifies how to mark a package as supporting type checking. | ||
Below is a summary of how to create :pep:`561` compatible packages and have | ||
Below is a summary of how to create PEP 561 compatible packages and have | ||
mypy use them in type checking. | ||
|
||
Using :pep:`561` compatible packages with mypy | ||
********************************************** | ||
Using PEP 561 compatible packages with mypy | ||
******************************************* | ||
|
||
Generally, you do not need to do anything to use installed packages that | ||
support typing for the Python executable used to run mypy. Note that most | ||
|
@@ -36,8 +36,8 @@ to find the package, it must be installed. For a package ``foo``, the name of | |
the stub-only package (``foo-stubs``) is not a legal package name, so mypy | ||
will not find it, unless it is installed. | ||
|
||
Making :pep:`561` compatible packages | ||
************************************* | ||
Making PEP 561 compatible packages | ||
********************************** | ||
|
||
:pep:`561` notes three main ways to distribute type information. The first is a | ||
package that has only inline type annotations in the code itself. The second is | ||
|
@@ -60,7 +60,7 @@ structure as follows | |
lib.py | ||
py.typed | ||
|
||
the setup.py might look like | ||
the ``setup.py`` might look like | ||
|
||
.. code-block:: python | ||
|
||
|
@@ -76,7 +76,7 @@ the setup.py might look like | |
|
||
.. note:: | ||
|
||
If you use setuptools, you must pass the option ``zip_safe=False`` to | ||
If you use :doc:`setuptools <setuptools:index>`, you must pass the option ``zip_safe=False`` to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another external library is mentioned here that can be referenced as well. |
||
``setup()``, or mypy will not be able to find the installed package. | ||
|
||
Some packages have a mix of stub files and runtime files. These packages also | ||
|
@@ -91,7 +91,7 @@ require a ``py.typed`` file. An example can be seen below | |
lib.pyi | ||
py.typed | ||
|
||
the setup.py might look like: | ||
the ``setup.py`` might look like: | ||
|
||
.. code-block:: python | ||
|
||
|
@@ -121,7 +121,7 @@ had stubs for ``package_c``, we might do the following: | |
__init__.pyi | ||
lib.pyi | ||
|
||
the setup.py might look like: | ||
the ``setup.py`` might look like: | ||
|
||
.. code-block:: python | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ annotations are just hints for mypy and don't interfere when running your progra | |
You run your program with a standard Python interpreter, and the annotations | ||
are treated effectively as comments. | ||
|
||
Using the Python 3 function annotation syntax (using the :pep`484` notation) or | ||
Using the Python 3 function annotation syntax (using the :pep:`484` notation) or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another error of mine from a previous PR... |
||
a comment-based annotation syntax for Python 2 code, you will be able to | ||
efficiently annotate your code and use mypy to check the code for common | ||
errors. Mypy has a powerful and easy-to-use type system with modern features | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvanrossum keeping your advice in mind in this code example:
mypy/docs/source/generics.rst
Lines 460 to 463 in 9614518
I have added the
code-block
directives here as well.