Skip to content

Commit

Permalink
Remove deprecated [python].lockfile_generator and deprecate `poetry…
Browse files Browse the repository at this point in the history
…` subsystem (used previously for lockfile generation) (#16633)

To be clear: this does not impact the `poetry_requirements` target generator, only lockfile generation.

[ci skip-rust]
[ci skip-build-wheels]
  • Loading branch information
Eric-Arellano authored Aug 25, 2022
1 parent a75ab14 commit 7251de9
Show file tree
Hide file tree
Showing 34 changed files with 138 additions and 2,066 deletions.
2 changes: 0 additions & 2 deletions build-support/bin/_generate_all_lockfiles_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from pants.backend.python.subsystems.debugpy import DebugPy
from pants.backend.python.subsystems.ipython import IPython
from pants.backend.python.subsystems.lambdex import Lambdex
from pants.backend.python.subsystems.poetry import PoetrySubsystem
from pants.backend.python.subsystems.pytest import PyTest
from pants.backend.python.subsystems.python_tool_base import PythonToolRequirementsBase
from pants.backend.python.subsystems.setup import PythonSetup
Expand Down Expand Up @@ -112,7 +111,6 @@ def jvm(cls, tool: type[JvmToolBase], *, backend: str | None = None) -> DefaultT
DefaultTool.python(Isort),
DefaultTool.python(Lambdex, backend="pants.backend.awslambda.python"),
DefaultTool.python(MyPy, source_plugins=True),
DefaultTool.python(PoetrySubsystem),
DefaultTool.python(PyTest),
DefaultTool.python(PyUpgrade, backend="pants.backend.experimental.python.lint.pyupgrade"),
DefaultTool.python(Pylint, backend="pants.backend.python.lint.pylint", source_plugins=True),
Expand Down
7 changes: 2 additions & 5 deletions src/python/pants/backend/cc/lint/clangformat/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
GeneratePythonToolLockfileSentinel,
)
from pants.backend.python.subsystems.python_tool_base import ExportToolOption, PythonToolBase
from pants.backend.python.subsystems.setup import PythonSetup
from pants.backend.python.target_types import ConsoleScript
from pants.core.goals.generate_lockfiles import GenerateToolLockfileSentinel
from pants.core.util_rules.config_files import ConfigFilesRequest
Expand Down Expand Up @@ -71,11 +70,9 @@ class ClangFormatLockfileSentinel(GeneratePythonToolLockfileSentinel):

@rule
def setup_clangformat_lockfile(
_: ClangFormatLockfileSentinel, clangformat: ClangFormat, python_setup: PythonSetup
_: ClangFormatLockfileSentinel, clangformat: ClangFormat
) -> GeneratePythonLockfile:
return GeneratePythonLockfile.from_tool(
clangformat, use_pex=python_setup.generate_lockfiles_with_pex
)
return GeneratePythonLockfile.from_tool(clangformat)


