whl2conda 26.7.2


pip install whl2conda

  Latest version

Released: Jul 15, 2026


Meta
Author: Christopher Barber
Requires Python: >=3.10

Classifiers

Development Status
  • 3 - Alpha

Intended Audience
  • Developers

Programming Language
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Topic
  • Software Development :: Build Tools
whl2conda logo

whl2conda


pypi version conda version documentation
PyPI - Python Version GitHub
CI codecov GitHub issues
Pixi Badge

Generate conda packages directly from python wheels

whl2conda is a command line utility to build and test conda packages generated directly from python wheels.

Background: See doc/about/motivation.md for the story behind this project.

  • Performance: because it does not need to create conda environments in order to build, this is much faster than solutions involving conda-build.

  • Dependency renaming: renames pypi package dependencies to their corresponding conda name. Automatically renames packages from known list collected from conda-forge and supports user-specified rename patterns as well.

  • Multiple package formats: can generate both V1 ('.tar.bz2') and V2 ('.conda') conda package formats. Can also generate an unpacked directory tree for debugging or additional user customization.

  • Project configuration: whl2conda project-specific options can be read from project's pyproject.toml file.

  • Test install support: supports installing conda package into a conda environment for testing prior to deployment.

  • Hides pypi dependencies: rewrites the original pip/pypi dependencies in the installed dist-info to avoid compatibility issues.

  • Binary wheel support: can convert non-pure Python wheels containing binary extensions (.so, .pyd) into platform-specific conda packages using the --allow-impure flag. Automatically generates tight Python version pins and OS constraints from wheel platform tags, with special support for stable ABI (abi3) and multi-platform (fat) wheels. Conversions of representative C, C++, Cython, rust, and abi3 extension packages are regularly verified to be equivalent to the corresponding conda-forge packages on linux, macOS, and windows.

    Limitations: Binary conversion is designed for self-contained extension packages (e.g., markupsafe, cryptography, orjson). Wheels that bundle vendored shared libraries (e.g., lxml, pillow) convert with a warning but bypass conda's dependency management for those libraries, and wheels with local version suffixes (e.g., +cu121 variant builds) are refused. For complex GPU/CUDA packages, use conda-forge packages instead.

Installation

With pip:

pip install whl2conda

With conda (upcoming):

conda install -c conda-forge whl2conda

Quick usage

Generate a conda package in same directory as wheel file:

whl2conda convert dist/mypackage-1.2.3-py3-none-any.whl

Add default tool options to pyproject.toml

whl2conda config --generate-pyproject pyproject.toml

Build both wheel and conda package for project:

whl2conda convert --build-wheel my-project-root

Create python 3.10 test environment for generated conda package:

whl2conda install dist/mypackage-1.2.3.-py_0.conda --create -n testenv \
  --extra pytest python=3.10

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
conda-package-handling (>=2.2)
packaging (>=23)
platformdirs (>=3.10)
pyyaml (>=6.0)
tomlkit (>=0.12)
wheel (>=0.41)