https://pantsbuild.org/ logo
#general
Title
# general
s

swift-river-73520

03/27/2023, 8:34 PM
alright one more hopefully easy one. so I've got a subpackage I'm trying to build a pex binary out of, the directory format is like this:
Copy code
src/python/pipelines/pipe1/pipe1/*.py
src/python/pipelines/pipe1/pipe1/BUILD # contains pex_binary target
when I run pants package
src/python/pipelines/pipe1/pipe1:bin
I get a pex file that includes all the appropriate first and 3rd party deps (awesome), but the import path for
pipe1
is not quite what I'm expecting. when I launch an interpreter using the generated pex file the required import path is
from pipe1.pipe1 import main
whereas I was expecting it to be
from pipe1 import main
any ideas on what I'd need to do to get the latter import path? it's odd to me that I'm even able to do
from pipe1.pipe1 import ...
as there's no
__init__.py
file at
src/python/pipelines/pipe1/
e

enough-analyst-54434

03/27/2023, 8:37 PM
The tool here is
pants roots
play with this until that outputs the correct PYTHONPATH entries: + https://www.pantsbuild.org/docs/reference-source#root_patterns + https://www.pantsbuild.org/docs/source-roots
👀 1
s

swift-river-73520

03/27/2023, 8:38 PM
thanks a million, I'll dig into those docs