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

stale-nightfall-29801

10/25/2021, 11:11 AM
Hey folks, so I've got an this folder structure (as I've posted above): monorepo • core ◦ core ▪︎ <code> ◦ test ▪︎ <test_code> ◦ BUILD ◦ README • foo ◦ foo ▪︎ <code> ◦ test ▪︎ <test_code> ◦ BUILD ◦ README ◦ CHANGES.txt ◦ dockerfile And I would like
foo
(and other libraries) to be able to reference
core/core/some_code.py
as
from core.some_code import some_function
but what I'm finding is that it needs to reference it like so
from core.core.some_code import some_function
. My assumption is this is to do with where the BUILD file sits in the folder structure. I'm really keen to not change this as I'd like our transition to Pant's to be low impact on everyone's workflow and reduce housekeeping of multiple BUILD files and different levels (This outlook may change with time and familiarity with Pants). Can I alter my BUILD files or
pants.toml
to allow me to achieve this?
c

curved-television-6568

10/25/2021, 11:13 AM
I think it has more to do with your source roots. https://www.pantsbuild.org/docs/source-roots
What does
./pants roots
tell you?
s

stale-nightfall-29801

10/25/2021, 11:15 AM
.
c

curved-television-6568

10/25/2021, 11:16 AM
Ah, right. So you want it to pick up
foo
and
core
as roots. See if the docs page guides you there, otherwise please ask, see what we can do for you (as I don’t really know either, without consulting the docs myself 😛 )
s

stale-nightfall-29801

10/25/2021, 11:20 AM
That did it thanks 👍
added
"./*"
to my roots and it can now handle my directory structure
👍 3
5 Views