proud-dentist-22844
04/10/2021, 12:21 PMpython_requirements
so that it has higher priority than another? I would like a global way to resolve >1 target exports this module, so it is ambiguous which to use
, because the global file should always win.
There are a couple of packages in the monorepo that, due to how they get deployed, depend on having their own requirements files. So, I added BUILD with python_requirements
for each of them. But some of those requirements overlap with the global requirements.proud-dentist-22844
04/10/2021, 12:26 PMpython_requirements(except=["requests"])
?proud-dentist-22844
04/10/2021, 1:18 PM./pants py-constraints --summary
proud-dentist-22844
04/10/2021, 1:28 PMproud-dentist-22844
04/10/2021, 1:35 PM09:15:27.46 [WARN] The target st2common/tests/unit/test_persistence_change_revision.py:tests imports `tests.unit.base.ChangeRevFakeModel`, but Pants cannot safely infer a dependency because >1 target exports this module, so it is ambiguous which to use: ['contrib/runners/orquesta_runner/tests/unit/base.py', 'st2common/tests/unit/base.py'].
Please explicitly include the dependency you want in the `dependencies` field of st2common/tests/unit/test_persistence_change_revision.py:tests, or ignore the ones you do not want by prefixing with `!` or `!!` so that <=1 targets are left.
Alternatively, you can remove the ambiguity by deleting/changing some of the targets so that only 1 target exports this module. Refer to <https://www.pantsbuild.org/v2.4/docs/troubleshooting#import-errors-and-missing-dependencies>.
proud-dentist-22844
04/10/2021, 1:36 PMhappy-kitchen-89482
04/10/2021, 5:12 PMhappy-kitchen-89482
04/10/2021, 5:13 PMThere are a couple of packages in the monorepo that, due to how they get deployed, depend on having their own requirements files. So, I added BUILD with python_requirements for each of them.
happy-kitchen-89482
04/10/2021, 5:13 PMhappy-kitchen-89482
04/10/2021, 5:13 PMhappy-kitchen-89482
04/10/2021, 5:14 PMhappy-kitchen-89482
04/10/2021, 5:15 PMhappy-kitchen-89482
04/10/2021, 5:15 PMproud-dentist-22844
04/10/2021, 5:48 PMproud-dentist-22844
04/10/2021, 5:48 PMproud-dentist-22844
04/10/2021, 5:49 PMproud-dentist-22844
04/10/2021, 5:50 PMpython_requirement_library
in BUILD for the unique deps.proud-dentist-22844
04/10/2021, 5:50 PMproud-dentist-22844
04/10/2021, 6:23 PMhappy-kitchen-89482
04/10/2021, 6:28 PMhappy-kitchen-89482
04/10/2021, 6:29 PMpython_requirements()
at all?happy-kitchen-89482
04/10/2021, 6:29 PMhappy-kitchen-89482
04/10/2021, 6:29 PMhappy-kitchen-89482
04/10/2021, 6:30 PMhappy-kitchen-89482
04/10/2021, 6:30 PMproud-dentist-22844
04/10/2021, 7:39 PMproud-dentist-22844
04/10/2021, 7:43 PMproud-dentist-22844
04/10/2021, 7:53 PMvirtualenv
) and then sets PYTHONPATH when running the action or sensor to enable a few features advertised to pack authors.proud-dentist-22844
04/10/2021, 8:04 PMhappy-kitchen-89482
04/10/2021, 11:19 PMhappy-kitchen-89482
04/10/2021, 11:53 PMproud-dentist-22844
04/11/2021, 10:31 AMCan you elaborate on that? And point to the code?
Here are the commits where I added things to the BUILD files to disambiguate the imports. This one is for the packs: https://github.com/st2sandbox/st2/commit/aaccd6a25b05ce70f5ea1d5f4afb2c5bdd866931 And this one is for test file deps: https://github.com/st2sandbox/st2/commit/92d2b14cf070038254318001790c21affe03e2a0
proud-dentist-22844
04/11/2021, 10:32 AMhappy-kitchen-89482
04/11/2021, 5:14 PMrequirements.txt
files, as they are (if I understand correctly) not a source of truth, but a technical means for creating a venv from source.happy-kitchen-89482
04/11/2021, 5:17 PMhappy-kitchen-89482
04/12/2021, 3:51 PMhappy-kitchen-89482
04/12/2021, 3:52 PMrequirements.txt
is part of that structure.happy-kitchen-89482
04/12/2021, 3:53 PMhappy-kitchen-89482
04/12/2021, 3:53 PMhappy-kitchen-89482
04/12/2021, 3:58 PMrequirements.txt
for those in-repo packs don't need to be managed by Pants at all, so they don't need companion BUILD stanzas. They are technically part of a deployment artifact, not a build time artifact. At build time the pack can consume deps from the global `requirements.txt`/`contraints.txt` as any other code does. The separate, subset requirements.txt
exists only so that at runtime StackStorm can install the pack in a virtualenv. It is not needed at build time.happy-kitchen-89482
04/12/2021, 3:59 PMhappy-kitchen-89482
04/12/2021, 3:59 PMhappy-kitchen-89482
04/12/2021, 4:00 PMproud-dentist-22844
04/12/2021, 6:24 PMproud-dentist-22844
04/12/2021, 6:26 PMproud-dentist-22844
04/12/2021, 6:27 PM