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

Execute or postpone most deprecation-removals scheduled for 2.26 #21926

Merged
merged 6 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/notes/2.26.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ Thank you to [Klayvio](https://www.klaviyo.com/) and [Normal Computing](https://

### Backends

#### Python

Some deprecations have expired and been removed:

- 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)

#### Terraform

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

### Plugin API changes

Expand Down
39 changes: 2 additions & 37 deletions src/python/pants/backend/python/goals/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from pants.engine.rules import collect_rules, rule
from pants.engine.target import AllTargets, HydratedSources, HydrateSourcesRequest, SourcesField
from pants.engine.unions import UnionMembership, UnionRule
from pants.option.option_types import BoolOption, EnumOption, StrListOption
from pants.option.option_types import EnumOption, StrListOption
from pants.util.strutil import path_safe, softwrap

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -110,38 +110,6 @@ class ExportPluginOptions:
advanced=True,
)

py_hermetic_scripts = BoolOption(
default=True,
help=softwrap(
"""
When exporting a mutable virtualenv for a resolve, by default
modify console script shebang lines to make them "hermetic".
The shebang of hermetic console scripts uses the python args: `-sE`:

- `-s` skips inclusion of the user site-packages directory,
- `-E` ignores all `PYTHON*` env vars like `PYTHONPATH`.

Set this to false if you need non-hermetic scripts with
simple python shebangs that respect vars like `PYTHONPATH`,
to, for example, allow IDEs like PyCharm to inject its debugger,
coverage, or other IDE-specific libs when running a script.

This only applies when when exporting a `mutable_virtualenv`
(`symlinked_immutable_virtualenv` exports are not "full"
virtualenvs because they are used internally by pants itself.
Pants requires hermetic scripts to provide its reproduciblity
guarantee, fine-grained caching, and other features).
"""
),
advanced=True,
removal_version="2.26.0.dev0",
removal_hint=softwrap(
"""
Use `--export-py-non-hermetic-scripts-in-resolve` instead.
"""
),
)

py_non_hermetic_scripts_in_resolve = StrListOption(
help=softwrap(
"""
Expand Down Expand Up @@ -284,10 +252,7 @@ async def do_export(
f"--prompt={venv_prompt}",
output_path,
]
if (
req.resolve_name in export_subsys.options.py_non_hermetic_scripts_in_resolve
or not export_subsys.options.py_hermetic_scripts
):
if req.resolve_name in export_subsys.options.py_non_hermetic_scripts_in_resolve:
pex_args.insert(-1, "--non-hermetic-scripts")

post_processing_cmds = [
Expand Down
10 changes: 5 additions & 5 deletions src/python/pants/backend/python/lint/ruff/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,36 +153,36 @@ def config_request(self, dirs: Iterable[str]) -> ConfigFilesRequest:
install_from_resolve = StrOption(
advanced=True,
default=None,
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint=_removal_hint,
help="Formerly used to customise the version of Ruff to install.",
)

requirements = StrListOption(
advanced=True,
default=None,
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint=_removal_hint,
help="Formerly used to customise the version of Ruff to install.",
)
interpreter_constraints = StrListOption(
advanced=True,
default=None,
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint=_removal_hint,
help="Formerly used to customise the version of Ruff to install.",
)
console_script = StrOption(
advanced=True,
default=None,
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint=_removal_hint,
help="Formerly used to customise the version of Ruff to install.",
)
entry_point = StrOption(
advanced=True,
default=None,
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint=_removal_hint,
help="Formerly used to customise the version of Ruff to install.",
)
Expand Down
15 changes: 1 addition & 14 deletions src/python/pants/backend/terraform/lint/tfsec/tfsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from dataclasses import dataclass

from pants.backend.terraform.target_types import TerraformFieldSet
from pants.base.deprecated import deprecated_conditional
from pants.core.goals.lint import LintTargetsRequest
from pants.core.util_rules.config_files import ConfigFilesRequest
from pants.core.util_rules.external_tool import ExternalTool
Expand Down Expand Up @@ -100,26 +99,14 @@ def custom_checks_request(self) -> ConfigFilesRequest:
)

def generate_url(self, plat: Platform) -> str:
deprecated_conditional(
lambda: self.version.startswith("v"),
removal_version="2.26.0.dev0",
entity="using a version beginning with 'v'",
hint=f"Remove the leading 'v' from `[{self.options_scope}].version` and from versions in `[{self.options_scope}].known_versions`",
)

plat_str = {
"macos_arm64": "darwin_arm64",
"macos_x86_64": "darwin_amd64",
"linux_arm64": "linux_arm64",
"linux_x86_64": "linux_amd64",
}[plat.value]

# backwards compatibility with version strings beginning with 'v'
version = self.version
if version.startswith("v"):
version = version[1:]

return f"https://github.com/aquasecurity/tfsec/releases/download/v{version}/tfsec_{version}_{plat_str}.tar.gz"
return f"https://github.com/aquasecurity/tfsec/releases/download/v{self.version}/tfsec_{self.version}_{plat_str}.tar.gz"

def generate_exe(self, _: Platform) -> str:
return "./tfsec"
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/option/global_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ class BootstrapOptions:
)
native_options_validation = EnumOption(
default=NativeOptionsValidation.warning,
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint="The legacy parser has been removed so this option has no effect.",
help=softwrap(
"""
Expand Down Expand Up @@ -1809,7 +1809,7 @@ def file_downloads_max_attempts(self) -> int:
{doc_url("community/getting-help")}.
"""
),
removal_version="2.26.0.dev0",
removal_version="2.27.0.dev0",
removal_hint='Upgrade your operating system or write `allow_deprecated_macos_versions = ["10", "11"]` instead.',
)

Expand Down
Loading