build meta wheel does not respect metadata_directory per PEP-517
See original GitHub issueFrom https://www.python.org/dev/peps/pep-0517/#build-wheel:
If the build frontend has previously called prepare_metadata_for_build_wheel and depends on the wheel resulting from this call to have metadata matching this earlier call, then it should provide the path to the created .dist-info directory as the metadata_directory argument.
https://github.com/pypa/setuptools/blob/master/setuptools/build_meta.py#L208 though ignores the passed in metadata_directory
argument and goes to regenerate this information in the root of the project.
def build_wheel(self, wheel_directory, config_settings=None,
metadata_directory=None):
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
wheel_directory, config_settings)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Nobody is following the metadata_directory promise in PEP 517
The directory passed in by the build frontend MUST be identical to the ... build meta wheel does not respect metadata_directory per PEP-517...
Read more >Could not build wheels for _ which use PEP 517 and cannot ...
The easiest solution to deal with the error "Could not build wheels for ____ which use PEP 517 and cannot be installed directly"....
Read more >could not build wheels for pandas, numpy which use pep 517 ...
I think NumPy is not yet being prepared for Python 3.9 since they need to check a lot of times. You should try...
Read more >Changelog - PDM
#1401; Do not save the python path when using non-interactive mode in pdm init . ... Bug Fixes#. Respect requires-python when creating the...
Read more >Sharing Your Labor of Love: PyPI Quick and Dirty
This is not a history lesson, therefore we will use: pip to install packages,; setuptools, wheel, and build to build your packages in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But then what happens if a backend return different things from
build_wheel
andprepare_metadata_for_build_wheel
? (Which setuptools is guity of doing right now.) It is certainly possible to remove the requirement for backend to make use of themetadata_directory
argument, but the backend should still somehow return consistent things from the two hooks. Otherwise the frontend would be stuck and can’t proceed. The discussion needs to be moved to discuss.python.org if you want to do that so frontend authors can join the conversation.setuptools-ext is a thin wrapper around
setuptools.build_meta
allowing to specify some more metadata fields such as Requires-External, which aren’t otherwise supported by setuptools. Passing around themetadata_directory
(ref) would have been really useful if it worked!If setuptools were to diligently follow PEP 517 (i.e. does not just ignore the
metadata_directory
), we could simply callprepare_metadata_for_build_wheel
before dropping in some additional files, or modify existing ones, under.dist-info
subdir, and then callbuild_wheel
passing in the metadata dir.However since that didn’t work, instead
setuptools-ext
has to callbuild_wheel
, and then completely rewrite the result, which is a lot more complicated (considering that modifying the METADATA file also invalidates the RECORD file!)This “tweaking” of a build backend by wrapping the hooks is apparently an expected usage, because it’s documented as a way for an in-tree build backend to augment the build dependencies (by @abravalheri here). It’s unfortunate that one can’t reliably use a similar technique for
prepare_metadata_for_build_wheel
+build_wheel
.