Skip to content

gh-103624: avoid DeprecationWarning when getting package metadata in pydoc #103627

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dlax
Copy link
Contributor

@dlax dlax commented Apr 19, 2023

@ghost
Copy link

ghost commented Apr 19, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@arhadthedev arhadthedev added the stdlib Python modules in the Lib dir label Apr 19, 2023
@dlax
Copy link
Contributor Author

dlax commented Apr 19, 2023

I can apply the same logic for other metadata, e.g. __author__, if the approach here sounds good.

I didn't find a way to test this, in Lib/test/test_pydoc.py, with the current infrastructure as it would require a dist package or so.

@dlax dlax marked this pull request as ready for review April 19, 2023 12:17
Copy link
Member

@FFY00 FFY00 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 for the contribution! As mentioned, I think the current implementation is problematic, and I don't really have a good solution for that.

IMO suppressing DeprecationWarning on the attribute access would be a reasonable resolution for this issue, even if not super nice.

@dlax dlax changed the title gh-103624: Let pydoc first try to get version from importlib.metadata gh-103624: avoid DeprecationWarning when getting package metadata in pydoc Apr 20, 2023
@dlax
Copy link
Contributor Author

dlax commented Apr 20, 2023

I have made the requested changes; please review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting change review stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants