limited-potato-15054
11/02/2025, 12:15 AM|directory_a
-|directory_b
-|a_python_file.py
-|BUILD
-|directory_c
-|b_python_file.py
-|BUILD
b_python_file.py imports a function from a_python_file.py using a relative import. Pantsbuild says it can't infer the dependency. What do I need to do or add to the BUILD file in directory_c so pants knows about this dependency?elegant-florist-94385
11/03/2025, 11:42 AMpython_sources() in each of them). My guess is that you need to ensure you have source roots configured appropriatelylimited-potato-15054
11/03/2025, 5:21 PM# directory_a/directory_b/BUILD
python_sources(
name=f"test_package_b.lib",
sources=["**/*.py"],
)
# directory_a/directory_c/BUILD
python_sources(
name=f"test_package_c.lib",
sources=["**/*.py"],
)
So I shouldn't need to specify the dependency of test_package_b anywhere in directory_a/directory_c/BUILD if the source roots are correctly configured?elegant-florist-94385
11/03/2025, 5:24 PMimport statements, and determine the dependencies automatically. You can test this by running pants dependencies directory_a/directory_c/b_python_file.pyelegant-florist-94385
11/03/2025, 5:25 PM--transitive flag you should also be able to see the dependencies of a, (ie. that b transitively depends on a's dependencies)limited-potato-15054
11/03/2025, 5:26 PMlimited-potato-15054
11/04/2025, 11:23 PMFailed to resolve all requirements for cp310-cp310-manylinux_2_35_x86_64 interpreter...
I added the newly generated python sources from the dependency into the pex_binary target dependency list, and it resolved it. Thanks!