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

refined-addition-53644

12/07/2021, 1:25 PM
Is it possible to define
resource
target using a directory which has multiple directories inside it? In general, whatever examples I see in docs are using single or multiple files, but hardly with directories.
c

curved-television-6568

12/07/2021, 1:47 PM
That’s because recursive patterns are discouraged in favour of having
BUILD
files at all levels. But
**
is a recursive wildcard pattern, so you can use things like
sources=["conf/**/*.cfg"]
when the alternative is not viable.
r

refined-addition-53644

12/07/2021, 2:05 PM
I have a directory with bunch of csv files which I need to package with the python distribution. According to
pants
, I should put a BUILD file inside this directory?
Also I have a config directory which I want to ship with the distribution.
c

curved-television-6568

12/07/2021, 2:45 PM
I think it is legitimate to have a single
resources
target for the whole csv tree, if they always go together as a bundle.
Copy code
# BUILD
resources(
  name="csv_resources",
  sources=["csv-files/**/*.csv"]
)
See https://www.pantsbuild.org/v2.9/docs/resources regarding
resources
vs
files
in case the latter is more appropriate for your use case.
👍 2
I would probably have the config files in a different target separate from the csv files.. but that is not a requirement.
6 Views