pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.31k stars 636 forks source link

Update Pants to not default to Python 3.6 #14722

Closed Eric-Arellano closed 2 years ago

Eric-Arellano commented 2 years ago

Python 3.6 is End of Life, so it's not good that Pants is still defaulting to this:

https://github.com/pantsbuild/pants/blob/b00b84652dc44947b8a614409e9a5e7a391a0faf/src/python/pants/backend/python/subsystems/setup.py#L37

Updating is as simple as changing the value, but it's possible that some of our tests may fail if they are relying on this default. CI should pick this up.

While fixing this, we should include Python 3.11 in the known universe by simply adding it to this line

https://github.com/pantsbuild/pants/blob/b00b84652dc44947b8a614409e9a5e7a391a0faf/src/python/pants/backend/python/subsystems/setup.py#L38

It would also be excellent to audit all of our PythonTool instances for their default interpreter constraints, e.g. Black. Anything that sets the class property default_interpreter_constraints. Even if the tool can run with Python 3.6, I think we should update our default to be 3.7+ because 3.6 will not have security updates. We don't want to ever default to anything before 3.7 imo.

danxmoran commented 2 years ago

I'm interested in taking this one on

Eric-Arellano commented 2 years ago

That'd be a huge help, @danxmoran! Check out https://www.pantsbuild.org/docs/contributor-overview for a guide on contributions :)

danxmoran commented 2 years ago

@Eric-Arellano should I add the <4 upper bound to any constraints where I find it missing? i.e. convert:

default_interpreter_constraints = ["CPython>=3.6"]

into:

default_interpreter_constraints = ["CPython>=3.7,<4"]

?

Eric-Arellano commented 2 years ago

I think probably? Python developers have proactively said they won't release Python 4, so in practice it probably shouldn't matter. But it still makes sense to hardcode that assumption.