class ClangFormatExportSentinel(ExportPythonToolSentinel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,9 @@ class MypyProtobufLockfileSentinel(GeneratePythonToolLockfileSentinel):

@rule
def setup_mypy_protobuf_lockfile(
_: MypyProtobufLockfileSentinel,
mypy_protobuf: PythonProtobufMypyPlugin,
python_setup: PythonSetup,
_: MypyProtobufLockfileSentinel, mypy_protobuf: PythonProtobufMypyPlugin
) -> GeneratePythonLockfile:
return GeneratePythonLockfile.from_tool(
mypy_protobuf, use_pex=python_setup.generate_lockfiles_with_pex
)
return GeneratePythonLockfile.from_tool(mypy_protobuf)


@dataclass(frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
GeneratePythonToolLockfileSentinel,
)
from pants.backend.python.subsystems.python_tool_base import PythonToolRequirementsBase
from pants.backend.python.subsystems.setup import PythonSetup
from pants.backend.python.target_types import EntryPoint
from pants.backend.python.util_rules import pex
from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess
Expand Down Expand Up @@ -61,13 +60,9 @@ class DockerfileParserLockfileSentinel(GeneratePythonToolLockfileSentinel):

@rule
def setup_lockfile_request(
_: DockerfileParserLockfileSentinel,
dockerfile_parser: DockerfileParser,
python_setup: PythonSetup,
_: DockerfileParserLockfileSentinel, dockerfile_parser: DockerfileParser
) -> GeneratePythonLockfile:
return GeneratePythonLockfile.from_tool(
dockerfile_parser, use_pex=python_setup.generate_lockfiles_with_pex
)
return GeneratePythonLockfile.from_tool(dockerfile_parser)


@dataclass(frozen=True)
Expand Down
9 changes: 2 additions & 7 deletions src/python/pants/backend/helm/subsystems/k8s_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from pants.backend.python.goals import lockfile
from pants.backend.python.goals.lockfile import GeneratePythonLockfile
from pants.backend.python.subsystems.python_tool_base import PythonToolRequirementsBase
from pants.backend.python.subsystems.setup import PythonSetup
from pants.backend.python.target_types import EntryPoint
from pants.backend.python.util_rules import pex
from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess
Expand Down Expand Up @@ -57,13 +56,9 @@ class HelmKubeParserLockfileSentinel(GeneratePythonToolLockfileSentinel):

@rule
def setup_k8s_parser_lockfile_request(
_: HelmKubeParserLockfileSentinel,
post_renderer: HelmKubeParserSubsystem,
python_setup: PythonSetup,
_: HelmKubeParserLockfileSentinel, post_renderer: HelmKubeParserSubsystem
) -> GeneratePythonLockfile:
return GeneratePythonLockfile.from_tool(
post_renderer, use_pex=python_setup.generate_lockfiles_with_pex
)
return GeneratePythonLockfile.from_tool(post_renderer)


@dataclass(frozen=True)
Expand Down
9 changes: 2 additions & 7 deletions src/python/pants/backend/helm/subsystems/post_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from pants.backend.python.goals import lockfile
from pants.backend.python.goals.lockfile import GeneratePythonLockfile
from pants.backend.python.subsystems.python_tool_base import PythonToolRequirementsBase
from pants.backend.python.subsystems.setup import PythonSetup
from pants.backend.python.target_types import EntryPoint
from pants.backend.python.util_rules import pex
from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess
Expand Down Expand Up @@ -66,13 +65,9 @@ class HelmPostRendererLockfileSentinel(GeneratePythonToolLockfileSentinel):

@rule
def setup_postrenderer_lockfile_request(
_: HelmPostRendererLockfileSentinel,
post_renderer: HelmPostRendererSubsystem,
python_setup: PythonSetup,
_: HelmPostRendererLockfileSentinel, post_renderer: HelmPostRendererSubsystem
) -> GeneratePythonLockfile:
return GeneratePythonLockfile.from_tool(
post_renderer, use_pex=python_setup.generate_lockfiles_with_pex
)
return GeneratePythonLockfile.from_tool(post_renderer)


_HELM_POST_RENDERER_TOOL = "__pants_helm_post_renderer.py"
Expand Down
7 changes: 2 additions & 5 deletions src/python/pants/backend/python/goals/coverage_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
GeneratePythonToolLockfileSentinel,
)
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
from pants.backend.python.subsystems.setup import PythonSetup
from pants.backend.python.target_types import ConsoleScript
from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess
from pants.backend.python.util_rules.python_sources import (
Expand Down Expand Up @@ -235,11 +234,9 @@ class CoveragePyLockfileSentinel(GeneratePythonToolLockfileSentinel):

@rule
def setup_coverage_lockfile(
_: CoveragePyLockfileSentinel, coverage: CoverageSubsystem, python_setup: PythonSetup
_: CoveragePyLockfileSentinel, coverage: CoverageSubsystem
) -> GeneratePythonLockfile:
return GeneratePythonLockfile.from_tool(
coverage, use_pex=python_setup.generate_lockfiles_with_pex
)
return GeneratePythonLockfile.from_tool(coverage)


@dataclass(frozen=True)
Expand Down
Loading

0 comments on commit 7251de9

Please sign in to comment.