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-129490: Avoid using deprecated typing aliases in importlib #129491

Closed
wants to merge 1 commit into from

Conversation

Wulian233
Copy link
Contributor

@Wulian233 Wulian233 commented Jan 31, 2025

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Please, see https://github.com/python/importlib_metadata and https://github.com/python/importlib_resources

I would start from there. Not the other way around.

Also, this might need from __future__ import annotations

@Wulian233
Copy link
Contributor Author

Wulian233 commented Jan 31, 2025

I went to check out these two repositories and found that there are indeed differences and conflicts in the file import section.

For instance, https://github.com/python/importlib_resources/blob/main/importlib_resources%2Fabc.py

Maybe we can handle this in these two repositories and wait for the next sync of importlib? Personally, I think the benefits outweigh the drawbacks in the long run

I'm not quite clear about the maintenance rules related to importlib
CC @jaraco

@jaraco
Copy link
Member

jaraco commented Feb 2, 2025

I'm very much in favor of these changes. Thanks for proposing them. Most likely, these changes are remnants of a time when this code supported Python 3.8 and earlier (importlib_resources and _metadata both supported Python 2.7).

I'm not quite clear about the maintenance rules related to importlib

There are not any strict rules. Any contribution is fair game for CPython.

In the case of this change, however, I'm going to ask you to contribute those to the independent packages for a few reasons:

  1. Any changes contributed to CPython need to be backported to the third-party packages anyway.
  2. Because this change affects both resources and metadata, it makes dealing with backporting twice as involved.
  3. Perhaps most importantly, the typing annotations in CPython are not validated in any way. In contrast, they are validated in the third-party packages. Therefore, changes there will be more thoroughly vetted, avoiding the chance that they cause problems in backporting.

In that case, I respectfully ask that you contribute them there. Thanks!

If it would help, I can cherry-pick the changes into those repos fairly easily (except for any conflicts). Let me know.

@jaraco jaraco closed this Feb 2, 2025
@Wulian233 Wulian233 deleted the importlib-typing branch February 3, 2025 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants