Skip to content

gh-136672: Docs: Move Enum functions and add examples #136791

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

Conversation

RafaelWO
Copy link
Contributor

@RafaelWO RafaelWO commented Jul 19, 2025

When the Enum functions _add_alias_ and _add_value_alias_ were added in de6bca9, the documentation for them was done under EnumType instead of Enum.

This change moves them to the docs of the Enum class and adds an example for each function.

Additionally, it moves the versionadded for EnumType to the top and fixes the indentation of another versionchanged entry.


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

@RafaelWO
Copy link
Contributor Author

Thanks for reviewing, @AA-Turner 🙃

RafaelWO added 2 commits July 19, 2025 13:31
When the `Enum` functions `_add_alias_` and `_add_value_alias_` were added in de6bca9, the documentation for them was done under `EnumType` instead of `Enum`.

This change moves them to the docs of the `Enum` class and adds an example for each function.
This change moves the `versionadded` for `EnumType` to the top.
Additionally, it fixes the indentation of another `versionchanged` entry.
@RafaelWO RafaelWO force-pushed the change/docs-move-enum-functions-and-add-examples branch from 69e75be to 4b25a5f Compare July 19, 2025 11:31
Copy link
Member

@ethanfurman ethanfurman left a comment

Choose a reason for hiding this comment

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

Mostly good, just one small change.

@bedevere-app
Copy link

bedevere-app bot commented Jul 19, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@AA-Turner AA-Turner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 19, 2025
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

Thank you @RafaelWO! Please could you have a look at Ethan's suggestions.

A

@RafaelWO RafaelWO marked this pull request as draft July 20, 2025 08:56
@RafaelWO
Copy link
Contributor Author

RafaelWO commented Jul 20, 2025

Upon fixing the ordering of the methods under "Supported _sunder_ names", I noticed that this section and the above ("Supported __dunder__ names") are duplicated in the enum API docs and enum HOWTO - but they are not in sync.

Is there a way to connect those sections (i.e. include the content to have only one source of truth)? Or should I just remove one, e.g., in the HOWTO, and link to the other one?

Thanks for your suggestions!

@RafaelWO RafaelWO requested a review from ethanfurman July 26, 2025 09:13
@RafaelWO
Copy link
Contributor Author

RafaelWO commented Aug 2, 2025

I have made the requested changes; please review again

(Just trying to ensure that someone is aware of my comment above.)

@bedevere-app
Copy link

bedevere-app bot commented Aug 2, 2025

Thanks for making the requested changes!

@AA-Turner, @ethanfurman: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from AA-Turner August 2, 2025 19:52
@ethanfurman
Copy link
Member

I'm not proficient in Sphinx, so unless somebody else can link those sections, remove the duplicate from the how-to and the library entry can be the source of truth.

Thanks for catching that!

Copy link
Member

@ethanfurman ethanfurman left a comment

Choose a reason for hiding this comment

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

Minor change to the examples; otherwise, looks good!

@bedevere-app
Copy link

bedevere-app bot commented Aug 12, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ethanfurman ethanfurman marked this pull request as ready for review August 12, 2025 19:27
@ethanfurman ethanfurman merged commit 003bd8c into python:main Aug 12, 2025
33 of 34 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Aug 12, 2025
@miss-islington-app
Copy link

Thanks @RafaelWO for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 12, 2025
…-136791)

* Docs: Move Enum functions and add examples

When the `Enum` functions `_add_alias_` and `_add_value_alias_` were added in de6bca9, the documentation for them was done under `EnumType` instead of `Enum`.

This change moves them to the docs of the `Enum` class and adds an example for each function.

---------
(cherry picked from commit 003bd8c)

Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 12, 2025
…-136791)

* Docs: Move Enum functions and add examples

When the `Enum` functions `_add_alias_` and `_add_value_alias_` were added in de6bca9, the documentation for them was done under `EnumType` instead of `Enum`.

This change moves them to the docs of the `Enum` class and adds an example for each function.

---------
(cherry picked from commit 003bd8c)

Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@bedevere-app
Copy link

bedevere-app bot commented Aug 12, 2025

GH-137688 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Aug 12, 2025
@bedevere-app
Copy link

bedevere-app bot commented Aug 12, 2025

GH-137689 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Aug 12, 2025
AA-Turner pushed a commit that referenced this pull request Aug 12, 2025
…) (#137689)

Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@RafaelWO
Copy link
Contributor Author

I'm not proficient in Sphinx, so unless somebody else can link those sections, remove the duplicate from the how-to and the library entry can be the source of truth.

Thanks for catching that!

Sorry, I have not had time yet to update the PR in this regard. Hence, I am a bit confused why this got merged already, @ethanfurman? 🤔

@ethanfurman
Copy link
Member

Woops, I missed that. Please create a new PR with the duplicate section removed from the How-To.

@RafaelWO
Copy link
Contributor Author

Will do!

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 sprint
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants