Possible PEP 660 violation in `_build/gpt_oss_build_backend/backend.py`

#66
by kwojciechowski - opened

I am experiencing the following error during python setup of GPT OSS 20B model on a MBP M4 Pro processor (OSX 15.5):

  × Failed to build `gpt-oss @
  │ file:///.../gpt-oss`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `gpt_oss_build_backend.backend.build_editable` failed (exit status: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 11, in <module>
      TypeError: build_editable() takes from 1 to 2 positional arguments but 3 were given

      hint: This usually indicates a problem with the package or the build environment.

The LLM of my choice responded with the following feedback:

The provided backend script violates PEP 660 because its build_editable hook does not match the required signature specified in the PEP. Specifically:

PEP 660 defines the hook as build_editable(wheel_directory, config_settings=None, metadata_directory=None), where wheel_directory is the directory in which the backend must place the generated editable wheel, and metadata_directory (optional from the frontend) allows ensuring metadata consistency if previously prepared.
The script instead defines it as build_editable(editable_directory, config_settings=None), omitting metadata_directory and using a non-standard parameter name (editable_directory instead of wheel_directory).
When delegating to the underlying backend (setuptools or scikit-build-core), the script calls the function with only two arguments (fn(editable_directory, config_settings)), which will cause a TypeError since compliant backends expect the full signature.
This breaks the standardized interface, preventing frontends like pip from correctly interacting with the backend for editable installs.

so I added metadata_directory: str | None = None, to the build_wheel function and the error message does not appear anymore.

Sign up or log in to comment