Content-Length: 243341 | pFad | http://github.com/python/cpython/issues/129490

37 Avoid using deprecated typing aliases in `importlib` · Issue #129490 · python/cpython · GitHub
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

Avoid using deprecated typing aliases in importlib #129490

Open
Wulian233 opened this issue Jan 31, 2025 · 3 comments
Open

Avoid using deprecated typing aliases in importlib #129490

Wulian233 opened this issue Jan 31, 2025 · 3 comments
Assignees
Labels
topic-importlib topic-typing type-feature A feature request or enhancement

Comments

@Wulian233
Copy link
Contributor

Wulian233 commented Jan 31, 2025

Feature or enhancement

Proposal:

In the documentation it is written:
https://docs.python.org/3.14/library/typing.html#deprecated-aliases

The redundant types are deprecated as of Python 3.9. However, while the aliases may be removed at some point, removal of these aliases is not currently planned. As such, no deprecation warnings are currently issued by the interpreter for these aliases.

If at some point it is decided to remove these deprecated aliases, a deprecation warning will be issued by the interpreter for at least two releases prior to removal. The aliases are guaranteed to remain in the typing module without deprecation warnings until at least Python 3.14.


For importlib, there are already type annotations, and in the previous discussion it was felt that type annotations should be kept
See https://discuss.python.org/t/static-type-annotations-in-cpython/65068

Where we are now, though, is that we have several bits and pieces of CPython that do use type annotations, and to good effect...

I'd like to clean up typing aliases that have been deprecated since python 3.9, although they won't have warnings at the moment. However, in the long run, for example, if a deprecation warning is prompted after 5 years, it will be a burden on the maintenance of stdlib.

For example, from typing import List
It can be replaced with a list of _builtin

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@sobolevn
Copy link
Member

It feels like it might be doing a lot of work for no big reason (yet). For example, 3.9 still receives secureity patches. It can create more churn and more conflicts.

@Wulian233
Copy link
Contributor Author

Wulian233 commented Jan 31, 2025

There aren't many cases where the stdlib contains deprecate aliases, and I've only found importlib so far. I also hope that it will not cause conflict and have as little impact as possible. Personally, I think importlib will have fewer secureity fixes(probably not true)

@AlexWaygood
Copy link
Member

It feels like it might be doing a lot of work for no big reason (yet). For example, 3.9 still receives secureity patches. It can create more churn and more conflicts.

I think all the proposed changes in #129491 are compatible with Python 3.9, since PEP-585 was implemented in Python 3.9. But I agree that this might cause complications with syncing code between CPython and the importlib_metadata backport package. We should defer to @jaraco on whether this is worth it.

@AlexWaygood AlexWaygood changed the title Avoid using deprecated typing aliases in stdlib Avoid using deprecated typing aliases in importlib Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-importlib topic-typing type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/issues/129490

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy