Is it possible to define `resource` target using a...
# general
r
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
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
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
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.