Skip to content

gh-133403: Type Tools/build/verify_ensurepip_wheels.py and check it with mypy #133453

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

Merged
merged 8 commits into from
May 8, 2025

Conversation

Flosckow
Copy link
Contributor

@Flosckow Flosckow commented May 5, 2025

Add typing for verify_ensurepip_wheels and check it with mypy.
related to #133403 (comment)

@bedevere-app
Copy link

bedevere-app bot commented May 5, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

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.

Thanks! Several suggestions

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.

I can't merge your PR right now, because we are waiting for the first 3.14 beta release and the branch is locked. https://discuss.python.org/t/python-3-14-0-beta-1-is-near/90921

But, this looks good to me. Thanks a lot!
Congrats on your first CPython PR 🎉

@Flosckow
Copy link
Contributor Author

Flosckow commented May 6, 2025

@sobolevn, thx for your review))

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.

I fixed the merge conflicts for you, but please, add new dependencies for mypy job here:

- "Tools/build/generate_sbom.py"

So, it would match definitions in our mypy.ini file.

@picnixz picnixz changed the title pythongh-133403: Type Tools/build/verify_ensurepip_wheels.py and check it with mypy gh-133403: Type Tools/build/verify_ensurepip_wheels.py and check it with mypy May 8, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented May 8, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@Flosckow
Copy link
Contributor Author

Flosckow commented May 8, 2025

@sobolevn, thx, I have added the check to the workflow.

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.

Thank you!

@sobolevn sobolevn added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels May 8, 2025
@sobolevn sobolevn enabled auto-merge (squash) May 8, 2025 17:27
@sobolevn sobolevn merged commit 5f3d3f2 into python:main May 8, 2025
47 checks passed
@miss-islington-app
Copy link

Thanks @Flosckow for the PR, and @sobolevn 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 May 8, 2025
…mypy (pythonGH-133453)

(cherry picked from commit 5f3d3f2a6c8ddf7a6be340c3f4c696e2a5eb51f0)

Co-authored-by: Flosckow <66554425+Flosckow@users.noreply.github.com>
Co-authored-by: Daniil Dumchenko <dumchenko.de@sibvaleo.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2025
…mypy (pythonGH-133453)

(cherry picked from commit 5f3d3f2a6c8ddf7a6be340c3f4c696e2a5eb51f0)

Co-authored-by: Flosckow <66554425+Flosckow@users.noreply.github.com>
Co-authored-by: Daniil Dumchenko <dumchenko.de@sibvaleo.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

GH-133689 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 May 8, 2025
@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

GH-133690 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 May 8, 2025
sobolevn added a commit that referenced this pull request May 8, 2025
… mypy (GH-133453) (#133690)

gh-133403: Check `Tools/build/verify_ensurepip_wheels.py` with mypy (GH-133453)
(cherry picked from commit 5f3d3f2)

Co-authored-by: Flosckow <66554425+Flosckow@users.noreply.github.com>
Co-authored-by: Daniil Dumchenko <dumchenko.de@sibvaleo.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request May 8, 2025
… mypy (GH-133453) (#133689)

gh-133403: Check `Tools/build/verify_ensurepip_wheels.py` with mypy (GH-133453)
(cherry picked from commit 5f3d3f2)

Co-authored-by: Flosckow <66554425+Flosckow@users.noreply.github.com>
Co-authored-by: Daniil Dumchenko <dumchenko.de@sibvaleo.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot iOS ARM64 Simulator 3.13 (tier-3) has failed when building commit c2cddb7.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1386/builds/1298) and take a look at the build logs.
  4. Check if the failure is related to this commit (c2cddb7) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1386/builds/1298

Failed tests:

  • test_socket

Failed subtests:

  • testSourceAddress - test.test_socket.NetworkConnectionAttributesTest.testSourceAddress
  • test_UnixDatagramServer - test.test_socketserver.SocketServerTest.test_UnixDatagramServer

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 240, in serve_forever
    self._handle_request_noblock()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 320, in _handle_request_noblock
    self.handle_error(request, client_address)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 318, in _handle_request_noblock
    self.process_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 349, in process_request
    self.finish_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 362, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 768, in __init__
    self.finish()
    ~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 863, in finish
    self.socket.sendto(self.wfile.getvalue(), self.client_address)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 54] Connection reset by peer
ERROR


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 222, in test_UnixDatagramServer
    self.run_server(socketserver.UnixDatagramServer,
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    socketserver.DatagramRequestHandler,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    self.dgram_examine)
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/support/threading_helper.py", line 66, in decorator
    return func(*args)
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 133, in run_server
    testfunc(svrcls.address_family, addr)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 160, in dgram_examine
    buf = data = receive(s, 100)
                 ~~~~~~~^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 43, in receive
    raise RuntimeError("timed out on %r" % (sock,))
RuntimeError: timed out on <socket.socket fd=23, family=1, type=2, proto=0, laddr=./test_python_rn15bc39.sock>


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socket.py", line 417, in raise_queued_exception
    raise self.queue.get()
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socket.py", line 454, in clientRun
    test_func()
    ~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/9449EF01-B9BB-463B-BC72-6BBF98F28897/data/Containers/Bundle/Application/57FFADF3-7B3F-4171-9706-296D30AE6DB0/iOSTestbed.app/python/lib/python3.13/test/test_socket.py", line 5783, in _testSourceAddress
    self.assertEqual(self.cli.getsockname()[1], self.source_port)
                     ~~~~~~~~~~~~~~~~~~~~^^
OSError: [Errno 9] Bad file descriptor

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