Skip to content

PEP 517: The "complete, working build backend" shown doesn't actually work #2536

Closed
@wimglenn

Description

@wimglenn

The minimal example mypackage_custom_build_backend.py shown in the pep doesn't work.

This is what you see using pip 22.0.4 if you try to use it:

$ pip install .
Processing /private/tmp/example
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/private/tmp/example/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'mypackage_custom_build_backend' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/private/tmp/example/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/private/tmp/example/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/private/tmp/example/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/tmp/example/mypackage_custom_build_backend.py", line 47, in build_wheel
          from wheel.archive import archive_wheelfile
      ModuleNotFoundError: No module named 'wheel.archive'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I didn't bother seeing what happened to wheel.archive because the readme for that project clearly says:

wheel is not intended to be used as a library, and as such there is no stable, public API

So probably it shouldn't be used as a library in this PEP?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions