Skip to content

Commit 80cfad0

Browse files
authored
Initial full TOC structure for typing docs content (#919)
1 parent ad6d085 commit 80cfad0

11 files changed

+273
-3
lines changed

docs/index.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ Static Typing with Python
66
:maxdepth: 2
77
:caption: Contents:
88

9-
typing Module Documentation <https://docs.python.org/3/library/typing.html>
10-
source/libraries
11-
source/stubs
9+
source/introduction
10+
11+
.. toctree::
12+
:maxdepth: 3
13+
14+
source/reference
1215

1316

1417
Indices and tables

docs/source/annotations.rst

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
****************
2+
Type Annotations
3+
****************
4+
5+
Functions
6+
=========
7+
8+
Parameters
9+
----------
10+
11+
Asynchronous Functions
12+
----------------------
13+
14+
Generators
15+
----------
16+
17+
Lambdas
18+
-------
19+
20+
21+
Classes
22+
=======
23+
24+
Overloads and Overrides
25+
-----------------------
26+
27+
Instance vs. Class Attributes
28+
-----------------------------
29+
30+
Final attributes
31+
----------------
32+
33+
Abstract base classes
34+
---------------------
35+
36+
37+
Globals
38+
=======
39+
40+
41+
Attributes
42+
==========
43+
44+
45+
Locals
46+
======
47+
48+
Empty Containers
49+
----------------
50+
51+
52+
Runtime Considerations
53+
======================
54+
55+
Comment vs. Inline Support
56+
--------------------------
57+
58+
Forward References
59+
------------------
60+
61+
Generic types that don't implement `__getitem__`
62+
------------------------------------------------
63+
64+
Conditioning on static type checking
65+
------------------------------------
66+
67+
from `__future__` import annotations
68+
------------------------------------

docs/source/basics.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**********
2+
The Basics
3+
**********

docs/source/dependencies.rst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**************************
2+
Libraries and Dependencies
3+
**************************
4+
5+
:doc:`libraries`
6+
7+
Typeshed
8+
========
9+
10+
11+
Placeholder Stubs
12+
=================

docs/source/faq.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**************************
2+
Frequently Asked Questions
3+
**************************
4+
5+
6+
Why Types?
7+
==========
8+
9+
10+
Unsupported Python Features
11+
===========================
12+
13+
14+
Common Errors
15+
=============
16+
17+
18+
Typing PEPs
19+
===========
20+
21+
22+
Relevant Talks and Resources
23+
============================

docs/source/inference.rst

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
**************
2+
Type Inference
3+
**************
4+
5+
Rules for local inference
6+
=========================
7+
8+
Explicit vs. Implicit Local Types
9+
---------------------------------
10+
11+
Changing Types
12+
==============
13+
14+
Asserts
15+
-------
16+
17+
Casts
18+
-----
19+
20+
Type Guards
21+
-----------
22+
23+
24+
Protocols and Duck Typing
25+
=========================
26+
27+
Callback Protocols
28+
------------------

docs/source/introduction.rst

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
*******************************
2+
Introduction to Types in Python
3+
*******************************
4+
5+
6+
Background
7+
==========
8+
9+
How to read type annotations
10+
----------------------------
11+
12+
When and why types are useful
13+
-----------------------------
14+
15+
16+
Gradual Typing: Static Types in a Dynamic Language
17+
==================================================
18+
19+
Opt-in type checking
20+
--------------------
21+
22+
Type stubs
23+
----------
24+
25+
:doc:`stubs`
26+
27+
Strategies for increasing coverage
28+
----------------------------------
29+
30+
31+
Getting Started
32+
===============
33+
34+
Python type checkers
35+
--------------------
36+
37+
How to annotate an existing codebase
38+
------------------------------------
39+
40+
Typeshed
41+
--------

docs/source/libraries.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _libraries:
2+
13
***********************
24
Typing Python Libraries
35
***********************

docs/source/reference.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*********************
2+
Type System Reference
3+
*********************
4+
5+
.. toctree::
6+
:maxdepth: 2
7+
:caption: Contents:
8+
9+
basics
10+
type_system
11+
annotations
12+
inference
13+
type_compatibility
14+
dependencies
15+
faq

docs/source/type_compatibility.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
******************
2+
Type Compatibility
3+
******************
4+
5+
6+
The Class Hierarchy
7+
===================
8+
9+
Mutable Containers
10+
------------------
11+
12+
Comparing Callables: Covariance and Contravariance
13+
--------------------------------------------------
14+
15+
16+
Metaclasses
17+
===========

docs/source/type_system.rst

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
***************
2+
The Type System
3+
***************
4+
5+
Built-in Types
6+
==============
7+
8+
`typing Module Documentation <https://docs.python.org/3/library/typing.html>`__
9+
10+
Built-in Primitives
11+
-------------------
12+
13+
Built-in operators
14+
------------------
15+
16+
Advanced Types
17+
--------------
18+
19+
20+
Simple User-Defined Types
21+
=========================
22+
23+
24+
Type Aliases
25+
============
26+
27+
Recursive Aliases
28+
-----------------
29+
30+
31+
Data Structures
32+
===============
33+
34+
Typed Dictionary
35+
----------------
36+
37+
Dataclass
38+
---------
39+
40+
41+
Generic Types
42+
=============
43+
44+
45+
Type Variables
46+
==============
47+
48+
TypeVar
49+
-------
50+
51+
Variadics
52+
---------
53+
54+
ParamSpec
55+
^^^^^^^^^
56+
57+
TypeVarTuple
58+
^^^^^^^^^^^^

0 commit comments

Comments
 (0)