polite-angle-82480
04/04/2023, 3:06 AMpantsbuild.pants.testutil
. Here’s what I figured out to do so far:
In `3rdparty/BUILD`L
python_requirements(
name="pants-reqs",
description="3rd Party Requirements for testing pants plugins",
source="requirements-pants-testutil.txt",
resolve="test_pants_plugins"
)
In 3rdparty/requirements-pants-testutil.txt
pantsbuild.pants.testutil
In the plugin dir `pants-plugins/version_check/BUILD`:
pants_requirements(
name="pants",
resolve="test_pants_plugins",
)
resource(name="version_check", source="version_check.py")
python_tests(
name="tests",
sources=["**/test_*.py"],
dependencies=[
":version_check",
"3rdparty:pants-reqs",
],
resolve="test_pants_plugins",
)
But then just trying install pantsbuild.pants.testutil
via ./pants generate-lockfiles --resolve=test_pants_plugins
gives me an error abot specifying the version (which I’m not):
ERROR: Cannot install pantsbuild.pants.testutil and pantsbuild.pants.testutil<2.16 and >=2.15.0a0 because these package versions have conflicting dependencies.Full error:
./pants generate-lockfiles --resolve=test_pants_plugins
Bootstrapping Pants using /Users/yegor.ius/.pyenv/shims/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.62/pex> verified.
Installing pantsbuild.pants==2.15.0 into a virtual environment at /Users/yegor.ius/.cache/pants/setup/bootstrap-Darwin-arm64/2.15.0_py39
New virtual environment successfully created at /Users/yegor.ius/.cache/pants/setup/bootstrap-Darwin-arm64/2.15.0_py39.
23:02:16.92 [INFO] Completed: Generate lockfile for test_pants_plugins
23:02:16.93 [ERROR] 1 Exception encountered:
Engine traceback:
in `generate-lockfiles` goal
in Generate Python lockfile
ProcessExecutionFailure: Process 'Generate lockfile for test_pants_plugins' failed with exit code 1.
stdout:
stderr:
pid 71088 -> /Users/yegor.ius/.cache/pants/named_caches/pex_root/venvs/ecdb14bb96158224592177b93ecc7679cf00f4af/d8428a8ea90f0582092e86ce2d333b0b4540e45f/bin/python -sE /Users/yegor.ius/.cache/pants/named_caches/pex_root/venvs/ecdb14bb96158224592177b93ecc7679cf00f4af/d8428a8ea90f0582092e86ce2d333b0b4540e45f/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --isolated -q --cache-dir /Users/yegor.ius/.cache/pants/named_caches/pex_root/pip_cache --log /private/var/folders/x7/dhdtyk6533118y9892k7fgt80000gn/T/pants-sandbox-8khVeZ/.tmp/pex-pip-log.r3as47pc/pip.log download --dest /private/var/folders/x7/dhdtyk6533118y9892k7fgt80000gn/T/pants-sandbox-8khVeZ/.tmp/tmpzwlni972/Users.yegor.ius..pyenv.versions.3.8.10.bin.python3.8 pantsbuild.pants.testutil pantsbuild.pants.testutil<2.16,>=2.15.0a0 pantsbuild.pants<2.16,>=2.15.0a0 --index-url <https://pypi.org/simple/> --extra-index-url <https://build:5aLHGjm4szT6wPWQDUWv8Pdtta2a5fK7@repo.artifactory.enigma.com/artifactory/api/pypi/pypi/simple> --retries 5 --timeout 15 exited with 1 and STDERR:
ERROR: Cannot install pantsbuild.pants.testutil and pantsbuild.pants.testutil<2.16 and >=2.15.0a0 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies>
The conflict is caused by:
The user requested pantsbuild.pants.testutil
The user requested pantsbuild.pants.testutil<2.16 and >=2.15.0a0
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
polite-angle-82480
04/04/2023, 3:07 AMpantsbuild.pants.testutil<2.16 and >=2.15.0a0
requirement coming from? We’re using pants 2.15.0
pants.toml
[GLOBAL]
pants_version = "2.15.0"
happy-kitchen-89482
04/04/2023, 4:44 AMhappy-kitchen-89482
04/04/2023, 4:45 AMhappy-kitchen-89482
04/04/2023, 4:45 AMenough-analyst-54434
04/04/2023, 1:23 PMpants_requirements
target. The issue here is revealed in the OP. Pants is running under Python 3.9 Mac ARM (./pants
script). The rule that is running is failing to find a pantsbuild.pants
distribution for 2.15.x for Python 3.8 for Mac ARM, which makes sense since we only publish 3.8 wheels for Mac x86_64.rich-london-74860
04/04/2023, 6:08 PMpants_requirements
pants_requirements(
name="pants",
resolve="test_pants_plugins",
)
requirements-pants-testutil.txt
is unnecessary for pantsbuild.pants.testutil
, but what if we have other 3rd party dependencies that we would like to use in a plug-in?pantsbuild.pants.testutil
from the list of requirements and change the interpreter to 3.9[python.resolves_to_interpreter_constraints]
pants-plugins = [">=3.9,<3.10"]
./pants generate-lockfiles --resolve=test_pants_plugins
takes forever to run. I waited 1.5h before giving up.polite-angle-82480
04/05/2023, 6:40 PMpants_requirements
in 3rdparty/BUILD
and in the pants-plugin/BUILD
I was able to install the pantsbuild
lib
/pants generate-lockfiles --resolve=test_pants_plugins
with the following pants-plugin/BUILD
file
pants_requirements(
name="pants",
resolve="pants-plugins",
testutil=True,
)
python_tests(
name="tests",
sources=["**/test_*.py"],
dependencies=[
":pants",
],
resolve="pants-plugins",
interpreter_constraints=[">=3.9,<3.10"]
)