Skip to content

Declare Python 3.14 support #13506

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 3 commits into from
Jul 28, 2025
Merged

Declare Python 3.14 support #13506

merged 3 commits into from
Jul 28, 2025

Conversation

ichard26
Copy link
Member

🤞 CI passes

@ichard26
Copy link
Member Author

Oh urgh, Windows CI is failing on Python 3.14. I understand that at least some of these failures are going to be fixed with #13496. I guess #13501 really is necessary to properly support Python 3.14. Great. cc @barneygale

@barneygale
Copy link
Contributor

I'm very happy to go through those patches line-by-line and answer any questions you might have! Let me know if I can help some other way.

@ichard26
Copy link
Member Author

OK, with #13496 merged, let's see what failures are left. AFAIU, they're going to be related with the URL/filepath handling in the collector (and possibly requirement parser?) which makes me uneasy. Changing the tests is one thing, but changing actual pip logic is dicier.

@ichard26
Copy link
Member Author

OK, there are four failures left:

FAILED tests/unit/test_collector.py::test_clean_url_path_with_local_path[/T:/with space/[email protected]///T:/with%20space/[email protected]] - AssertionError: assert '/T:/with%20s.../[email protected]' == '///T:/with%2.../[email protected]'
  
  - ///T:/with%20space/[email protected]
  ? --
  + /T:/with%20space/[email protected]
FAILED tests/unit/test_collector.py::test_ensure_quoted_url[file:///T:/path/with spaces/-file://///T:/path/with%20spaces/] - AssertionError: assert 'file:///T:/p...ith%20spaces/' == 'file://///T:...ith%20spaces/'
  
  - file://///T:/path/with%20spaces/
  ?      --
  + file:///T:/path/with%20spaces/
FAILED tests/unit/test_collector.py::test_ensure_quoted_url[git+file:///T:/with space/[email protected]#egg=my-package-1.0-git+file://///T:/with%20space/[email protected]#egg=my-package-1.0] - AssertionError: assert 'git+file:/T:...y-package-1.0' == 'git+file:///...y-package-1.0'
  
  - git+file://///T:/with%20space/[email protected]#egg=my-package-1.0
  ?          ----
  + git+file:/T:/with%20space/[email protected]#egg=my-package-1.0
FAILED tests/unit/test_req.py::TestRequirementSet::test_unsupported_hashes - FileNotFoundError: [Errno 2] No such file or directory: '\\\\D:\\Temp\\pytest-of-runneradmin\\pytest-0\\popen-gw2\\test_unsupported_hashes0\\data\\packages\\FSPkg'

I'm not comfortable with including the entirety of PR #13501 given I am barely a URL/filepath expert, but I don't understand why these tests are failing in the first place.

I think you looked at these failures @barneygale. Are these tests simply wrong or is the pip logic itself broken? If the tests themselves are broken, then I'd prefer including a test-only fix or just skipping the tests on 3.14 (and reenable them once we get everything sorted out after the release crunch).

@barneygale
Copy link
Contributor

barneygale commented Jul 27, 2025

Are these tests simply wrong or is the pip logic itself broken?

Both, unfortunately. The test_ensure_quoted_url expectations are incorrect - there should be three leading slashes in both cases. That will resolve the second failure. The remaining three failures all point to problems in pip itself.

@barneygale
Copy link
Contributor

barneygale commented Jul 27, 2025

Actually, I think the test_unsupported_hashes failure points to a regression in CPython. I've got a fix ready to merge into the 3.14 branch.

@barneygale
Copy link
Contributor

The Ubuntu failures in test_proxy are new to me - any idea what's going on there?

@ichard26
Copy link
Member Author

The Ubuntu failures in test_proxy are new to me - any idea what's going on there?

Seems like some underlying change in multiprocessing or some related module in Python 3.14 now means our test suite uses unix sockets. We have a pytest plugin installed that blocks sockets by default to avoid mistakenly adding tests that rely on the Internet. Local unix sockets are totally fine, of course. I've added them to the allowlist.

@ichard26
Copy link
Member Author

I fixed the test_unsupported_hashes test to use pip's own path -> URL function instead of simply adding file:// which results in the malformed file://C:/file. I realize that this will be better handled in the next 3.14 release (as a matter of backwards compatibility) but the test suite shouldn't be relying on such behaviour anyway.

I marked test_build_deps_use_proxy_from_cli as a xfail on Python 3.14+ because it seems to be an intermittent issue with proxy.py or something else with our test suite. I can only reproduce the failure locally if I run the test suite with two workers 🙃. Given it doesn't seem to be a problem with pip itself, I'm prioritizing getting 25.2 released on time than doing a full proper investigation into what's wrong.

@ichard26 ichard26 force-pushed the 3.14 branch 2 times, most recently from 6caad55 to 03f3d19 Compare July 28, 2025 21:33
ichard26 added 2 commits July 28, 2025 17:34
Seems like some underlying change in multiprocessing or some related
module in Python 3.14 now means our test suite uses unix sockets. We
have a pytest plugin installed that blocks sockets by default to avoid
mistakenly adding tests that rely on the Internet. Local unix sockets
are totally fine, of course. I've added them to the allowlist.
@ichard26
Copy link
Member Author

what a 🔥 🗑️ argh! I'm pretty confident that there are more broken unit tests (f"file://{path}" is a very common pattern, unfortunately) but those can be dealt with later.

Fixed the test_unsupported_hashes and test_install_editable_with_wrong_egg_name
tests to use pip's own path -> URL function instead of simply adding file://
which results in the malformed file://C:/. This will be handled gracefully in
the next 3.14 release (as a matter of backwards compatibility) but the test
suite shouldn't be relying on such behaviour anyway.

Marked test_build_deps_use_proxy_from_cli as a xfail on Python 3.14+
because it seems to be an intermittent issue with proxy.py or something
else with our test suite. I can only reproduce the failure locally if I
run the test suite with two workers 🙃. Given it doesn't seem to be a
problem with pip itself, I'm prioritizing getting 25.2 released on time
than doing a full proper investigation into what's wrong.
@ichard26 ichard26 merged commit 4fe68d7 into pypa:main Jul 28, 2025
34 checks passed
@ichard26
Copy link
Member Author

🎉 thank you very much @barneygale for all of your help! There is more work to be done, but we can relax for a few days as I cut the release on the 30th.

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.

2 participants