curved-microphone-39455
12/19/2022, 2:53 PMresources and the files targets and wondering how I can define correctly this dependencies. I have already done it for a single file with resource() and add it to the python_sources dependencies but for folder that I want to include everything. Thanks in advance 🙂wide-midnight-78598
12/19/2022, 2:56 PMrefined-addition-53644
12/19/2022, 2:57 PMresources(name="res", sources=["**/*.csv"])curved-microphone-39455
12/19/2022, 3:00 PMpython_sources(
dependencies=[":static-files"],
)
resources(
name="static-files",
sources=["html/*", "static/*", "templates/*"],
)
Do you think something like this would work if I really want everything inside some folders ?refined-addition-53644
12/19/2022, 3:02 PMpython_sources so that later you can read it inside python.curved-microphone-39455
12/19/2022, 3:05 PM__init__.py everywhere to mark those folder as package since they are not but I will try to do this from the BUILD file one level over and see how it goes. Thanks for the help @refined-addition-53644 🙂refined-addition-53644
12/19/2022, 3:06 PMpkg_resources from setuptools or resources from importlib you need to make them a package.
https://stackoverflow.com/questions/6028000/how-to-read-a-static-file-from-inside-a-python-packageenough-analyst-54434
12/19/2022, 3:07 PM__file__ to derive a real file system path and then use file system APIs if you wish.enough-analyst-54434
12/19/2022, 3:09 PMenough-analyst-54434
12/19/2022, 3:11 PMresources target to get files into a PEX for access as files instead of using a files target, which would make more word sense. That is just a historical oddity.curved-microphone-39455
12/19/2022, 3:11 PM<http://MANIFEST.in|MANIFEST.in> file at the root of each project, but we are migrating away from this with Poetrycurved-microphone-39455
12/19/2022, 3:12 PMfiles and resources ?enough-analyst-54434
12/19/2022, 3:14 PMfiles doesn't work with pex_binary for purely historical reasons; so, for Python, just always use resourcesenough-analyst-54434
12/19/2022, 3:15 PMresources via resource APIs.enough-analyst-54434
12/19/2022, 3:16 PMasset target.curved-microphone-39455
12/19/2022, 3:19 PM