Skip to content
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

gh-124269: Simplify typing.Annotated docs #130770

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

StanFromIreland
Copy link
Contributor

@StanFromIreland StanFromIreland commented Mar 2, 2025

Grouped relevant bullet points into paragraphs. Maybe I took too many creative liberties...

Request: @JelleZijlstra @sobolevn @picnixz

@picnixz picnixz self-requested a review March 3, 2025 23:03
@picnixz
Copy link
Member

picnixz commented Mar 3, 2025

I forgot about this one. If Jelle approves the PR today, go ahead and merge it, or I'll review it tomorrow.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra JelleZijlstra added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Mar 3, 2025
@StanFromIreland
Copy link
Contributor Author

If Jelle approves the PR today, go ahead and merge it

@picnixz friendly ping :-)

@picnixz
Copy link
Member

picnixz commented Mar 7, 2025

I'm currently travelling so I don't have time to review sorry. Nikita/Alex could also review the PR but I trust Jelle's judgment on this one so if he wants to merge it, go ahead. I can review it when I'm at the airport in a few hours though

* At runtime, the metadata associated with an ``Annotated`` type can be
retrieved via the :attr:`!__metadata__` attribute:
At runtime, the metadata associated with an ``Annotated`` type can be
retrieved via the :attr:`!__metadata__` attribute. If you want to retrieve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid mixing examples, I would prefer a separate paragraph for origin, namely;

Paragraph for metadata
Example
One line of text for origin
Example

Or at least two distinct doctest blocks.

@StanFromIreland StanFromIreland requested a review from picnixz March 7, 2025 18:31

* The order of the metadata elements is preserved and matters for equality
checks::
assert a1 != a2 # Order matters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert a1 != a2 # Order matters
assert a1 != a2 # Order matters

.. doctest::

>>> from typing import Annotated, get_origin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this import is still needed but I'm not entirely sure. Because Annotated may not be imported when executing the block test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge docs Documentation in the Doc dir needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants