Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from dataclasses import dataclass

from pants.backend.python.dependency_inference.subsystem import PythonInferSubsystem
from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints
from pants.core.util_rules.source_files import SourceFiles
from pants.core.util_rules.stripped_source_files import strip_source_roots
from pants.engine.collection import DeduplicatedCollection
Expand Down Expand Up @@ -62,7 +61,6 @@ class PythonFilesDependencies:
@dataclass(frozen=True)
class ParsePythonDependenciesRequest:
source: SourceFiles
interpreter_constraints: InterpreterConstraints


@dataclass(frozen=True)
Expand Down Expand Up @@ -113,9 +111,6 @@ async def parse_python_dependencies(
python_infer_subsystem: PythonInferSubsystem,
) -> PythonFilesDependencies:
stripped_sources = await strip_source_roots(request.source)
# We operate on PythonSourceField, which should be one file.
assert len(stripped_sources.snapshot.files) == 1

native_results = await parse_python_deps(
NativeDependenciesRequest(stripped_sources.snapshot.digest)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
)
from pants.backend.python.target_types import PythonSourceField, PythonSourceTarget
from pants.backend.python.util_rules import pex
from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints
from pants.core.util_rules import stripped_source_files
from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest
from pants.engine.addresses import Address
Expand Down Expand Up @@ -49,7 +48,6 @@ def assert_deps_parsed(
expected_imports: dict[str, ImpInfo] | None = None,
expected_assets: list[str] | None = None,
filename: str = "project/foo.py",
constraints: str = ">=3.6",
string_imports: bool = True,
string_imports_min_dots: int = 2,
assets: bool = True,
Expand Down Expand Up @@ -82,7 +80,6 @@ def assert_deps_parsed(
[
ParsePythonDependenciesRequest(
source_files,
InterpreterConstraints([constraints]),
)
],
).path_to_deps.values()
Expand Down Expand Up @@ -463,7 +460,6 @@ def test_works_with_python38(rule_runner: RuleRunner) -> None:
assert_deps_parsed(
rule_runner,
content,
constraints=">=3.8",
expected_imports={
"demo": ImpInfo(lineno=5, weak=False),
"project.demo.Demo": ImpInfo(lineno=6, weak=False),
Expand Down Expand Up @@ -496,7 +492,6 @@ def test_works_with_python39(rule_runner: RuleRunner) -> None:
assert_deps_parsed(
rule_runner,
content,
constraints=">=3.9",
expected_imports={
"demo": ImpInfo(lineno=7, weak=False),
"project.demo.Demo": ImpInfo(lineno=8, weak=False),
Expand Down
5 changes: 0 additions & 5 deletions src/python/pants/backend/python/dependency_inference/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
)
from pants.backend.python.util_rules import ancestor_files, pex
from pants.backend.python.util_rules.ancestor_files import AncestorFilesRequest, find_ancestor_files
from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints
from pants.base.glob_match_error_behavior import GlobMatchErrorBehavior
from pants.core import target_types
from pants.core.target_types import AllAssetTargetsByPath, map_assets_by_path
Expand Down Expand Up @@ -370,14 +369,10 @@ async def _exec_parse_deps(
field_set: PythonImportDependenciesInferenceFieldSet,
python_setup: PythonSetup,
) -> PythonFileDependencies:
interpreter_constraints = InterpreterConstraints.create_from_field_sets(
[field_set], python_setup
)
source = await determine_source_files(SourceFilesRequest([field_set.source]))
resp = await parse_python_dependencies_get(
ParsePythonDependenciesRequest(
source,
interpreter_constraints,
),
**implicitly(),
)
Expand Down
Loading