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

ambitious-actor-36781

11/04/2021, 9:31 PM
If I've got a thing with a deep nesting of packages, but everything beyond the 2nd level is just one 'unit', is there a best way of dealing with this? Is it just set the
sources
of the
python_sources
to
***/**.py, !**/test_*.py
?
w

witty-crayon-22786

11/04/2021, 9:44 PM
opinions are mixed, but i’ve always recommended target-per-directory, rather than using recursive globs
assuming inference is doing its job, whether those sources files are actually just one ‘unit’ isn’t something that the targets themselves need to declare, because it can be inferred from imports
h

happy-kitchen-89482

11/04/2021, 9:45 PM
I tend to agree
./pants tailor
will generate all this for you
a

ambitious-actor-36781

11/04/2021, 9:46 PM
wait, the inference works out dependencies across targets? I thought it was just on 3rdparty deps.
h

happy-kitchen-89482

11/04/2021, 9:47 PM
Keep in mind that unless you use explicit dependencies, dep inference will infer at the file-level anyway
It does!
Nope, it does it for your internal dependencies, and at the file level
a

ambitious-actor-36781

11/04/2021, 9:48 PM
oh. well ok.
starting to wonder what
dependencies=[]
is even for 😛
w

witty-crayon-22786

11/04/2021, 9:50 PM
mostly for
resources
and sources that are loaded “reflectively”
(…was probably a rhetorical question, heh… but yea, it still has its uses)
2 Views