-
Notifications
You must be signed in to change notification settings - Fork 258
Initial full TOC structure for typing docs content #919
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
**************** | ||
Type Annotations | ||
**************** | ||
|
||
Functions | ||
========= | ||
|
||
Parameters | ||
---------- | ||
|
||
Asynchronous Functions | ||
---------------------- | ||
|
||
Generators | ||
---------- | ||
|
||
Lambdas | ||
------- | ||
|
||
|
||
Classes | ||
======= | ||
|
||
Overloads and Overrides | ||
----------------------- | ||
|
||
Instance vs. Class Attributes | ||
----------------------------- | ||
|
||
Final attributes | ||
---------------- | ||
|
||
Abstract base classes | ||
--------------------- | ||
|
||
|
||
Globals | ||
======= | ||
|
||
|
||
Attributes | ||
========== | ||
|
||
|
||
Locals | ||
====== | ||
|
||
Empty Containers | ||
---------------- | ||
|
||
|
||
Runtime Considerations | ||
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. If it's useful, I recently rewrote mypy's documentation for this: https://mypy.readthedocs.io/en/latest/runtime_troubles.html |
||
====================== | ||
|
||
Comment vs. Inline Support | ||
-------------------------- | ||
|
||
Forward References | ||
------------------ | ||
|
||
Generic types that don't implement `__getitem__` | ||
------------------------------------------------ | ||
|
||
Conditioning on static type checking | ||
------------------------------------ | ||
|
||
from `__future__` import annotations | ||
------------------------------------ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
********** | ||
The Basics | ||
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. mypy's cheat sheet (https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html) is the most visited page in mypy's documentation, I'm assuming this will be something similar? |
||
********** |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
************************** | ||
Libraries and Dependencies | ||
************************** | ||
|
||
:doc:`libraries` | ||
|
||
Typeshed | ||
======== | ||
|
||
|
||
Placeholder Stubs | ||
================= |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
************************** | ||
Frequently Asked Questions | ||
************************** | ||
|
||
|
||
Why Types? | ||
========== | ||
|
||
|
||
Unsupported Python Features | ||
=========================== | ||
|
||
|
||
Common Errors | ||
============= | ||
|
||
|
||
Typing PEPs | ||
=========== | ||
|
||
|
||
Relevant Talks and Resources | ||
============================ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
************** | ||
Type Inference | ||
************** | ||
|
||
Rules for local inference | ||
========================= | ||
|
||
Explicit vs. Implicit Local Types | ||
--------------------------------- | ||
|
||
Changing Types | ||
============== | ||
|
||
Asserts | ||
------- | ||
|
||
Casts | ||
----- | ||
|
||
Type Guards | ||
----------- | ||
|
||
|
||
Protocols and Duck Typing | ||
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. I assume this is where we cover int <: float <: complex and the other special cases? |
||
========================= | ||
|
||
Callback Protocols | ||
------------------ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
******************************* | ||
Introduction to Types in Python | ||
******************************* | ||
|
||
|
||
Background | ||
========== | ||
|
||
How to read type annotations | ||
---------------------------- | ||
|
||
When and why types are useful | ||
----------------------------- | ||
|
||
|
||
Gradual Typing: Static Types in a Dynamic Language | ||
================================================== | ||
|
||
Opt-in type checking | ||
-------------------- | ||
|
||
Type stubs | ||
---------- | ||
|
||
:doc:`stubs` | ||
|
||
Strategies for increasing coverage | ||
---------------------------------- | ||
|
||
|
||
Getting Started | ||
=============== | ||
|
||
Python type checkers | ||
-------------------- | ||
|
||
How to annotate an existing codebase | ||
------------------------------------ | ||
|
||
Typeshed | ||
-------- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.. _libraries: | ||
|
||
*********************** | ||
Typing Python Libraries | ||
*********************** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
********************* | ||
Type System Reference | ||
********************* | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
basics | ||
type_system | ||
annotations | ||
inference | ||
type_compatibility | ||
dependencies | ||
faq |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
****************** | ||
Type Compatibility | ||
****************** | ||
|
||
|
||
The Class Hierarchy | ||
=================== | ||
|
||
Mutable Containers | ||
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. It might make sense to move the section to where we introduce generics, since it's hard to have any discussion of variance without examples. |
||
------------------ | ||
|
||
Comparing Callables: Covariance and Contravariance | ||
-------------------------------------------------- | ||
|
||
|
||
Metaclasses | ||
=========== |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
*************** | ||
The Type System | ||
*************** | ||
|
||
Built-in Types | ||
============== | ||
|
||
`typing Module Documentation <https://docs.python.org/3/library/typing.html>`__ | ||
|
||
Built-in Primitives | ||
------------------- | ||
|
||
Built-in operators | ||
------------------ | ||
|
||
Advanced Types | ||
-------------- | ||
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. I'm guessing Literal goes in here? |
||
|
||
|
||
Simple User-Defined Types | ||
========================= | ||
|
||
|
||
Type Aliases | ||
============ | ||
|
||
Recursive Aliases | ||
----------------- | ||
|
||
|
||
Data Structures | ||
=============== | ||
|
||
Typed Dictionary | ||
---------------- | ||
|
||
Dataclass | ||
--------- | ||
|
||
|
||
Generic Types | ||
============= | ||
|
||
|
||
Type Variables | ||
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. Maybe type variables should be introduced before generic types? |
||
============== | ||
|
||
TypeVar | ||
------- | ||
|
||
Variadics | ||
--------- | ||
|
||
ParamSpec | ||
^^^^^^^^^ | ||
|
||
TypeVarTuple | ||
^^^^^^^^^^^^ |
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.
Overloads feels more functions-y, is overrides meant to talk about Liskov Substitution Principle? Potentially worth separating