blue-football-92560
03/03/2023, 1:15 AMlint
working and I'm trying to get check
working. It's failing due to ambiguous dependencies. We have the source code for a few python packages in this repo, so we do have multiple requirements.txt files with overlapping dependencies. We currently build one virtualenv which includes all requirements so I don't think there are any conflicts. We use this virtualenv to do typechecking and run tests. Is it possible to tell pants to use the correct requirements.txt file based on the directory structure so that I can enable check
without breaking our existing build?broad-processor-92400
03/03/2023, 1:34 AM-r path/to/requirements.txt
, -r another/path/requirements.txt
, and only one python_requirements(...)
target in the whole tree
The second one is likely to be simpler/smoother (having a single set of dependencies for the majority of the repo).blue-football-92560
03/03/2023, 1:42 AMbroad-processor-92400
03/03/2023, 1:45 AMpants.toml
, either:
1. [python] tailor_requirements_targets = false
https://www.pantsbuild.org/docs/reference-python#tailor_requirements_targets to ignore all requirements files by default (and then add the targets manually, as required)
2. [tailor] ignore_adding_targets = [...]
https://www.pantsbuild.org/docs/reference-tailor#ignore_adding_targets to ignore specific ones
I'd probably go with 1, I thinkhappy-kitchen-89482
03/03/2023, 2:14 AMhappy-kitchen-89482
03/03/2023, 2:14 AM-r
lines because it expects the included requirements files to have their own python_requirements()
targetsbroad-processor-92400
03/03/2023, 2:15 AMhappy-kitchen-89482
03/03/2023, 2:16 AMhappy-kitchen-89482
03/03/2023, 2:17 AMhappy-kitchen-89482
03/03/2023, 2:17 AMhappy-kitchen-89482
03/03/2023, 5:00 AM[python-infer]
ambiguity_resolution = "by_source_root"
happy-kitchen-89482
03/03/2023, 5:00 AMblue-football-92560
03/04/2023, 1:58 AM-r
in requirements.txt. I ended up concatenating all the requirements file into one and telling pants to ignore the originals.blue-football-92560
03/06/2023, 6:23 AMpython_requirements
?happy-kitchen-89482
03/06/2023, 6:43 AM-r
, but in 2.16 you can use the ambiguity resolution strategy I outlined above and have python_requirements()
targets for each of your requirements.txts