Skip to content

Commit

Permalink
Remove or bump deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed May 26, 2023
1 parent 73c5d7e commit d892e0c
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 92 deletions.
1 change: 0 additions & 1 deletion pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ pytest = "3rdparty/python/pytest.lock"
[python-infer]
assets = true
unowned_dependency_behavior = "error"
use_rust_parser = true

[docformatter]
args = ["--wrap-summaries=100", "--wrap-descriptions=100"]
Expand Down
21 changes: 0 additions & 21 deletions src/python/pants/backend/go/util_rules/cgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from pants.backend.go.util_rules.cgo_security import check_linker_flags
from pants.backend.go.util_rules.goroot import GoRoot
from pants.backend.go.util_rules.sdk import GoSdkProcess
from pants.base.deprecated import warn_or_error
from pants.base.glob_match_error_behavior import GlobMatchErrorBehavior
from pants.core.util_rules.system_binaries import BashBinary, BinaryPath, BinaryPathTest
from pants.engine.engine_aware import EngineAwareParameter
Expand Down Expand Up @@ -287,19 +286,6 @@ async def setup_compiler_cmd(
return SetupCompilerCmdResult(tuple(args))


@dataclass(frozen=True)
class CGoCompilerWrapperScriptRequest:
def __post_init__(self) -> None:
warn_or_error(
"2.18.0.dev0",
"using `Get(CGoCompilerWrapperScript, CGoCompilerWrapperScriptRequest)",
(
"Instead, simply use `Get(CGoCompilerWrapperScript)` or put "
+ "`CGoCompilerWrapperScript` in the rule signature"
),
)


@dataclass(frozen=True)
class CGoCompilerWrapperScript:
digest: Digest
Expand Down Expand Up @@ -328,13 +314,6 @@ async def make_cgo_compile_wrapper_script() -> CGoCompilerWrapperScript:
return CGoCompilerWrapperScript(digest=digest)


@rule
def cgo_wrapper_compile_script_request(
_: CGoCompilerWrapperScriptRequest, script: CGoCompilerWrapperScript
) -> CGoCompilerWrapperScript:
return script


async def _cc(
binary_name: str,
input_digest: Digest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,12 @@ async def parse_python_dependencies(
# We operate on PythonSourceField, which should be one file.
assert len(stripped_sources.snapshot.files) == 1

if python_infer_subsystem.options.is_default("use_rust_parser"):
# NB: In 2.18, we'll switch the default to `True` and then warn if the value is set (to anything)
if not python_infer_subsystem.options.is_default("use_rust_parser"):
# NB: In 2.19, we remove the option altogether and remove the old code.
warn_or_error(
removal_version="2.18.0.dev0",
entity="Not explicitly providing [python-infer].use_rust_parser",
hint="Read the help for [python-infer].use_rust_parser, then set the value in pants.toml.",
removal_version="2.19.0.dev0",
entity="Explicitly providing [python-infer].use_rust_parser",
hint="Read the help for [python-infer].use_rust_parser, then stop setting the value in pants.toml.",
)

has_custom_dep_inferences = len(union_membership[PythonDependencyVisitorRequest]) > 1
Expand Down
20 changes: 10 additions & 10 deletions src/python/pants/backend/python/dependency_inference/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class PythonInferSubsystem(Subsystem):
)

use_rust_parser = BoolOption(
default=False,
default=True,
help=softwrap(
f"""
Use the new Rust-based, multithreaded, in-process dependency parser.
Expand All @@ -205,16 +205,16 @@ class PythonInferSubsystem(Subsystem):
while hot-cache had no difference. Additionally, Pants can now infer dependencies from
Python scripts with syntax errors.
However, since this parser is completely different it has the potential of introducing
differences in dependency inference. Although the Pants suite of tests only identified
differences when using the `# pants: no-infer-dep` pragma, and string-based
imports/assets, Out of an abundance of caution, this is behind a feature flag that will
eventually be on-by-default then removed.
After leaving this defaulted to disabled for a a release cycle, Pants 2.18 started
defaulting to enabling this.
If you think the new behaviour is causing problems, it is recommended that you run
`{bin_name()} peek :: > before.json` and then
`{bin_name()} --python-infer-use-rust-parser=False peek :: > after.json` and compare the
two results.
It is recommended that you run `{bin_name()} peek :: > before.json` and then
`{bin_name()} --python-infer-use-rust-parser peek :: > after.json` and compare the two
results. If all looks good, set `use_rust_parser` in `[python-infer]` in `pants.toml`.
If you think there's a bug please file an issue: https://github.com/pantsbuild/pants/issues/new/choose.
If you think there is a bug and need to disable it, please file an issue:
https://github.com/pantsbuild/pants/issues/new/choose.
"""
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class PythonToolRequirementsBase(Subsystem):
_lockfile = StrOption(
default=DEFAULT_TOOL_LOCKFILE,
advanced=True,
removal_version="2.18.0.dev0",
removal_version="2.18.0.dev1",
removal_hint=lambda cls: softwrap(
f"""\
Custom tool versions are now installed from named resolves, as
Expand Down Expand Up @@ -478,7 +478,7 @@ def __new__(cls):
return super().__new__(
cls,
default=True,
removal_version="2.18.0.dev0",
removal_version="2.18.0.dev1",
removal_hint="Use the export goal's --resolve option to select tools to export, instead "
"of using this option to exempt a tool from export-by-default.",
help=(
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/backend/python/typecheck/mypy/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class MyPy(PythonToolBase):
)
extra_type_stubs = StrListOption(
advanced=True,
removal_version="2.18.0dev0",
removal_version="2.18.0.dev1",
removal_hint=softwrap(
f"""
Extra type stubs are now installed from a named resolve, as described
Expand Down Expand Up @@ -183,7 +183,7 @@ class MyPy(PythonToolBase):
advanced=True,
# Note that there is no default lockfile, as by default, extra_type_stubs is empty.
default=NO_TOOL_LOCKFILE,
removal_version="2.18.0dev0",
removal_version="2.18.0.dev1",
removal_hint=softwrap(
f"""
Extra type stubs are now installed from a named resolve, as described
Expand Down
4 changes: 0 additions & 4 deletions src/python/pants/backend/shell/target_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ class SkipShellCommandTestsField(BoolField):

class ShellCommandTarget(Target):
alias = "shell_command"
deprecated_alias = "experimental_shell_command"
deprecated_alias_removal_version = "2.18.0.dev0"
core_fields = (
*COMMON_TARGET_FIELDS,
ShellCommandOutputDependenciesField,
Expand Down Expand Up @@ -400,8 +398,6 @@ class ShellCommandTarget(Target):

class ShellCommandRunTarget(Target):
alias = "run_shell_command"
deprecated_alias = "experimental_run_shell_command"
deprecated_alias_removal_version = "2.18.0.dev0"
core_fields = (
*COMMON_TARGET_FIELDS,
ShellCommandExecutionDependenciesField,
Expand Down
18 changes: 0 additions & 18 deletions src/python/pants/core/target_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from pathlib import PurePath
from typing import Generic, Optional, Sequence, TypeVar, Union, cast

from pants.base.deprecated import warn_or_error
from pants.core.goals import package
from pants.core.goals.package import (
BuiltPackage,
Expand Down Expand Up @@ -651,16 +650,6 @@ class GenericTarget(Target):
# -----------------------------------------------------------------------------------------------


@dataclass(frozen=True)
class AllAssetTargetsRequest:
def __post_init__(self) -> None:
warn_or_error(
"2.18.0.dev0",
"using `Get(AllAssetTargets, AllAssetTargetsRequest)",
"Instead, simply use `Get(AllAssetTargets)` or put `AllAssetTargets` in the rule signature",
)


@dataclass(frozen=True)
class AllAssetTargets:
resources: tuple[Target, ...]
Expand All @@ -679,13 +668,6 @@ def find_all_assets(all_targets: AllTargets) -> AllAssetTargets:
return AllAssetTargets(tuple(resources), tuple(files))


@rule
def find_all_assets_request(
_: AllAssetTargetsRequest, all_asset_targets: AllAssetTargets
) -> AllAssetTargets:
return all_asset_targets


@dataclass(frozen=True)
class AllAssetTargetsByPath:
resources: FrozenDict[PurePath, frozenset[Target]]
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/engine/internals/specs_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ async def find_valid_field_sets_for_target_roots(
secondary_owner_targets.add(tgt)
if secondary_owner_targets:
warn_or_error(
removal_version="2.18.0.dev0",
removal_version="2.18.0.dev1",
entity=softwrap(
"""
indirectly referring to a target by using a corresponding file argument, when the
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/jvm/goals/lockfile_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def mk(name):
artifact='artifact',
version='1',
jar='jar.jar',
excludes=['ex:clude'],
)
mk('one')
Expand Down
7 changes: 1 addition & 6 deletions src/python/pants/jvm/resolve/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from pants.engine.target import Target
from pants.jvm.target_types import (
JvmArtifactArtifactField,
JvmArtifactExcludeDependenciesField,
JvmArtifactExclusionsField,
JvmArtifactFieldSet,
JvmArtifactGroupField,
Expand Down Expand Up @@ -162,7 +161,6 @@ def from_jvm_artifact_target(cls, target: Target) -> ArtifactRequirement:
"`JvmArtifactFieldSet` fields present."
)

excludes_coords = target[JvmArtifactExcludeDependenciesField].value or ()
exclusions = target[JvmArtifactExclusionsField].value or ()
return ArtifactRequirement(
coordinate=Coordinate(
Expand All @@ -176,10 +174,7 @@ def from_jvm_artifact_target(cls, target: Target) -> ArtifactRequirement:
if target[JvmArtifactJarSourceField].value
else None
),
excludes=frozenset(
[*(exclusion.to_coord_str() for exclusion in exclusions), *excludes_coords]
)
or None,
excludes=frozenset([*(exclusion.to_coord_str() for exclusion in exclusions)]) or None,
)

def with_extra_excludes(self, *excludes: str) -> ArtifactRequirement:
Expand Down
21 changes: 0 additions & 21 deletions src/python/pants/jvm/target_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,6 @@ class JvmProvidesTypesField(StringSequenceField):
)


class JvmArtifactExcludeDependenciesField(StringSequenceField):
alias = "excludes"
help = help_text(
"""
A list of unversioned coordinates (i.e. `group:artifact`) that should be excluded
as dependencies when this artifact is resolved.
This does not prevent this artifact from being included in the resolve as a dependency
of other artifacts that depend on it, and is currently intended as a way to resolve
version conflicts in complex resolves.
These values are passed directly to Coursier, and if specified incorrectly will show a
parse error from Coursier.
"""
)

removal_hint = "Use `exclusions` field instead"
removal_version = "2.18.0.dev0"


@dataclass(frozen=True)
class JvmArtifactExclusion:
alias: ClassVar[str] = "jvm_exclude"
Expand Down Expand Up @@ -405,7 +385,6 @@ class JvmArtifactTarget(Target):
JvmArtifactUrlField, # TODO: should `JvmArtifactFieldSet` have an `all_fields` field?
JvmArtifactJarSourceField,
JvmArtifactResolveField,
JvmArtifactExcludeDependenciesField,
JvmArtifactExclusionsField,
JvmJdkField,
JvmMainClassNameField,
Expand Down

0 comments on commit d892e0c

Please sign in to comment.