I’m unsure how to handle the case where a python s...
# general
n
I’m unsure how to handle the case where a python source depends explicitly (I.e., listed in its dependencies list) on a third party requirement conditional on which of the source's parametrizations is being used (in particular, of which resolve is in play). If only one is listed, pants complains when another resolve is in play. If it's parametrized, lots of off-diagonal targets get generated and leads to specification problems elsewhere. Am I missing something here?
w
you’ll need to create two copies of the target currently
h
Copy code
python_source(
   name="utils_data-science"
   source="utils.py",
   resolve="data-science",
   dependencies=[":blah"],
)

python_source(
   name="utils_web-app"
   source="utils.py",
   resolve="web-app",
)
if you're generally using
python_sources
target generator, then you can explicitly set its sources to be
sources=["*.py", "!utils.py", "!*_test.py"]
, for example