Skip to content

Commit

Permalink
Remove deprecated default ICs.
Browse files Browse the repository at this point in the history
Now a repo must explicitly specify ICs.
  • Loading branch information
benjyw committed Mar 30, 2023
1 parent 37b3001 commit 1d274a0
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions src/python/pants/backend/python/subsystems/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from packaging.utils import canonicalize_name

from pants.base.deprecated import warn_or_error
from pants.core.goals.generate_lockfiles import UnrecognizedResolveNamesError
from pants.option.option_types import (
BoolOption,
Expand Down Expand Up @@ -60,11 +59,10 @@ class PythonSetup(Subsystem):
options_scope = "python"
help = "Options for Pants's Python backend."

default_interpreter_constraints = ["CPython>=3.7,<4"]
default_interpreter_universe = ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]

_interpreter_constraints = StrListOption(
default=default_interpreter_constraints,
default=None,
help=softwrap(
"""
The Python interpreters your codebase is compatible with.
Expand All @@ -83,26 +81,25 @@ class PythonSetup(Subsystem):

@memoized_property
def interpreter_constraints(self) -> tuple[str, ...]:
# TODO: In 2.17.0.dev2 we should set the default above to None and tweak the message here
# appropriately.
if self.options.is_default("interpreter_constraints"):
warn_or_error(
"2.17.0.dev2",
"the factory default interpreter constraints value",
if not self._interpreter_constraints:
raise ValueError(
softwrap(
f"""\
You're relying on the default interpreter constraints that ship with Pants
({self._interpreter_constraints}). This default is deprecated, in favor of
explicitly specifying the interpreter versions your code is actually intended to
run against.
You specify interpreter constraints using the `interpreter_constraints` option in
the `[python]` section of pants.toml. We recommend constraining to a single interpreter
minor version if you can, e.g., `interpreter_constraints = ['==3.11.*']`, or at
least a small number of interpreter minor versions, e.g., `interpreter_constraints
= ['>=3.10,<3.12']`. See {doc_url("python-interpreter-compatibility")} for details.
Set explicit interpreter constraints now to get rid of this warning.
You must explicitly specify the default Python interpreter versions your code
is intended to run against.
You specify these interpreter constraints using the `interpreter_constraints`
option in the `[python]` section of pants.toml.
We recommend constraining to a single interpreter minor version if you can,
e.g., `interpreter_constraints = ['==3.11.*']`, or at least a small number of
interpreter minor versions, e.g., `interpreter_constraints = ['>=3.10,<3.12']`.
Individual targets can override these default interpreter constraints,
if different parts of your codebase run against different python interpreter
versions in a single repo.
See {doc_url("python-interpreter-compatibility")} for details.
"""
),
)
Expand Down

0 comments on commit 1d274a0

Please sign in to comment.