Skip to content

gh-97797: Improve documentation for typing.Annotated #105365

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

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jun 6, 2023

  • Document the __metadata__ attribute
  • Use consistent indentation for the code examples
  • Use assertions in the code examples instead of the weird not-REPL-but-also-not-something-you'd-ever-put-in-a-.py-file comparisons.
  • Provide definitions for the ValueRange, MaxLen and ctype example classes. I've seen a fair few users get confused about these and think that ValueRange (for example) is actually part of the typing-module API. I think defining them in the code examples makes this a little clearer.

📚 Documentation preview 📚: https://cpython-previews--105365.org.readthedocs.build/

@AlexWaygood
Copy link
Member Author

@JelleZijlstra JelleZijlstra removed their request for review June 7, 2023 00:35
@AlexWaygood AlexWaygood requested a review from JelleZijlstra June 7, 2023 08:16
@miss-islington
Copy link
Contributor

Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @AlexWaygood and @JelleZijlstra, I had trouble checking out the 3.12 backport branch.
Please retry by removing and re-adding the "needs backport to 3.12" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker e26d296984b2b6279231922ab0940d904aa6144e 3.12

@miss-islington
Copy link
Contributor

Sorry, @AlexWaygood and @JelleZijlstra, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker e26d296984b2b6279231922ab0940d904aa6144e 3.11

@JelleZijlstra JelleZijlstra added needs backport to 3.12 only security fixes and removed needs backport to 3.12 only security fixes labels Jun 7, 2023
@miss-islington
Copy link
Contributor

Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @AlexWaygood and @JelleZijlstra, I had trouble checking out the 3.12 backport branch.
Please retry by removing and re-adding the "needs backport to 3.12" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker e26d296984b2b6279231922ab0940d904aa6144e 3.12

@JelleZijlstra JelleZijlstra added needs backport to 3.12 only security fixes and removed needs backport to 3.12 only security fixes labels Jun 7, 2023
@miss-islington
Copy link
Contributor

Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 7, 2023
@bedevere-bot
Copy link

GH-105448 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Jun 7, 2023
JelleZijlstra pushed a commit to JelleZijlstra/cpython that referenced this pull request Jun 7, 2023
@bedevere-bot
Copy link

GH-105449 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jun 7, 2023
@AlexWaygood AlexWaygood deleted the annotated-metadata branch June 7, 2023 13:39
AlexWaygood added a commit that referenced this pull request Jun 7, 2023
… (#105448)

gh-97797: Improve documentation for typing.Annotated (GH-105365)
(cherry picked from commit e26d296)

Co-authored-by: Alex Waygood <[email protected]>
JelleZijlstra added a commit that referenced this pull request Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news topic-typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants