https://pantsbuild.org/ logo
n

nice-florist-55958

07/26/2022, 4:19 PM
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

witty-crayon-22786

07/26/2022, 4:52 PM
you’ll need to create two copies of the target currently
h

hundreds-father-404

07/26/2022, 5:50 PM
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
6 Views