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

wonderful-boots-93625

04/03/2023, 8:30 PM
with the python_distribution, is there a way to get
files
to be included not just
resources
? we kinda abuse MANIFEST.in to put in files into the distribution, and I’m trying to replicate it.
b

broad-processor-92400

04/03/2023, 8:35 PM
Youre not alone in finding files/resources distinction is a bit finicky. For things intended for packaging, can you use
resources
instead of
files
?
w

wonderful-boots-93625

04/03/2023, 8:42 PM
Most of the time that switch will work, but here the the path being included is outside the source root, and when i use resources, it gets confused and says the source root cannot be found. structure
Copy code
edge/ <-- monorepo root
   iai_coral_api/migration/ <- problematic folder to include into dist
   iai_coral_api/src/iai_coral_api/... <-- most of the code
   setup.py <-- not used by pants

-- pants.toml
source_roots=[
 'iai_coral_api/src'
]
so using a
resources
at
migration/
will have py files that import iai_coral_api but that should work, since the source root for that is already set?
so error becomes `NoSourceRootError: No source root found for
iai_coral_api
. See https://www.pantsbuild.org/v2.14/docs/source-roots for how to define source roots.`
b

broad-processor-92400

04/03/2023, 10:01 PM
Ah okay. Where would you expect that folder to end up in the dist? Could you move the folder to be under the src folder?
w

wonderful-boots-93625

04/03/2023, 10:03 PM
Yea I mean I can rearrange things, but I then have to double check references to make sure i didn’t break anything. It seems i can omit this stuff for now apparently, so for now I think I’m ok.