Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge the specification portion of the "Type Stubs" doc into the spec (…
…#1815) * Type Stubs: move intro and syntax to spec. * Moves some content into spec, deletes duplicate spec content. * Adds placeholders for where remaining content will be moved. It will be split between the spec and the writing_stubs doc. * Move "Stub Contents" to writing_stubs. Moves the section on what to include in stubs with editorial changes only - e.g., changing "type stub" to "stub file" to match surrounding terminology. * Moves "Style Guide" to writing_stubs doc. Moves the style guide with a few updates: * Editorial changes like tweaking code examples to use recommended style. * Attribute declarations can use assignments when needed to convey extra information - e.g., final attributes and enum members. * Tweaks a reference to the double-underscore convention for positional-only arguments to note that it's historical. * Change :ref:`stubs` occurrences to :ref:`stub-files`. * Move a few "Supported Constructs" sections into spec. The only substantive change is an update to "Comments" to note that many formats of error suppression comments are allowed. * Migrated "Imports" and "Module Level Attributes" supported constructs. Added `x: Final = <literal>` to module-level attributes section. No other changes. * Migrate "Enums" supported construct section. Replaces outdated info with a link to the enums section of the spec. * Move "Classes" and "Decorators" supported constructs sections. Added an example of an inner class to "Classes." Removed mention of asyncio.coroutine from "Decorators" as it's very deprecated. Added functions decorated with `@dataclass_transform` to list of decorators that type checkers should recognize. * Port "Functions and Methods" supported constructs section. Removed mention of individual supported/unsupported features from this section. Where we state that all typing features from the latest released version are supported, added a caveat with a link to the typeshed feature tracker. * Adds an "Import Conventions" section (deduplication). * Remove missed reference to deleted stubs doc. * Fix broken refs. * Formatting fix to docs/guides/writing_stubs.rst Co-authored-by: Sebastian Rittau <[email protected]> * Reword paragraph on argument names to be more concise. Co-authored-by: Sebastian Rittau <[email protected]> * Wording clarification in docs/guides/writing_stubs.rst Co-authored-by: Sebastian Rittau <[email protected]> * Modernize code example in docs/guides/writing_stubs.rst Co-authored-by: Sebastian Rittau <[email protected]> * Typo fix in docs/spec/distributing.rst Co-authored-by: Sebastian Rittau <[email protected]> * Typo fix in docs/spec/distributing.rst Co-authored-by: Sebastian Rittau <[email protected]> * Grammar fixes * Property deleters should also be understood. * Address future notes. * Fix silly formatting error. * Undelete stubs.rst. * Address review comments. * Reword some sections to focus on type checker behavior. * Move or remove some sections that fit better in the writing_stubs guide or are redundant. * Address more review comments. Cuts redundant sections, moves things to writing_stubs, tries out a new "these should be supported fully" and "these should be supported to at least the described minimum" structure. * Remove no-longer-needed anchor. * And add back an accidentally deleted newline... * Slight rewording of Decorators advice. * Address more reviewer comments. Moves "Library Interface" into spec, further trims redundant text. * Remove extra colon. * Revert changes to wrting_stubs that should be made separately. * Delete unnecessary sentence. Co-authored-by: Carl Meyer <[email protected]> * Clarify some language and terminology. * Address reviewer feedback. * Formatting * Drop "annotation contexts." * Add "in annotation expressions" to newer syntax explanation. * Update docs/spec/distributing.rst Co-authored-by: Jelle Zijlstra <[email protected]> * Reword syntax section. * Update docs/spec/distributing.rst Co-authored-by: Jelle Zijlstra <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks --------- Co-authored-by: Sebastian Rittau <[email protected]> Co-authored-by: Carl Meyer <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information