-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Deprecate the compatibility
field in favor of interpreter_constraints
#11074
Conversation
…nts` # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
If this is left off, this will default to the option `interpreter_constraints` in the | ||
[python-setup] scope. | ||
If the field is not set, it will default to the option | ||
`[python-setup].interpreter_constraints]`. | ||
|
||
See https://www.pantsbuild.org/docs/python-interpreter-compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to update this link to be interpreter-constraints
, but probably not worth breaking the URL.
|
||
This should be written in Requirement-style format, e.g. `CPython==2.7.*` or `CPython>=3.6,<4`. | ||
As a shortcut, you can leave off `CPython`, e.g. `>=2.7` will be expanded to `CPython>=2.7`. | ||
Specify more than one element to OR the constraints, e.g. `['PyPy==3.7.*', 'CPython==3.7.*']` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want an example to mention PyPy.
@@ -1,139 +0,0 @@ | |||
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to delete in an earlier PR.
@classmethod | ||
def create_from_targets( | ||
cls, targets: Iterable[Target], python_setup: PythonSetup | ||
) -> "PexInterpreterConstraints": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful regardless of this PR. We were duplicating a pattern in several places.
fyi @rcuza |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
class InterpreterConstraintsField(StringSequenceField): | ||
"""The Python interpreters this code is compatible with. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit odd that the name and the definition swapped here... it used to be named compatibility
and be described as "constraints on the target", and now it's named constraints
and described as "what the code is compatible with".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I think that's because both are valid ways of describing this mechanism. Now that the field's name expresses the idea of "interpreter constraints", we can switch the description to cover the point previously expressed via the field name compatibility
.
This solves two problems:
[python-setup].interpreter_constraints
did not align withcompatibility
.StringOrStringSequenceField
is confusing. It's better to always useSequenceField
.**We can't use
StringField
as found in #9273 (comment).[ci skip-rust]
[ci skip-build-wheels]