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

Inform Pants about our target python versions (3.6 and 3.8) #5795

Merged
merged 4 commits into from
Dec 1, 2022

Conversation

cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Nov 4, 2022

Background

This is another part of introducing pants, as discussed in various TSC meetings.

Related PRs can be found in:

Overview of this PR

Our 3rd party dependencies will be in a lockfile that looks like lockfiles/st2.lock. But, before pants can generate that, we need to add several pieces of metadata including dependencies and python version constraints.

This PR focuses on registering our python version constraints (in pants.toml). Other PRs will add the dependencies (see #5789) and other metadata so that we can actually generate the lockfile.

This PR also regenerates the lockfiles for bandit, black, and flake8 to use the new interpreter constraints. (most of the changed lines are part of this)

Relevant Pants documentation

Python Version Constraints

We support python 3.6 and python 3.8; We do not officially support python 3.7.

I opted for a broader version constraint:

CPython>=3.6,<3.9

Instead of excluding python 3.7 like this:

CPython>=3.6,!=3.7.*,<3.9

NOTE: the black wheels for 3.6 require >=3.6.2, so I had to use that or pants+pex fails to resolve the lockfile.

I went with the broader constraint because:
Python 3.6 is EOL. But some people still use old (probably EOL) distros where 3.8 is not an easy option. So, 3.7 might be a decent option, even though it won't be officially "supported". All of our official efforts can go towards adding python 3.9 and later support. But, if for some reason someone goes to the effort to test and use python3.7 instead, good for them; Let's not put technical barriers in their path unless we have known issues on particular versions of python 3.7.

@cognifloyd cognifloyd added this to the pants milestone Nov 4, 2022
@cognifloyd cognifloyd self-assigned this Nov 4, 2022
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Nov 4, 2022
@pull-request-size pull-request-size bot added size/XL PR that changes 500-999 lines. Consider splitting work into several ones that easier to review. and removed size/L PR that changes 100-499 lines. Requires some effort to review. labels Nov 4, 2022
@nzlosh
Copy link
Contributor

nzlosh commented Nov 22, 2022

Why not include python 3.10 and 3.11?

@cognifloyd
Copy link
Member Author

I'm trying to configure pants to match our current setup, with python 3.6 and 3.8. I haven't tried to use newer python versions because I'm trying to minimize what it takes to get pants into the repo.

Pants+PEX do not support the legacy pip resolver any more. Our current set of manually pinned requirements includes a few conflicting requirements that legacy pip only warns about, and the newer pip resolver fails with. So, to get the benefits of the lockfile (instead of manually pinning everything), we already have to make changes to our requirements. Including more python versions will probably require additional reqs changes.

When we update to newer python versions, pants will be helpful and should make that process easier. But with so much changing already, I would prefer to update python support separately from introducing pants.

@cognifloyd
Copy link
Member Author

#5817 should be merged before this one as it only deals with the pants 2.14 upgrade instead of throwing it into this PR.

@cognifloyd
Copy link
Member Author

I rebased this on master to drop the commit that was covered by #5817 (now merged). This needs one more review before it can be merged. Then, I'll work on preparing the next batch of pants PRs.

Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

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

LGTM

@cognifloyd cognifloyd merged commit 0592aa1 into master Dec 1, 2022
@cognifloyd cognifloyd deleted the pants-py-constraints branch December 1, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependency pantsbuild python3 size/XL PR that changes 500-999 lines. Consider splitting work into several ones that easier to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants