I also missed in the docs that `python_library()` ...
# general
n
I also missed in the docs that
python_library()
is required for tests to do imports (relative in my case). I only picked this up by looking at the example-python repo. Say i have • project1 • project2 ◦ some-nesting ▪︎ greet • greeting_test.py • greeting.py • BUILD Then to do
import Greeting from .greeting
in the test file, i need to both have the source root as
/project2/some-nesting
and in the build file
Copy code
python_library()
python_test(name="greet")
Reading the docs (https://www.pantsbuild.org/docs/python-test-goal), I got the impression that python_library was only required for test utils and/or binaries.
h
Hello! We're close to doing the stable release for pants 2.3 which adds a ./pants tailor goal to autogenerate BUILD files, which is meant to avoid exactly that kind of confusion It's ready to try out today by changing pants_version to 2.3.0rc3, then run ./pants tailor
n
Ok cool - looks like it produces the right output.