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

Built-in lockfiles won't work with Python 3.13, due to pip version #20852

Closed
huonw opened this issue Apr 27, 2024 · 3 comments
Closed

Built-in lockfiles won't work with Python 3.13, due to pip version #20852

huonw opened this issue Apr 27, 2024 · 3 comments
Labels
backend: Python Python backend-related issues bug

Comments

@huonw
Copy link
Contributor

huonw commented Apr 27, 2024

Describe the bug

Similar to #20354, our builtin lockfiles at the time of writing may not work with Python 3.13. They use pip_version: "24.0", which doesn't work with python 3.13 due to pypa/pip#12462. Once there's a pip version with that fix, and a PEX version with that pip version, we should upgrade and regenerate the lockfiles to be ready for Python 3.13 promptly.

Pants version

#20851

OS
N/A

Additional info
#20851

@huonw huonw added bug backend: Python Python backend-related issues labels Apr 27, 2024
huonw added a commit that referenced this issue Apr 27, 2024
This adds Python 3.13 to the default interpreter universe, so that we're
more ready to hit the ground running when it is eventually released.

https://peps.python.org/pep-0719/ suggests the plan is 3.13.0 stable
release on 2024-10-01. This PR will flow into Pants 2.22.0. We won't be
releasing 2.22.0 before 2024-07-09 (12 weeks after 2.20.0, on
2024-04-16), so there's a bit of slack even if 2.21 and 2.22 take longer
than 6 weeks to get out the door.

It looks like we won't be perfectly ready, because there's a similar
lockfile issue to #20354 for Python 3.12: our lockfiles use pip 24.0
which apparently doesn't support Python 3.13 (needs
pypa/pip#12462). Thus, we'll need to regenerate
our lockfiles once there's a pex release with a pip release with
pypa/pip#12462. I've filed
#20852 to track this.
@huonw
Copy link
Contributor Author

huonw commented Jun 24, 2024

Potentially need to do #21103 first, to smoothly drop support for 3.7.

cburroughs added a commit to cburroughs/pants that referenced this issue Sep 10, 2024
As a consequence, most tests no longer work with 3.7 since -- for
example -- the lockfile with pytest does not support 3.7.  This
downgrades 3.7 to "probably works but not well tested", which
is the same state as 3.6.  Since 3.7 has been EoL for over a year I
think this is reasonable.  This opens up the way for Python 3.13
support in lockfiles among other benefits.

As another consequence, lockfiles are regenerated which means we have
some new versions coming along for the ride.  The pretty lockfile diff
does not seem to work with the generation script though --> pantsbuild#21388

Uses of Pants can still use 3.7 by generating their own
lockfiles. Deprecation plan annouced at
https://www.pantsbuild.org/blog/2024/08/24/venerable-pythons

Based off work started in pantsbuild#21314

ref pantsbuild#21184, pantsbuild#21103, pantsbuild#20852
cburroughs added a commit that referenced this issue Sep 12, 2024
As a consequence, most tests no longer work with 3.7 since -- for
example -- the lockfile with pytest does not support 3.7. This
downgrades 3.7 to "probably works but not well tested", which is the
same state as 3.6. Since 3.7 has been EoL for over a year I think this
is reasonable. This opens up the way for Python 3.13 support in
lockfiles among other benefits.

As another consequence, lockfiles are regenerated which means we have
some new versions coming along for the ride. The pretty lockfile diff
does not seem to work with the generation script though --> #21388

Uses of Pants can still use 3.7 by generating their own lockfiles.
Deprecation plan announced at
https://www.pantsbuild.org/blog/2024/08/24/venerable-pythons

Based off work started in #21314

ref #21184, #21103, #20852
@cburroughs
Copy link
Contributor

pypa/pip@0807480

So I think the version of pip needed is 24.1? All the lockfiles are now generated with 24.2 now so I think this is mostly set. For python 3.13 out of the box completeness I suppose we should bump the default pip_version.

image

cburroughs added a commit to cburroughs/pants that referenced this issue Sep 12, 2024
The first version of pip to support Python 3.13 was 24.1, but I don't
think there is any merit to holding back when 24.2 is already
out. (Pants itself uses `latest`.) The first version of Pex to
support 24.2 is v2.13.0.

(Pip 24.1 and 24.2 also both contain meaningful performance
improvements to dependency resolution --> pantsbuild#21223)

Release notes for where pex added support:
https://github.com/pex-tool/pex/releases/tag/v2.13.0

ref pantsbuild#20852
cburroughs added a commit that referenced this issue Sep 16, 2024
The first version of pip to support Python 3.13 was 24.1, but I don't
think there is any merit to holding back when 24.2 is already out.
(Pants itself uses `latest`.) The first version of Pex to support 24.2
is v2.13.0.

(Pip 24.1 and 24.2 also both contain meaningful performance improvements
to dependency resolution --> #21223)

Release notes for where pex added support:
https://github.com/pex-tool/pex/releases/tag/v2.13.0

ref #20852
huonw added a commit that referenced this issue Nov 5, 2024
This runs `pants run
src/python/pants/backend/python/providers/python_build_standalone/scripts/generate_urls.py`
to change the Python versions provided by
`pants.backend.python.providers.experimental.python_build_standalone`.

Added:

- 3.12.7
- 3.13.0
- 3.13.0rc3

Changed (to a newer build):

- 3.8.20
- 3.9.20
- 3.10.15
- 3.11.10

Note that #20852 may mean 3.13.0 may not work smoothly yet.
@huonw
Copy link
Contributor Author

huonw commented Nov 17, 2024

@krishnan-chandra pointed out to me that #21389 / #21400 may've fixed this for the 2.24.x release series. Indeed, this test-case (adapted from #20354) fails as written with 2.23.0a0, but works with 2.24.0.dev0:

# cd $(mktemp -d)

cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.23.0a0"

backend_packages = [
  "pants.backend.python",
]

[python]
interpreter_constraints = ["==3.13.*"]
EOF

echo 'python_tests(name="t")' > BUILD
echo 'def test_foo(): pass' > test_example.py

# BUG: fails by default with Python 3.13
pants test ::

# OKAY: works fine
pants test --python-interpreter-constraints='["==3.12.*"]' ::

Thanks @cburroughs !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Python Python backend-related issues bug
Projects
None yet
Development

No branches or pull requests

2 participants