<#2125 A `pex3 lock create` can fail to gather met...
# github-notifications
c
#2125 A `pex3 lock create` can fail to gather metadata from sdists due to Pex being PEP-517 non-compliant. Issue created by jsirois The non-compliance is here: pex/pex/build_system/pep_517.py Lines 199 to 218 in </pantsbuild/pex/commit/cf5b5f30a2c110c4cc6b5c80a5682b2daf8c478d|cf5b5f3> That call to the
prepare_metadata_for_build_wheel
hook uses the build system requires: pex/pex/build_system/pep_517.py Lines 121 to 124 in </pantsbuild/pex/commit/cf5b5f30a2c110c4cc6b5c80a5682b2daf8c478d|cf5b5f3> pex/pex/build_system/pep_517.py Lines 72 to 82 in </pantsbuild/pex/commit/cf5b5f30a2c110c4cc6b5c80a5682b2daf8c478d|cf5b5f3> pex/pex/build_system/pep_518.py Lines 112 to 137 in </pantsbuild/pex/commit/cf5b5f30a2c110c4cc6b5c80a5682b2daf8c478d|cf5b5f3> But it does not add in any
get_requires_for_build_wheel
requirements, if available, as the spec requires: https://peps.python.org/pep-0517/#get-requires-for-build-wheel This failure can be observed for `cairocffi==1.5.1`:
Copy code
$ pex3 lock create cairocffi==1.5.1 --style universal --resolver-version pip-2020-resolver --target-system linux --target-system mac --indent 2 -o lock.j
son --pip-version latest
/home/jsirois/.pex/venvs/07d1d86c9694916905b0b9d18751b689460f76c8/5985ed09b49a653d6596b0e14d134c5456cf1a9f/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  config = read_configuration(filepath, True, ignore_option_errors, dist)
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['cairocffi']
running dist_info
creating /tmp/tmp4cd4ku9g/build/cairocffi.egg-info
writing /tmp/tmp4cd4ku9g/build/cairocffi.egg-info/PKG-INFO
writing dependency_links to /tmp/tmp4cd4ku9g/build/cairocffi.egg-info/dependency_links.txt
writing requirements to /tmp/tmp4cd4ku9g/build/cairocffi.egg-info/requires.txt
writing top-level names to /tmp/tmp4cd4ku9g/build/cairocffi.egg-info/top_level.txt
writing manifest file '/tmp/tmp4cd4ku9g/build/cairocffi.egg-info/SOURCES.txt'
reading manifest file '/tmp/tmp4cd4ku9g/build/cairocffi.egg-info/SOURCES.txt'
reading manifest template '<http://MANIFEST.in|MANIFEST.in>'
adding license file 'LICENSE'
writing manifest file '/tmp/tmp4cd4ku9g/build/cairocffi.egg-info/SOURCES.txt'
creating '/tmp/tmp4cd4ku9g/build/cairocffi-1.5.1.dist-info'
error: invalid command 'bdist_wheel'
Could not gather lock metadata for 1 project with source artifacts:
1. /tmp/tmp7zr1dudh/home.jsirois.bin.pex.venv.bin.python/cairocffi-1.5.1.tar.gz: Executing /home/jsirois/.pex/venvs/07d1d86c9694916905b0b9d18751b689460f76c8/5985ed09b49a653d6596b0e14d134c5456cf1a9f/bin/python -sE /home/jsirois/.pex/venvs/07d1d86c9694916905b0b9d18751b689460f76c8/5985ed09b49a653d6596b0e14d134c5456cf1a9f/pex -c import sys

import build


if not hasattr(build, 'prepare_metadata_for_build_wheel'):
    sys.exit(75)

result = build.prepare_metadata_for_build_wheel(*('/tmp/tmp4cd4ku9g/build',), **{})
with open('/tmp/tmpa8mk0ckp', "w") as fp:
    fp.write(result)
 failed with 1
Here the
["wheel"]
requirement list returned by
setuptools.build_meta.get_requires_for_build_wheel
is never included in the hook venv; thus the
error: invalid command 'bdist_wheel'
is triggered. pantsbuild/pex