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

Deprecate the compatibility field in favor of interpreter_constraints #11074

Merged
merged 3 commits into from
Oct 29, 2020

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Oct 29, 2020

This solves two problems:

  1. [python-setup].interpreter_constraints did not align with compatibility.
  2. StringOrStringSequenceField is confusing. It's better to always use SequenceField.*

*We can't use StringField as found in #9273 (comment).

[ci skip-rust]
[ci skip-build-wheels]

…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.
Copy link
Contributor Author

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.*']`
Copy link
Contributor Author

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).
Copy link
Contributor Author

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.

Comment on lines +207 to +210
@classmethod
def create_from_targets(
cls, targets: Iterable[Target], python_setup: PythonSetup
) -> "PexInterpreterConstraints":
Copy link
Contributor Author

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.

@Eric-Arellano
Copy link
Contributor Author

fyi @rcuza

# 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]
# 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]
@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling cdf4fbc on Eric-Arellano:dep-compat into 9dc89b6 on pantsbuild:master.

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +57 to +58
class InterpreterConstraintsField(StringSequenceField):
"""The Python interpreters this code is compatible with.
Copy link
Member

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".

Copy link
Contributor Author

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.

@Eric-Arellano Eric-Arellano merged commit 47b583e into pantsbuild:master Oct 29, 2020
@Eric-Arellano Eric-Arellano deleted the dep-compat branch October 29, 2020 18:21
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.

4 participants