What's the proper Pants way to replace an existing...
# general
b
What's the proper Pants way to replace an existing
data_files
option from a
setup.py
? For background, I am moving internal packages to a Monorepo. We have
packageA
, which had the
data_files
. I moved that code fine, and can run it with toy examples no problem. But then I move over
packageB
, which calls code that relies on those files. But Pants has no knowledge of them at all, so of course they don't end up where they're supposed to. The documentation states that
you cannot use data_files, install_requires, namespace_packages, package_dir, package_data, or packages because Pants will generate these for you, based on the data derived from your code and dependencies.
, but when it's not generated for me how am I supposed to get the files where they need to be?
f
You would use a
resources
target in the
BUILD
file. Then add a dependency from the relevant Python targets (e.g.,
python_sources
) to that
resources
target using the
dependencies
attribute. See https://www.pantsbuild.org/docs/assets for more information.
1
b
Thanks, I'll give it a go!