Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-92871: Remove typing.{io,re} namespaces#92873

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 8 commits intopython:mainfromsrittau:rm-typing-submodules
May 23, 2023

Conversation

srittau
Copy link
Contributor

@srittausrittau commentedMay 17, 2022
edited
Loading

@Fidget-Spinner
Copy link
Member

LGTM and I'm also +1 for this, but I'll wait to see what the rest have to say.

@JelleZijlstra
Copy link
Member

Thanks, could you check whether there's any usage of these remaining in the wild? (cf.#92547 (comment))

AlexWaygood reacted with thumbs up emoji

@srittau
Copy link
ContributorAuthor

Thanks, could you check whether there's any usage of these remaining in the wild? (cf.#92547 (comment))

Is there an easy way to do this? From what I understand, the scripts need a local copy of PyPI.

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

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

Good riddance. Two tiny nits. When can we start deprecating typing.Pattern/Match and the io classes in typing?

@srittau
Copy link
ContributorAuthor

srittau commentedMay 17, 2022
edited
Loading

When can we start deprecating typing.Pattern/Match and the io classes in typing?

I'm usually in the "sooner better than later" camp, but for now I wouldn't recommend to more than soft-deprecate those, until Python 3.8 goes end of life. 3.9 introduced the generics in the stdlib, so to write code compatible with 3.8 and 3.9+, you'd need to use a conditional import otherwise.

AlexWaygood reacted with thumbs up emoji

Copy link
Member

@AlexWaygoodAlexWaygood left a comment

Choose a reason for hiding this comment

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

Just one suggestion about a comment wording.

I also agree with@JelleZijlstra that we should check how much these are used in the wild before removing them, especially since we've never emittedDeprecationWarnings for these. Some people use the objects in thetyping module for purposes other than static typing, so there might still be some people using these namespaces even though they've never been supported by type-checkers.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@srittau
Copy link
ContributorAuthor

I also agree with@JelleZijlstra that we should check how much these are used in the wild before removing them, especially since we've never emittedDeprecationWarnings for these.

We do emitDeprecationWarnings, starting with Python 3.11.

AlexWaygood reacted with heart emoji

Copy link
Member

@AlexWaygoodAlexWaygood left a comment
edited
Loading

Choose a reason for hiding this comment

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

I also agree with@JelleZijlstra that we should check how much these are used in the wild before removing them, especially since we've never emittedDeprecationWarnings for these.

We do emitDeprecationWarnings, starting with Python 3.11.

🤦‍♂️

I'dstill like to double-check that there aren't too many uses of these in the wild, but providing there aren't, looks good!

@srittau
Copy link
ContributorAuthor

I'dstill like to double-check that there aren't too many uses of these in the wild, but providing there aren't, looks good!

Sounds like a good idea, if someone can do it and give me guidance on how to do it.

@JelleZijlstra
Copy link
Member

I think@vstinner has a script to get the top 5k, but I can't find it documented.

@gvanrossum
Copy link
Member

@vstinner
Copy link
Member

I think@vstinner has a script to get the top 5k, but I can't find it documented.

I just documented it in my doc:https://pythondev.readthedocs.io/test_next_python.html#top-5000-pypi-packages

I wrote these scripts for my own needs. It's based the script that@methane wrote to see how the PyUnicode C API was used.

For example, search_pypi_top.py ignores Cython files (use--cython option to not exclude them: see--help). Previously, I usedrg for code serach, but it doesn't give the filename inside an archive and it doesn't show the matching line. Also, I needed something more specific to Python.

@srittau
Copy link
ContributorAuthor

Thanks,@vstinner and@gvanrossum, that was very helpful! I did run Victor's script for the top 5000 packages, and here are the results:

typing.re: Two affected projects (ignoring thetyping backport):

A quick count show 7 affected projects fortyping.io. I will send PRs later.

@srittau
Copy link
ContributorAuthor

typing.io:

Ignoring a Python 2 package and the typing backport.

hauntsaninja reacted with thumbs up emoji

@srittau
Copy link
ContributorAuthor

This makes for a total of 7 out of 5000 affected projects or 0.14%.

@srittau
Copy link
ContributorAuthor

@vstinner You mean beyond the PRs and issues linked above?typing.re andtyping.io hasn't been necessary since at least Python 3.6, if ever. I don't think typeshed ever supported those namespaces.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Copy link
Contributor

@hauntsaninjahauntsaninja left a comment

Choose a reason for hiding this comment

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

Hooray! Shall we merge?

@JelleZijlstra
Copy link
Member

As far as I can tell we emit a DeprecationWarning only on 3.11, not 3.10. Therefore, followinghttps://peps.python.org/pep-0387/#making-incompatible-changes we should wait until 3.13, not 3.12, to remove these.

@srittau
Copy link
ContributorAuthor

srittau commentedOct 10, 2022
edited
Loading

In that case we need to retroactively update the documentation, which says that they will be removed in Python 3.12.

@warsaw
Copy link
Member

I just documented it in my doc:https://pythondev.readthedocs.io/test_next_python.html#top-5000-pypi-packages

I wonder if there's any way to automate this, say, given some special tag for deprecation removals?

@hauntsaninjahauntsaninja removed the 3.12only security fixes labelOct 28, 2022
@hauntsaninjahauntsaninja marked this pull request as draftDecember 22, 2022 22:23
@srittau
Copy link
ContributorAuthor

The "What's new" comment needs to be moved to the 3.13 document when it becomes available.

@JelleZijlstra
Copy link
Member

We're now ready to remove this in 3.13.@srittau do you want to update the PR?

AlexWaygood reacted with thumbs up emoji

@JelleZijlstraJelleZijlstra self-assigned thisMay 23, 2023
Move NEWS entry from 3.12 to 3.13.
@srittausrittau marked this pull request as ready for reviewMay 23, 2023 10:46
@srittau
Copy link
ContributorAuthor

Done, merged main and moved the NEWS entry in the process.

Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks@srittau!

Copy link
Member

@AlexWaygoodAlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM too :) thanks!

@JelleZijlstraJelleZijlstra merged commitabdda5b intopython:mainMay 23, 2023
@srittausrittau deleted the rm-typing-submodules branchMay 23, 2023 15:07
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@methanemethanemethane left review comments

@gvanrossumgvanrossumgvanrossum left review comments

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

@hauntsaninjahauntsaninjahauntsaninja approved these changes

@AlexWaygoodAlexWaygoodAlexWaygood approved these changes

@Fidget-SpinnerFidget-SpinnerAwaiting requested review from Fidget-Spinner

Assignees

@JelleZijlstraJelleZijlstra

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

10 participants
@srittau@Fidget-Spinner@JelleZijlstra@gvanrossum@vstinner@warsaw@methane@hauntsaninja@AlexWaygood@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp