diff --git a/src/python/pants/backend/python/subsystems/setup.py b/src/python/pants/backend/python/subsystems/setup.py index c47bc4e29a8c..aacc12ef1c0d 100644 --- a/src/python/pants/backend/python/subsystems/setup.py +++ b/src/python/pants/backend/python/subsystems/setup.py @@ -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, @@ -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. @@ -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. """ ), )