A setuptools extension for embedding native libraries in Python wheels using CFFI, enabling portable distribution of Rust/C binaries.
Milksnake is a setuptools extension that allows developers to embed dynamically linked native libraries (e.g., built with Rust or C) into Python wheels. It solves the problem of distributing platform-specific binaries in a portable way by using CFFI to load libraries at runtime instead of compiling traditional Python extension modules.
Python developers who need to distribute native code (e.g., Rust, C, or C++ libraries) as part of their Python packages, particularly those targeting multiple platforms and Python versions.
Milksnake simplifies native library distribution by automating build processes and wheel packaging, avoiding the complexity of Python's extension module system. It provides better cross-platform support and wheel tagging than CFFI's built-in setuptools integration.
A setuptools/wheel/cffi extension to embed a binary data in wheels
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Seamlessly invokes custom build commands like Cargo or makefiles, as demonstrated in the setup.py example for Rust projects, automating native library compilation.
Uses CFFI to load dynamic libraries at runtime, avoiding the complexity of compiling Python extension modules and simplifying cross-platform compatibility.
Automatically creates properly tagged wheels for Linux, macOS, and Windows, ensuring native libraries are distributed correctly for each platform without manual tagging.
Generates universal wheels (py2.py3-none-PLATFORM) that work with both Python 2 and 3, reducing the need for multiple builds per interpreter version.
Forces the use of CFFI for interfacing, which may not suit projects needing lower-level Python C-API control or alternative FFI methods like ctypes.
Requires external build tools and dependencies (e.g., Cargo for Rust), increasing setup complexity and potential for failures on systems without proper toolchains.
The README primarily covers a basic Rust example, lacking detailed guidance for complex scenarios, other languages like C++, or troubleshooting build issues.