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

high-yak-85899

02/17/2023, 10:33 PM
What's the easiest way to glob up a bunch of dependencies for a target? I'd like to do something like
dependencies=["//my/dir/**/*_my_file.py"]
, but I keep getting hit with various forms of
DifferingFamiliesError
. I'd like to avoid having to put one
python_sources
really high up that globs like
sources=["//my/dir/**/*_my_file.py"]
if possible.
It does seem like the only way to do this is to put a sources target higher up
The specifics here is that I want a module to depend on every single protobuf in a couple directories
h

happy-kitchen-89482

02/18/2023, 3:13 PM
Alas you can't use glob syntax in
dependencies=
. You'd have to enumerate them if they can't be inferred.
That high-up
python_sources
works, but if those sources are also owned by other targets then you have sources owned by two targets, which can introduce dep inference ambiguity
Although now that I think of it, https://github.com/pantsbuild/pants/pull/17931 might fix that, assuming the two targets are in different source roots
So
*_my_file.py
are generated from protos?
h

high-yak-85899

02/18/2023, 4:25 PM
Yeah unfortunately we have some legacy tooling and aren’t ready to swap over to protobuf sources yet
Though even if we were, I’d still need to glob them up until I can implement something that handles the protos anonymously.
5 Views