Yes, that is basically what I meant. Python’s packaging sort of has the notion that retrieving the python_flint-0.6.0-cp312-cp312-win_amd64.whl
wheel from PyPI is equivalent to retrieving python-flint-0.6.0.tar.gz
instead and then invoking its build backend. The resulting wheels would have the same name but are not equivalent though because of the bundled dependencies. This distinction does not matter for pip if it is just trying to install the project locally: if it managed to build the wheel then the necessary libraries must be available and probably the extra stuff that I did to make it so that the PyPI wheels work isn’t needed in the target system.
So there are two types of wheels:
- Portable PyPI wheels should work on any system that safisfies the constraints on OS etc that are implied by the wheel filename.
- Non-portable wheels that are built by a tool that naively invokes the PEP 517 interface.
From my perspective as a package author a PEP 517 frontend generates non-portable wheels but cibuildwheel
is the tool that I use to make the portable PyPI wheels.
I ran cibuildwheel
locally a few times when first getting a configuration together but I haven’t run it since. That is all just configured in CI and I hope it never breaks… Likewise I never try to make the portable wheels myself locally. Producing the wheels that are suitable for PyPI is not something that we should expect tools like pip to be able to do as part of installing packages into an environment and it is also not something that we really need to worry about “end users” doing.
There is less of a problem of automatic detection when building non-portable wheels from the sdist: the backend can detect the CPU, CUDA version etc. The PEP 517 interface allows the backend to pull in whatever dependencies like cuda_selector
it needs (provided it is acceptable to run cuda_selector
in an isolated venv) and to run whatever code it wants. This is in fact the exact mechanism that NVIDIA now proposes to use because it already provides the flexibility to do all the auto-detection they need.
Most build backends generate generic (e.g. x86_64
) wheels by default even when building on the target machine. If we give up the pretence that a build backend generates portable wheels then there’s no reason we couldn’t just compile everything with -march=native
which is how you tell gcc
“I don’t care about portability: use every available feature of the exact CPU in this machine”.
I think it is reasonable for now to ignore the variants when building from sdist and just say that for e.g. pip
’s purposes if the build succeeds then it should be fine.
I also think that it is reasonable to punt on the discussion of how variant wheels do actually get built. In practice this is something that package authors would do by configuring cibuildwheel
somehow and passing some settings through to their build backend.