Python Type System Documentation
There was some discussion last week during the typing summit of putting together common documentation for the Python type system that is both type checker agnostic and more centralized than chasing down pieces of PEPs. This could also address some of the common concerns raised around providing context on type annotations in Python for developers new to the language, and where to get started in a world where more than one type checker exists. If we can get a documentation source that the larger Python community has contributed to and agrees on, I could see this providing a lot of value to new and existing users of types in the language. I recall there was a suggestion during the summit to get this started as a subdirectory of the typing repository (https://github.com/python/typing), where we can incrementally iterate, then potentially moving a more finished version to somewhere discoverable alongside other python docs. I’m curious to hear any thoughts or suggestions on the high level idea. Pending that, are there any concerns with getting started by creating a skeleton for common docs in the typing repository? I imagine just carving out a place to collaborate on this would be a helpful starting point, so incremental progress and discussion is possible. Is anyone interested in contributing, or have other suggestions around how to organize the effort? I’ve posted a message with mostly the same content in the docs community issue that Carol started after the typing summit. This could also be a good place to continue the discussion in a way that’s more visible outside the typing mailing list: https://github.com/python/docs-community/issues/8 Shannon
I'm excited about this project and happy to help out. I'd envision a set of documents with the following goals: - Type checker-independent documentation for users. This would expand on what's in the Python docs (https://docs.python.org/3.10/library/typing.html) and encompass content like the mypy cheatsheet ( https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html). - A common specification for all type checkers to adhere to, replacing PEP 484 and the subsequent PEPs. In the future, minor updates to the type system could then be reflected in changes to the docs. Bigger changes would still require a PEP. El mar, 18 may 2021 a las 17:42, Shannon Zhu via Typing-sig (< typing-sig@python.org>) escribió:
There was some discussion last week during the typing summit of putting together common documentation for the Python type system that is both type checker agnostic and more centralized than chasing down pieces of PEPs. This could also address some of the common concerns raised around providing context on type annotations in Python for developers new to the language, and where to get started in a world where more than one type checker exists. If we can get a documentation source that the larger Python community has contributed to and agrees on, I could see this providing a lot of value to new and existing users of types in the language.
I recall there was a suggestion during the summit to get this started as a subdirectory of the typing repository (https://github.com/python/typing), where we can incrementally iterate, then potentially moving a more finished version to somewhere discoverable alongside other python docs.
I’m curious to hear any thoughts or suggestions on the high level idea. Pending that, are there any concerns with getting started by creating a skeleton for common docs in the typing repository? I imagine just carving out a place to collaborate on this would be a helpful starting point, so incremental progress and discussion is possible. Is anyone interested in contributing, or have other suggestions around how to organize the effort?
I’ve posted a message with mostly the same content in the docs community issue that Carol started after the typing summit. This could also be a good place to continue the discussion in a way that’s more visible outside the typing mailing list: https://github.com/python/docs-community/issues/8
Shannon _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: jelle.zijlstra@gmail.com
Am 19.05.21 um 03:21 schrieb Jelle Zijlstra:
I'm excited about this project and happy to help out. I'd envision a set of documents with the following goals: - Type checker-independent documentation for users. This would expand on what's in the Python docs (https://docs.python.org/3.10/library/typing.html <https://docs.python.org/3.10/library/typing.html>) and encompass content like the mypy cheatsheet (https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html <https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html>). - A common specification for all type checkers to adhere to, replacing PEP 484 and the subsequent PEPs. In the future, minor updates to the type system could then be reflected in changes to the docs. Bigger changes would still require a PEP.
+1 to everything written by Shannon and Jelle. I am also willing to help out as time permits. One thing that we should add are typing best practices. For example, using protocols and ABCs as arguments and concrete types as return values. - Sebastian
I'd be interested in helping with this. I'd particularly like to see a resource whose organization emphasizes problems rather than features of the type system, aimed at being search-engine-friendly. At the moment, for example, it's not easy to search for things like "how to type a decorator" and get up-to-date answers; the top hit is a Stack Overflow post circa 2017. This doesn't necessarily have to be docs, it could be a well-linked-to blog series, but my guess is that discoverability of good typing practices is a major drag on adoption. +1 to Sebastian's comment about emphasizing general principles
I'd be interested in helping with this too! It sounds like it would be a really good resource to have. martin On Wed, May 19, 2021 at 1:37 PM <steven.troxler@gmail.com> wrote:
I'd be interested in helping with this.
I'd particularly like to see a resource whose organization emphasizes problems rather than features of the type system, aimed at being search-engine-friendly.
At the moment, for example, it's not easy to search for things like "how to type a decorator" and get up-to-date answers; the top hit is a Stack Overflow post circa 2017.
This doesn't necessarily have to be docs, it could be a well-linked-to blog series, but my guess is that discoverability of good typing practices is a major drag on adoption.
+1 to Sebastian's comment about emphasizing general principles _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: mdemello@google.com
Really excited to hear all the interest in collaborating on python typing docs! To follow up, I’ve put up https://github.com/python/typing/pull/814 to create a space to iterate on and discuss. Gathering some of the input so far, it sounds like some toplevel sections we should include are (thoughts/suggestions welcome – anything you think is missing?): * Introduction to types in Python, friendly for new users * Thorough, type-checker independent type system documentation * Expand on what's in the Python docs (https://docs.python.org/3.10/library/typing.html) and encompass content like the mypy cheatsheet ( https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html). * Common specification for all type checkers to adhere to, replacing PEP 484 and the subsequent PEPs. * Typing best practices, and search-engine friendly documentation for common patterns and how to properly annotate them If anyone is interested in drafting a rough table of contents as a second PR, that could be a good place to continue the discussion and then spin off into incrementally contributing/discussing some content itself. If no movement, I’ll try to put something together by end of week 😊
participants (5)
-
Jelle Zijlstra
-
Martin DeMello
-
Sebastian Rittau
-
Shannon Zhu
-
steven.troxler@gmail.com