<#20068 `pants_requirements` / `_find_links` only ...
# github-notifications
c
#20068 `pants_requirements` / `_find_links` only works with resolves Issue created by huonw Describe the bug The new
python_requirement
field
_find_links
only work works with resolves enabled. Without them enabled, the packages are not included. This field is hidden for public use, but is used by the
pants_requirements
with the new release artifacts (2.18+). This means 2.18 would be a no-warning hard-breaking change for existing users of
pants_requirements
that don't use resolves/lockfiles (not using resolves isn't advisable, but that's irrelevant to whether we want to hard-break such users). Noticed in #20002 (comment) Reproducer:
Copy code
cd $(mktemp -d)

cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.18.0rc3"

backend_packages = ["pants.backend.python", "pants.backend.plugin_development"]

[python]
interpreter_constraints = ["==3.9.*"]
EOF

cat > BUILD <<EOF
# 'raw': pants_requirements(name="pants")
# manually expanded:
python_requirement(name="pants", requirements=["pantsbuild.pants==2.18.0rc3"], _find_links=["https://wheels.pantsbuild.org/simple"], modules=["pants"])
python_sources(name="py")
EOF

cat > test.py <<EOF
from pants import version
print(version.VERSION)
EOF

# BUG: ERROR: No matching distribution found for pantsbuild.pants==2.18.0rc3
pants run test.py

# OK: run with resolves
echo 'enable_resolves = true' >> pants.toml
pants generate-lockfiles
pants run test.py
Running that script runs
pants run
twice. The first is the bug, with full output like the following, note that the manual find-links URL isn't included in the PEX invocation.
Copy code
11:54:09.62 [INFO] Initializing scheduler...
11:54:12.47 [INFO] Scheduler initialized.
11:54:14.69 [INFO] Starting: Building py.pex with 1 requirement: pantsbuild.pants==2.18.0rc3
11:54:15.98 [INFO] Completed: Building py.pex with 1 requirement: pantsbuild.pants==2.18.0rc3
11:54:15.98 [ERROR] 1 Exception encountered:

Engine traceback:
  in `run` goal

ProcessExecutionFailure: Process 'Building py.pex with 1 requirement: pantsbuild.pants==2.18.0rc3' failed with exit code 1.
stdout:

stderr:
pid 28296 -> /Users/huon/.cache/pants/named_caches/pex_root/venvs/ffd14ea6ad35e138cd78619cb1d7a53586ad1333/abee7c499dda8be23f517597ba8eeeff0a6f591a/bin/python -sE /Users/huon/.cache/pants/named_caches/pex_root/venvs/ffd14ea6ad35e138cd78619cb1d7a53586ad1333/abee7c499dda8be23f517597ba8eeeff0a6f591a/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --isolated -q --cache-dir /Users/huon/.cache/pants/named_caches/pex_root/pip_cache --log /private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-QwnNF0/.tmp/pex-pip-log.9bh6hqa7/pip.log download --dest /Users/huon/.cache/pants/named_caches/pex_root/downloads/resolver_download.7fsx3yfd/opt.homebrew.Cellar.python@3.9.3.9.16.Frameworks.Python.framework.Versions.3.9.bin.python3.9 pantsbuild.pants==2.18.0rc3 --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with 1 and STDERR:
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.18.0rc3 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 2.5.0, 2.5.1, 2.5.2, 2.6.0, 2.6.1, 2.7.0, 2.7.1, 2.7.2, 2.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17.0.dev3, 2.17.0.dev4, 2.17.0.dev5, 2.17.0a1, 2.17.0rc0, 2.17.0rc1, 2.17.0rc2, 2.17.0rc3, 2.17.0rc4, 2.17.0rc5, 2.17.0, 2.17.1rc0, 2.17.1rc1, 2.17.1rc2, 2.18.0.dev0, 2.18.0.dev1, 2.18.0.dev3, 2.18.0.dev4, 2.18.0.dev5, 2.18.0.dev6, 2.18.0.dev7, 2.18.0a0)
ERROR: No matching distribution found for pantsbuild.pants==2.18.0rc3
The second one runs fine. Pants version 2.18.0rc3 OS macOS Additional info N/A pantsbuild/pants