I was dealing with a very similar problem a long time ago. I wanted to provide built wheels of my Cython extension for various OSes (Windows, macOS, Linux) and various Python versions (from 2.7 up to 3.9) but I also wanted to have a sdist package for all the variations that I didn't cover at the time.
What I ended up doing was automating the whole process on two different CI systems (one of those didn't have Windows support and the other was Windows-only) but also provided the sdist distribution with both Cython and Cython-generated C++ sources. Users can opt-in for cython installation using setuptools extras feature. For instance: pip install my-package[with-cython] Additionally whether to compile from Cython or C++ sources is controlled with environment variable, something like: CYTHONIZE=1 pip install my-package Using env vars instead of extra command arg for setup.py makes it easy to use with pip, poetry or whatever installer your user decides to use. The whole setup required a bit of work but in the end it has been working for a few years already. Definitely the hardest thing to maintain are those ever-changing CI systems. Adding the support for optional building from sources was actually the simplest to do. I don't spend a lot of time on the project lately but if you are interested how the whole thing was here's the url: https://github.com/swistakm/pyimgui śr., 10 mar 2021 o 20:57 Mats Wichmann <m...@wichmann.us> napisał(a): > On 3/10/21 11:56 AM, Thomas Jollans wrote: > > On 10/03/2021 18:42, Marco Sulla wrote: > >> On Wed, 10 Mar 2021 at 16:45, Thomas Jollans <t...@tjol.eu> wrote: > >>> Why are you doing this? > >>> > >>> If all you want is for it to be possible to install the package from > >>> source on a system that can't use the C part, you could just declare > >>> your extension modules optional > >> Because I want to provide (at least) two wheels: a wheel for linux > >> users with the C extension compiled and a generic wheel in pure python > >> as a fallback for any other architecture. > > > > What's wrong with sdist as a fallback rather than a wheel? > > > > That has the added benefit of people on other architectures have the > > opportunity to use the extension module if they have a compiler and the > > necessary libraries and headers installed... > > Doesn't that mean nasty failures for those don't have the correct build > setup (like almost every Windows user on the planet)? This isn't a > snide question, I'm actually interested in solving roughly the same > problem as the OP. > > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list