diff --git a/src/python/pants/backend/python/dependency_inference/parse_python_dependencies.py b/src/python/pants/backend/python/dependency_inference/parse_python_dependencies.py index 73bfee283fb..d1624babc74 100644 --- a/src/python/pants/backend/python/dependency_inference/parse_python_dependencies.py +++ b/src/python/pants/backend/python/dependency_inference/parse_python_dependencies.py @@ -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 @@ -62,7 +61,6 @@ class PythonFilesDependencies: @dataclass(frozen=True) class ParsePythonDependenciesRequest: source: SourceFiles - interpreter_constraints: InterpreterConstraints @dataclass(frozen=True) @@ -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) ) diff --git a/src/python/pants/backend/python/dependency_inference/parse_python_dependencies_test.py b/src/python/pants/backend/python/dependency_inference/parse_python_dependencies_test.py index d6d25189287..7de9f26533f 100644 --- a/src/python/pants/backend/python/dependency_inference/parse_python_dependencies_test.py +++ b/src/python/pants/backend/python/dependency_inference/parse_python_dependencies_test.py @@ -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 @@ -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, @@ -82,7 +80,6 @@ def assert_deps_parsed( [ ParsePythonDependenciesRequest( source_files, - InterpreterConstraints([constraints]), ) ], ).path_to_deps.values() @@ -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), @@ -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), diff --git a/src/python/pants/backend/python/dependency_inference/rules.py b/src/python/pants/backend/python/dependency_inference/rules.py index 8668361c739..18606945ad2 100644 --- a/src/python/pants/backend/python/dependency_inference/rules.py +++ b/src/python/pants/backend/python/dependency_inference/rules.py @@ -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 @@ -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(), )