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

ripe-gigabyte-88964

03/22/2023, 4:53 PM
How do I make a
python_distribution
dependent on every
python_source
target in a subdirectory?
dependencies=[":pyproject", "mypackage::"],
is throwing an error.
r

refined-addition-53644

03/22/2023, 4:54 PM
pick the nearest
python_sources
target
Wait
r

ripe-gigabyte-88964

03/22/2023, 4:55 PM
Yeah it's only picking up a few sources
Feel like I'm missing something obvious
r

refined-addition-53644

03/22/2023, 5:04 PM
If you had something like an entry point, it’s simpler. Otherwise if the python sources are just loose modules, then you might have to define a globbed target and put dependency on that.
Copy code
python_sources(name="sources", sources=["**/*.py", "!**/test_*.py"])
python_distribution(dependencies=[":sources"])
This would mean that any subdirectory
python_sources
would have to be removed because pants will complain about multiple ownership