Press Conda packages into wheels.
Warning
This project is in alpha, undergoing broader testing.
The latest Mamba-press release can be installed from Conda-Forge with Conda/Mamba/Pixi.
It ships a mamba_press
Python library and a mamba-press
executable.
mamba install -c conda-forge mamba-press
The development version can be run from within the Git repository using Pixi.
pixi run mamba-press
to run the executable.pixi run mamba-press-dev
adds some options to inspect intermediary files.
The executable must be provided with a recipe file that defines what wheel to build and how.
It can be invoked with the following, and will place by default the wheel built under the ./dist/
directory.
See the the recipe file documentation, and the example folder.
mamba-press examples/libmambapy-2.3.1-cp313-manylinux_2_17_x86_64.yaml
ls dist/
Find all options with
mamba-press --help
The project takes one or more Conda packages to press into a single wheel with all its dependencies.
The pressing steps are roughly:
- Solve the defined conda specs into a set of Conda packages.
- Remove unwanted packages and their exclusive dependencies (e.g. Python itself).
- Download and install all these packages into a working (broken) Conda environment.
- Filter unwanted files (headers, Conda metadata, etc.).
- Rearrange files:
- Change their path (for instance a Python package will be under
lib/pythonX.YY/site-packages
in Conda but needs to be at the root of the wheel). - Change file data (e.g. relocate dynamic libraries that have been moved).
- Change their path (for instance a Python package will be under
- Upsert wheel metadata.
- Zip final directory into a wheel file.
There are incompressible limitations due to the differences between Conda and wheels:
- Conda can rewrite absolute path present in files, which PyPI clients (
pip
,uv
) cannot do. We can sometimes convert them to relative paths when we know how they are used, such as when used asRPATH
in dynamic libraries. The project could however easily provide a way for user to configure how they should be treated. - Symlinks are not allowed in wheels and need to be removed or copied (currently removed).
- Conda-forge builds with recent dependencies (such as
libstdc++
), which means that they either need to to be shipped for (not so) old systems. - If depending on the binary interface of other Python packages, these dependencies need to be
pinned has hard as their ABI is
unstable.
In the Conda ecosystem, this is not an issue because the
build variant
make it possible to ship multiple versions of a packages from which an exact solver
will pick.
With
pip
the solver is approximate and may violate these constraints. What's more, many wheel ship their own dynamic libraries, which makes it even more likely to run into program corruption when exchanging underlying dynamic libraries objects through Python.
There are current limitations to this project:
- Among all the packages and dependencies, only one can be Python package (this will be the one used for the wheel name).
- This package must ship a
.dist-info
(and not a.egg-info
). - Library sonames/id currently cannot be changed and therefore so do their filename.
- Due to failure to change name ids on MacOS, absolute dynamic libraries dependencies cannot be replaced with a relative path.
Pixi is recommended for development. It is the only tool needed and will install all the project dependencies (Python included) automatically.
A number of tasks are provided
pixi run test
to run the test.pixi run fmt
to run the code formatter.pixi run fmt
to run the code formatter.pixi run ci
to combine all these checks in a one stop task.
Pre-commit is configured with the specificity that it will actually run a number of checks trough Pixi. It can be set up with
pixi run pre-commit install