It’s fantastic since this allows your library to reach out users that otherwise wouldn’t use them. Is there anything similar for zig?
Zig already provides cross-compilation to multiple targets, so for executables this seems like a simpler problem to solve as you just need to package different executables for each target you want to support (?) but for libraries the problem seeems a bit more difficult.
Does anyone know of already existing tools? Or how easy it would be to implement something similar?
His comment was incredibly useful as it led me down the path of discovering cargo-zigbuild + setuptools-rust projects, which do similar things to what I want.
I have been using my setuptools-zigfor various simple extensions over the last 5 years. It is an extension for setuptools, which I recently extended to work with the ziglangpackage. So you specify the build dependency for your package to be on setuptools-zig (and ziglang) and the .c and .zig files in your sources will be compiled with zig.Since you can specify a specific version (ziglang<=15.0 ), this prevents language changes to break things unintentionally.
It now also handles more complex situations, like the ruamel.yaml.clib ( a handful of .c files, one of which generated from Cython), on Linux ( Ubuntu and Alpine tested) and macOS. Windows still has some problems.
That is a good talk, but unfortunately Loris didn’t know that if you nowadays do `python -m pip install some-non-wheeled-source-package` a wheel is made, cached and installed.
I have been working on compiling the C extension for ruamel.yaml with setuptools-zigthe last couple of days. Uploading one source is however only part of the problem. Getting things to work initially and testing is still an extensive matrix (six Python versions (py39-py314) 5 OS-es (Linux, Linux-musl, macOS, Win32, Win64) * 1-2 architectures ( Intel/Amd, arm, maybe more). And then it might work different on older versions of an OS, processor, etc.
I cannot test all of these combinations in the first place, so I try to get through a cross-section. And of course I ran into (link) problems in the last platform tested (Windows), because of a bug in the toolchain, and now need to recheck the workaround on the others as well
I’ll have to watch your talk too, seems very interesting and on topic. I guess keeping your code as much Zig as possible can help with some of the grandfathered issues coming from C but you will of course still have to test all different permutations.
Also thanks @adria I saw your thread of zignal yesterday and read through some of the bindings code. This is exactly what I was looking for.