Description
Feature request
Currently, pip install git+https://github.com/bitsandbytes-foundation/bitsandbytes
(or equivalent) does not build the C extension at all — the build system entirely depends on it being built prior to installing the Python package. While this makes sense for building the portable wheels for PyPI, it's a bit surprising for end users and downstream repackagers — to the point that they may actually package bitsandbytes without the C extension at all.
I'd like to propose enhancing setup.py
to automatically call CMake to build the C extension if it wasn't built yet. Ideally, we could go as far as to detect the correct kind of acceleration to use, but even building the CPU library would be a good start.
Motivation
Making testing and repackaging easier. Reducing risk of mistakenly repackaging without the C extension at all. Making the "user-oriented" build process more consistent with regular Python packages — I think that would actually even make it possible to start publishing source distributions on PyPI, to provide wider platform support.
Your contribution
I'm ready to write the code and submit a pull request.