Skip to content

Commit bda875d

Browse files
authored
Execute or postpone most deprecation-removals scheduled for 2.26 (#21926)
We're starting the 2.26.x release series so the deprecations that were scheduled for removal can be removed. This PR does handles of them. I've postponed a few, since they were only relatively recently deprecated and require very minimal code on our side, so we can be a little more generous to any users. (e.g. the `[GLOBAL].native_options_validation` and `[ruff]` options are unused, so it's just some option definitions that can hang around to be deleted later.) There's an extra deprecation ready for removal in the Python FaaS code, which is done in #21928 instead, because it's more fiddly/extensive.
1 parent 6765504 commit bda875d

File tree

5 files changed

+19
-58
lines changed

5 files changed

+19
-58
lines changed

docs/notes/2.26.x.md

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ Thank you to [Klayvio](https://www.klaviyo.com/) and [Normal Computing](https://
2424

2525
### Backends
2626

27+
#### Python
28+
29+
Some deprecations have expired and been removed:
30+
31+
- the `[export].py_hermetic_scripts` option has been replaced by [the `[export].py_non_hermetic_scripts_in_resolve` option](https://www.pantsbuild.org/2.25/reference/goals/export#py_non_hermetic_scripts_in_resolve)
32+
33+
#### Terraform
34+
35+
For the `tfsec` linter, the deprecation of support for leading `v`s in the `version` and `known_versions` field has expired and been removed. Write `1.28.13` instead of `v1.28.13`.
2736

2837
### Plugin API changes
2938

src/python/pants/backend/python/goals/export.py

+2-37
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from pants.engine.rules import collect_rules, rule
5151
from pants.engine.target import AllTargets, HydratedSources, HydrateSourcesRequest, SourcesField
5252
from pants.engine.unions import UnionMembership, UnionRule
53-
from pants.option.option_types import BoolOption, EnumOption, StrListOption
53+
from pants.option.option_types import EnumOption, StrListOption
5454
from pants.util.strutil import path_safe, softwrap
5555

5656
logger = logging.getLogger(__name__)
@@ -110,38 +110,6 @@ class ExportPluginOptions:
110110
advanced=True,
111111
)
112112

113-
py_hermetic_scripts = BoolOption(
114-
default=True,
115-
help=softwrap(
116-
"""
117-
When exporting a mutable virtualenv for a resolve, by default
118-
modify console script shebang lines to make them "hermetic".
119-
The shebang of hermetic console scripts uses the python args: `-sE`:
120-
121-
- `-s` skips inclusion of the user site-packages directory,
122-
- `-E` ignores all `PYTHON*` env vars like `PYTHONPATH`.
123-
124-
Set this to false if you need non-hermetic scripts with
125-
simple python shebangs that respect vars like `PYTHONPATH`,
126-
to, for example, allow IDEs like PyCharm to inject its debugger,
127-
coverage, or other IDE-specific libs when running a script.
128-
129-
This only applies when when exporting a `mutable_virtualenv`
130-
(`symlinked_immutable_virtualenv` exports are not "full"
131-
virtualenvs because they are used internally by pants itself.
132-
Pants requires hermetic scripts to provide its reproduciblity
133-
guarantee, fine-grained caching, and other features).
134-
"""
135-
),
136-
advanced=True,
137-
removal_version="2.26.0.dev0",
138-
removal_hint=softwrap(
139-
"""
140-
Use `--export-py-non-hermetic-scripts-in-resolve` instead.
141-
"""
142-
),
143-
)
144-
145113
py_non_hermetic_scripts_in_resolve = StrListOption(
146114
help=softwrap(
147115
"""
@@ -284,10 +252,7 @@ async def do_export(
284252
f"--prompt={venv_prompt}",
285253
output_path,
286254
]
287-
if (
288-
req.resolve_name in export_subsys.options.py_non_hermetic_scripts_in_resolve
289-
or not export_subsys.options.py_hermetic_scripts
290-
):
255+
if req.resolve_name in export_subsys.options.py_non_hermetic_scripts_in_resolve:
291256
pex_args.insert(-1, "--non-hermetic-scripts")
292257

293258
post_processing_cmds = [

src/python/pants/backend/python/lint/ruff/subsystem.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -153,36 +153,36 @@ def config_request(self, dirs: Iterable[str]) -> ConfigFilesRequest:
153153
install_from_resolve = StrOption(
154154
advanced=True,
155155
default=None,
156-
removal_version="2.26.0.dev0",
156+
removal_version="2.27.0.dev0",
157157
removal_hint=_removal_hint,
158158
help="Formerly used to customise the version of Ruff to install.",
159159
)
160160

161161
requirements = StrListOption(
162162
advanced=True,
163163
default=None,
164-
removal_version="2.26.0.dev0",
164+
removal_version="2.27.0.dev0",
165165
removal_hint=_removal_hint,
166166
help="Formerly used to customise the version of Ruff to install.",
167167
)
168168
interpreter_constraints = StrListOption(
169169
advanced=True,
170170
default=None,
171-
removal_version="2.26.0.dev0",
171+
removal_version="2.27.0.dev0",
172172
removal_hint=_removal_hint,
173173
help="Formerly used to customise the version of Ruff to install.",
174174
)
175175
console_script = StrOption(
176176
advanced=True,
177177
default=None,
178-
removal_version="2.26.0.dev0",
178+
removal_version="2.27.0.dev0",
179179
removal_hint=_removal_hint,
180180
help="Formerly used to customise the version of Ruff to install.",
181181
)
182182
entry_point = StrOption(
183183
advanced=True,
184184
default=None,
185-
removal_version="2.26.0.dev0",
185+
removal_version="2.27.0.dev0",
186186
removal_hint=_removal_hint,
187187
help="Formerly used to customise the version of Ruff to install.",
188188
)

src/python/pants/backend/terraform/lint/tfsec/tfsec.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from dataclasses import dataclass
55

66
from pants.backend.terraform.target_types import TerraformFieldSet
7-
from pants.base.deprecated import deprecated_conditional
87
from pants.core.goals.lint import LintTargetsRequest
98
from pants.core.util_rules.config_files import ConfigFilesRequest
109
from pants.core.util_rules.external_tool import ExternalTool
@@ -100,26 +99,14 @@ def custom_checks_request(self) -> ConfigFilesRequest:
10099
)
101100

102101
def generate_url(self, plat: Platform) -> str:
103-
deprecated_conditional(
104-
lambda: self.version.startswith("v"),
105-
removal_version="2.26.0.dev0",
106-
entity="using a version beginning with 'v'",
107-
hint=f"Remove the leading 'v' from `[{self.options_scope}].version` and from versions in `[{self.options_scope}].known_versions`",
108-
)
109-
110102
plat_str = {
111103
"macos_arm64": "darwin_arm64",
112104
"macos_x86_64": "darwin_amd64",
113105
"linux_arm64": "linux_arm64",
114106
"linux_x86_64": "linux_amd64",
115107
}[plat.value]
116108

117-
# backwards compatibility with version strings beginning with 'v'
118-
version = self.version
119-
if version.startswith("v"):
120-
version = version[1:]
121-
122-
return f"https://github.com/aquasecurity/tfsec/releases/download/v{version}/tfsec_{version}_{plat_str}.tar.gz"
109+
return f"https://github.com/aquasecurity/tfsec/releases/download/v{self.version}/tfsec_{self.version}_{plat_str}.tar.gz"
123110

124111
def generate_exe(self, _: Platform) -> str:
125112
return "./tfsec"

src/python/pants/option/global_options.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ class BootstrapOptions:
984984
)
985985
native_options_validation = EnumOption(
986986
default=NativeOptionsValidation.warning,
987-
removal_version="2.26.0.dev0",
987+
removal_version="2.27.0.dev0",
988988
removal_hint="The legacy parser has been removed so this option has no effect.",
989989
help=softwrap(
990990
"""
@@ -1809,7 +1809,7 @@ def file_downloads_max_attempts(self) -> int:
18091809
{doc_url("community/getting-help")}.
18101810
"""
18111811
),
1812-
removal_version="2.26.0.dev0",
1812+
removal_version="2.27.0.dev0",
18131813
removal_hint='Upgrade your operating system or write `allow_deprecated_macos_versions = ["10", "11"]` instead.',
18141814
)
18151815

0 commit comments

Comments
 (0)