Skip to content

Update Pants internal Python to 3.14#22816

Merged
sureshjoshi merged 40 commits intopantsbuild:mainfrom
sureshjoshi:python314
Feb 21, 2026
Merged

Update Pants internal Python to 3.14#22816
sureshjoshi merged 40 commits intopantsbuild:mainfrom
sureshjoshi:python314

Conversation

@sureshjoshi
Copy link
Copy Markdown
Member

@sureshjoshi sureshjoshi commented Oct 27, 2025

Previous update to 3.11 here (#21528)

Edit: Segfault city over here in CI - not on my Mac M2
Segfaults gone once updated pyo3 and set abi3 as a feature. I'm going to remove that explicit feature and see what happens, as there is a pretty good chance the segfaults were maybe some stale rust cache/objects or something.
Reasonable chance I'm an idiot - I think I forgot to update 3.14 in common.sh - causing all the segfaults.

Review and pre-merge notes:

  • Pylint updated to >=4.0.0 (supports 3.14, drops support for 3.9)
  • Shoalsoft plugin doesn't support 3.14 yet, commented out (Tom said he'd look at this once we cut a 2.32 dev with this)
  • PyUpgrade skipped (would change every file, will do in follow-up PR)
  • Docformatter skipped due to missing 3.14 support (until next release - Feb 21, 2026 - still waiting for release)
  • Agreement on common constraints format for easier grepping ("a.b.*" vs ">=A, <B")
  • Agreement on defaulting ICSes to "<4" vs "<3.15" (I'm on team "<4" for all subsystems, "<3.15" for Pants internal) (using "<3.15" - merged in Updated all python subsystem constraints to 3.14 #22890)
  • scie-pants likely needs update, and we need to update minimum SCIE-PANTS version in Pants (untested, so currently a theory - update was made a while ago, but for consistency with previous upgrades, we build this, then updates tests over there)

Python Removals:

https://docs.python.org/3/whatsnew/3.12.html#removed
https://docs.python.org/3/whatsnew/3.13.html#removed
https://docs.python.org/3/whatsnew/3.14.html#removed

Relevant setuptools (this was done in an associated PR, still good to note that it was done for this update):
https://setuptools.pypa.io/en/latest/history.html#v66-1-0 (3.12 removed distutils and ImpImporter)

Associated PRs:

To keep this PR smaller

https://docs.python.org/3/whatsnew/3.14.html#changes-in-annotations-pep-649-and-pep-749

Removed ForwardRef patch that throws TypeErrors, but not needed as Python 3.10+ supports unions as pipes

Updated default_unowned_deps for annotationlib (and whatever else came along)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was for annotationlib specifically, but looks like this hasn't been kept up in general - so I added whatever was available, and pulled back in some of the removals.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm going back into this file to re-work what I had as a "pass the tests" solution, I don't like it - shouldn't stop review of the 3.14 branch though.

field_set: TrivyTerraformFieldSet


def _is_terraform_deployment_field_set(fs: Any) -> TypeGuard[TerraformDeploymentFieldSet]:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Satisfy mypy


# First version with working Python 3.11 support:
# https://github.com/pantsbuild/scie-pants/releases/tag/v0.12.2
# TODO: Likely still need to update scie-pants
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

NOTE TO SELF... Need scie-pants update before this lands (though, I haven't actually tested scie-pants on this, I just don't think we have 3.14 support in there yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a tracking issue for proving out required scie-pants updates?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

pantsbuild/scie-pants#486

I haven't looked at it yet, as I'm afk most of today and tomorrow. I don't think it's hard, just a thing to do (if it already doesn't work).

@sureshjoshi sureshjoshi marked this pull request as ready for review November 13, 2025 14:43
@sureshjoshi
Copy link
Copy Markdown
Member Author

Reviewers: For all the lines changed, and the number of files/commits - the non-generated changeset is actually pretty low. I've tried to flag with comments and change of substance, otherwise it was updating default constraints, and re-generating actions or lockfiles.

Might be worth putting eyeballs on the lock.metadata files to ensure I didn't screw anything up.

This is ready for review, but won't be merged until scie-pants is updated. I also have a couple of clean-up tasks which won't affect review. Just cleaning up some comments and re-working my pylint change, as I don't particularly like it.

@sureshjoshi
Copy link
Copy Markdown
Member Author

FYI - For the eventual review notes (to be done once the scie-pants situation is sorted out), I'm going to copy/paste the 3.11 notes and also mention the pylint update: https://github.com/pantsbuild/pants/pull/21528/files#diff-93e66ca9f66b0b633d08d55724e0237f5d587679ac01baaff68b1e9110d492b7

Copy link
Copy Markdown
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

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

We can increase the default tool (ie: subsystems w/ builtin lockfiles) interpreter constraints range to include Python 3.14 without updating the version of Python that pants itself uses.

So, to minimize this PR (make it focused more on core code changes), would you please move the tool (subsystem) lockfile updates to a separate PR? That PR could be merged sooner as it would not be blocked on a scie-pants update.

Also, would you please capture the lockfile diffs, and include them in the PR description or PR comment(s)? Many of them don't have a difference, but it's nice to know which libraries get upgraded or removed.

Copy link
Copy Markdown
Member

@cognifloyd cognifloyd Nov 13, 2025

Choose a reason for hiding this comment

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

certifi             2025.8.3 --> 2025.11.12
charset-normalizer     3.4.3 --> 3.4.4
idna                    3.10 --> 3.11
iniconfig              2.1.0 --> 2.3.0
pytest                 8.4.2 --> 9.0.1

Copy link
Copy Markdown
Member

@cognifloyd cognifloyd Nov 13, 2025

Choose a reason for hiding this comment

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

coverage           7.10.7 --> 7.11.3
iniconfig           2.1.0 --> 2.3.0
execnet             2.1.1 --> 2.1.2
ipython             9.6.0 --> 9.7.0
matplotlib-inline   0.1.7 --> 0.2.1
pytest-asyncio      1.2.0 --> 1.3.0

Removed: typing-extensions

Comment thread src/python/pants/backend/python/subsystems/python_tool_base.py Outdated
@cburroughs
Copy link
Copy Markdown
Contributor

Agreement on defaulting ICSes to "<4" vs "<3.15" (I'm on team "<4" for all subsystems, "<3.15" for Pants internal)

Feel free to point me at another discussion. But what does <4 get a user in practice? There won't be Python 3.42 wheels in the lockfile until someone re-generates it anyway.

@sureshjoshi
Copy link
Copy Markdown
Member Author

Agreement on defaulting ICSes to "<4" vs "<3.15" (I'm on team "<4" for all subsystems, "<3.15" for Pants internal)

Feel free to point me at another discussion. But what does <4 get a user in practice? There won't be Python 3.42 wheels in the lockfile until someone re-generates it anyway.

#22816 (comment)

In short, for me it just means we can stick to generate-lockfiles for 3.15+ support, in lieu of "go through the code and update all the appropriate constraints and re-generate". But, I'm pretty strongly neutral in the grand scheme - so I'll create a PR which updates to <3.15 to reduce churn in here per @cognifloyd

@sureshjoshi
Copy link
Copy Markdown
Member Author

@cognifloyd I merged the "update constraints" PR, and you were right - good idea. It removed like 80 files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

certifi             2025.8.3 --> 2025.11.12
pynacl                 1.6.0 --> 1.6.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

astroid               2.15.8 --> 4.0.2
isort                 5.13.2 --> 7.0.0
platformdirs           4.4.0 --> 4.5.0
pylint                2.17.7 --> 4.0.3

Dropped: lazy-object-proxy, wrapt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I manually created a diff for the other 3rdparty lockfiles. Do you have the lockfile diff for this one?

@sureshjoshi
Copy link
Copy Markdown
Member Author

Alright, so this giant PR has been open for a while, bit-rotting away. I'm thinking it should probably get merged and then built upon - as lockfile updates are merge-conflict city.

return {
"name": "Install Python headers",
"run": "yum install -y python3.11-devel",
"run": "echo 'no-op'",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is passing CI, so I'm hesitant to remove this in this massive PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fine by me to clean up in a follow-up.

Copy link
Copy Markdown
Contributor

@benjyw benjyw left a comment

Choose a reason for hiding this comment

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

Epic!

repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 23.x
- name: Install Python headers
run: yum install -y python3.11-devel
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So this isn't a thing for Python 3.14?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not that I was able to see - it's the one above that I mentioned that since we're passing CI, I'd rather just status quo this one, and remove the call in a separate PR

@sureshjoshi sureshjoshi merged commit 61759ac into pantsbuild:main Feb 21, 2026
25 checks passed
@sureshjoshi sureshjoshi deleted the python314 branch March 23, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants