Commit graph

273 commits

Author SHA1 Message Date
Miss Islington (bot)
0c36c37841
[3.12] gh-124120: Document Annotated.__origin__ (GH-124125) (#124417)
gh-124120: Document `Annotated.__origin__` (GH-124125)
(cherry picked from commit faef3fa653)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-09-24 13:52:27 +00:00
Miss Islington (bot)
92bc714033
[3.12] GH-103484: Fix permanently redirects reported by linkcheck (GH-124144) (GH-124152)
Fix redirects reported by linkcheck, update docs conf.py checks.
(cherry picked from commit 0a32c6959c)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-16 20:53:46 -07:00
Alex Waygood
7e51091481
[3.12] gh-123523: Rework typing documentation for generators and coroutines, and link to it from collections.abc docs (#123544) (#123792)
Co-authored-by: Stanislav Terliakov <50529348+sterliakov@users.noreply.github.com>
2024-09-06 17:06:36 +00:00
Miss Islington (bot)
566898a3f6
[3.12] gh-120661: improve example for basic type hints (GH-120934) (#120988)
gh-120661: improve example for basic type hints (GH-120934)
(cherry picked from commit bb057ea107)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-25 09:25:11 +01:00
Miss Islington (bot)
673cabc23b
[3.12] Typing docs: normalize some indents in code examples (GH-120912) (#120916)
Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
2024-06-23 17:23:01 +01:00
Nyuan Zhang
f774d49b7a
[3.12] gh-120572: add missing parentheses in TypeIs documentation (GH-120573) (#120578) 2024-06-15 23:50:27 -07:00
Alex Waygood
c5d1fbd4ce
[3.12] typing docs: fix indentation of TypedDict deprecation notice (#120124) 2024-06-05 10:37:24 -07:00
Miss Islington (bot)
c8de0ec7b9
[3.12] Improve documentation for typing.get_type_hints (GH-119928) (#119944)
- Explicit list of what it does that is different from
  "just return __annotations__"
- Remove reference to PEP 563; adding the future import doesn't
  do anything to type aliases, and in general it will never make
  get_type_hints() less likely to fail.
- Remove example, as the Annotated docs already have a similar
  example, and it's unbalanced to have one example about this
  one edge case but not about other behaviors of the function.

(cherry picked from commit aa9fe98e06)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-02 15:21:47 +00:00
Serhiy Storchaka
530c3bb271
[3.12] Format None, True, False and NotImplemented as literals (GH-118758) (GH-118794)
(cherry picked from commit 05c2fe1acd)
2024-05-08 19:55:13 +00:00
Miss Islington (bot)
a7f495c7ba
[3.12] gh-117492: Clarify documentation of typing.Never (GH-117678) (#118547)
(cherry picked from commit 852263e108)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-05-03 13:09:05 +00:00
Miss Islington (bot)
c869f4ed5c
[3.12] gh-118030: Group definitions for ParamSpecArgs and ParamSpecKwargs in typing.rst (GH-118154) (#118155)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-04-22 15:04:11 +00:00
Alex Waygood
5430f61437
[3.12] gh-114053: Fix bad interaction of PEP-695, PEP-563 and `get_type_hints` (#118009) (#118104)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-19 13:41:28 +00:00
Hugo van Kemenade
eb0bfb5910
[3.12] Docs: add link roles with Sphinx extlinks (GH-117850) (#117910)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-15 13:18:21 -06:00
Miss Islington (bot)
52f1fb6f7d
[3.12] Link to the Python type system specification (GH-117400) (#117448)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-04-02 09:29:10 +00:00
Miss Islington (bot)
0f5cd44e1c
[3.12] gh-115777: Fix double versionadded directives (GH-116269) (GH-116361)
(cherry picked from commit 0064dfa091)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-05 16:00:40 +00:00
Miss Islington (bot)
b01caf1d9d
[3.12] gh-113255: Clarify docs for typing.reveal_type (GH-113286) (#113323)
gh-113255: Clarify docs for `typing.reveal_type` (GH-113286)
(cherry picked from commit 11ee912327)

Co-authored-by: Kir <note351@hotmail.com>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-12-20 17:36:45 +00:00
Alex Waygood
9aa5ff82d4
[3.12] gh-111681: minor fixes to typing doctests; remove unused imports in test_typing (#111682) (#112035)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-11-13 14:08:57 +00:00
Miss Islington (bot)
42699c82d7
[3.12] Glossary: Add "static type checker" (GH-111837) (#111854)
Glossary: Add "static type checker" (GH-111837)
(cherry picked from commit 8ab7ad6308)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-08 14:45:17 +00:00
Miss Islington (bot)
35141842d3
[3.12] gh-111729: update generic syntax for typing.Concatenate sample code in Doc/library/typing.rst (GH-111734) (#111814)
(cherry picked from commit c3e19c3a62)

Co-authored-by: 方糖 <cubesugarcheese@qq.com>
2023-11-07 01:00:16 +00:00
Miss Islington (bot)
edff7c1614
[3.12] gh-111151: Convert monospaced directives to :ref: (GH-111152) (#111269)
gh-111151: Convert monospaced directives to :ref: (GH-111152)
(cherry picked from commit 1198076447)

Co-authored-by: InSync <122007197+InSyncWithFoo@users.noreply.github.com>
2023-10-24 15:30:21 +00:00
Miss Islington (bot)
ee2f2bdb30
[3.12] Enhance TypedDict docs around required/optional keys (GH-109547) (#109982)
Enhance TypedDict docs around required/optional keys (GH-109547)

As discussed in comments to GH-109544, the semantics of this attribute
are somewhat confusing. Add a note explaining its limitations and
steering users towards __required_keys__ and __optional_keys__ instead.
(cherry picked from commit f49958c886)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-10-04 13:56:58 +02:00
Alex Waygood
25bf0564c4
[3.12] Fix typos in docs and comments (#109619) (#109621)
Fix typos in docs and comments (#109619)

Co-authored-by: Heinz-Alexander Fuetterer <35225576+afuetterer@users.noreply.github.com>
2023-10-02 17:34:49 +00:00
Miss Islington (bot)
5531d03d99
[3.12] Fix typo in typing docs: Remove redundant backtick (GH-108559) (#108560)
Fix typo in typing docs: Remove redundant backtick (GH-108559)
(cherry picked from commit 72b615ab01)

Co-authored-by: nikkie <takuyafjp+develop@gmail.com>
2023-08-29 00:24:41 +02:00
Miss Islington (bot)
f7e16d74ad
[3.12] Clarify Self interaction with subclasses (GH-107511) (#107548)
Clarify `Self` interaction with subclasses (GH-107511)
(cherry picked from commit c8872f4285)

Co-authored-by: Alexandru Mărășteanu <alexei@users.noreply.github.com>
2023-08-02 01:52:28 +02:00
Miss Islington (bot)
9f58d9ec90
[3.12] gh-105578: Add more usage examples to typing.AnyStr docs (GH-107045) (#107503)
gh-105578: Add more usage examples to `typing.AnyStr` docs (GH-107045)

``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32b87)

Co-authored-by: Michael The <michael-the1@users.noreply.github.com>
2023-07-31 15:33:00 +00:00
Miss Islington (bot)
2c0a99d322
[3.12] gh-107422: Remove outdated TypedDict example from typing docs (GH-107436) (#107437)
gh-107422: Remove outdated `TypedDict` example from typing docs (GH-107436)
(cherry picked from commit 89fd4f4a3f)

Co-authored-by: Rakesh Sabale <102187286+ghubrakesh@users.noreply.github.com>
2023-07-29 17:12:50 +00:00
Alex Waygood
e99b69c5ae
[3.12] gh-106745: typing docs: Clarify that removal of PEP-585 aliases is not currently planned (#106748) (#106772) 2023-07-15 11:31:12 +01:00
Miss Islington (bot)
128a962482
[3.12] gh-106461: typing: Consolidate docs on Callable (GH-106462) (#106574)
gh-106461: typing: Consolidate docs on `Callable` (GH-106462)
(cherry picked from commit ca8b55c7f5)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-09 22:21:54 +01:00
Miss Islington (bot)
84189640b7
[3.12] Improve typing docs on the type of class objects (GH-106081) (#106096)
Improve typing docs on the type of class objects (GH-106081)
(cherry picked from commit 3eeb8c8906)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-26 09:43:24 +01:00
Miss Islington (bot)
de1c090879
[3.12] Typing docs: fix typo in annotating tuples comment (GH-106048) (#106049)
Typing docs: fix typo in annotating tuples comment (GH-106048)
(cherry picked from commit 8ef0ee4ebc)

Co-authored-by: Eamon Tracey <66919574+EamonTracey@users.noreply.github.com>
2023-06-23 21:35:00 +01:00
Miss Islington (bot)
1ffcd49be2
[3.12] Typing docs: improve the guidance on annotating tuples (GH-106021) (#106027)
Typing docs: improve the guidance on annotating tuples (GH-106021)
(cherry picked from commit 968435ddb1)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-23 15:48:29 +01:00
Miss Islington (bot)
5e524ef346
[3.12] typing docs: Improve the intro to each section (GH-105901) (#105902)
typing docs: Improve the intro to each section (GH-105901)
(cherry picked from commit 4426279a43)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-19 01:02:48 +01:00
Miss Islington (bot)
9012c55af8
[3.12] More reorganisation of the typing docs (GH-105787) (#105810)
More reorganisation of the typing docs (GH-105787)
(cherry picked from commit da911a6b22)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-15 07:12:42 +01:00
Miss Islington (bot)
1573f1605f
[3.12] Improve docs for typing.dataclass_transform (GH-105792) (#105809)
Improve docs for `typing.dataclass_transform` (GH-105792)
(cherry picked from commit 006a453205)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-15 07:12:26 +01:00
Alex Waygood
52a2bbdc9d
[3.12] Typing docs: move the deprecated stuff below the non-deprecated stuff (#105781) (#105783) 2023-06-14 16:03:30 +01:00
Miss Islington (bot)
7c298d2dc5
[3.12] Miscellaneous improvements to the typing docs (GH-105529) (#105567)
Miscellaneous improvements to the typing docs (GH-105529)

Mostly, these are changes so that we use shorter sentences and shorter paragraphs. In particular, I've tried to make the first sentence introducing each object in the typing API short and declarative.
(cherry picked from commit 8e755923c9)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-09 15:37:33 +00:00
Miss Islington (bot)
3c5f0eadd8
[3.12] Further improve docs for typing.Annotated (GH-105498) (#105503)
Further improve docs for `typing.Annotated` (GH-105498)
(cherry picked from commit d213c2990f)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-08 15:12:35 +00:00
Miss Islington (bot)
9a7c4a5f39
[3.12] typing: Improve documentation of generic classes and aliases (GH-105369) (#105453)
typing: Improve documentation of generic classes and aliases (GH-105369)
(cherry picked from commit d63a7c3694)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-07 15:04:14 +00:00
Miss Islington (bot)
241c36e1dc
[3.12] gh-97797: Improve documentation for typing.Annotated (GH-105365) (#105448)
gh-97797: Improve documentation for typing.Annotated (GH-105365)
(cherry picked from commit e26d296984)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-07 14:57:25 +01:00
Miss Islington (bot)
92ab560ef5
[3.12] Improve docs for typing.TypeAlias (GH-105372) (#105446)
Improve docs for `typing.TypeAlias` (GH-105372)
(cherry picked from commit c5ec51ec8f)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-07 14:45:54 +01:00
Miss Islington (bot)
2cfe778d7f
[3.12] Improve code examples in typing.rst (GH-105346) (#105422)
Improve code examples in `typing.rst` (GH-105346)
(cherry picked from commit 81c81328a4)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-07 08:00:22 +01:00
Miss Islington (bot)
a36fb691ac
[3.12] typing docs: Make the PEPs list an expandable section, hidden by default (GH-105353) (#105420)
typing docs: Make the PEPs list an expandable section, hidden by default (GH-105353)
(cherry picked from commit d7645124f5)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-06-07 07:48:44 +01:00
Miss Islington (bot)
f4969eb315
[3.12] typing.NewType docs: the future performance improvements are now in the past (GH-105354) (#105414)
`typing.NewType` docs: the future performance improvements are now in the past (GH-105354)
(cherry picked from commit 5f65ff0370)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-06 20:55:37 -07:00
Miss Islington (bot)
dcee0aa911
[3.12] gh-103921: Document PEP 695 (GH-104642) (#104989)
(cherry picked from commit 060277d96b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-26 18:19:34 +00:00
Miss Islington (bot)
a064233886
[3.12] gh-104874: Document NewType.__supertype__ (GH-104875) (#104906)
gh-104874: Document NewType.__supertype__ (GH-104875)
(cherry picked from commit 41768a2bd3)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-25 00:33:52 +01:00
Jelle Zijlstra
ab71acd67b
typing docs: Move some classes out of the "Generics" section (#104707)
- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
  to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.

Also fix the indentation for two notes associated with Concatenate.

Split off from #104642, but I think this change is independently an
improvement.
2023-05-21 06:00:50 -07:00
Jelle Zijlstra
2f7b5e458e
Minor improvements to typing docs (#104465) 2023-05-14 12:53:15 +01:00
chgnrdv
a7a2dbbf72
gh-104010: Separate and improve docs for typing.get_origin and typing.get_args (#104013)
* separate documentation and examples for both functions
* add examples demonstrating behaviour with unsupported types
* document return value of `get_origin` for `ParamSpecArgs` and `ParamSpecKwargs` instances

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-10 07:48:55 -07:00
Shantanu
1f5679540c
gh-102500: Remove mention of bytes shorthand (#104281)
The bytes shorthand was removed in PEP 688:
https://peps.python.org/pep-0688/#no-special-meaning-for-bytes

I also remove the reference to `collections.abc.ByteString`, since that
object is deprecated (#91896) and has different semantics (#102092)
2023-05-08 14:40:51 +01:00
Shantanu
09b7695f12
gh-91896: Deprecate collections.abc.ByteString (#102096)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-05-04 09:39:33 -07:00