Python

conan-py-build

conan-py-build is a PEP 517 build backend that lets Conan manage the C/C++ side of Python packages that ship compiled extensions (via pybind11, nanobind, the Python C API, etc.).

Once it’s declared as the build-backend in pyproject.toml, commands like pip wheel, pip install or python -m build will:

  • Read the dependencies and build steps from a regular Conan conanfile.py.

  • Resolve and install those dependencies with Conan, downloading precompiled binaries from ConanCenter or building them from source.

  • Run the recipe’s build()/package() methods with any build system Conan can drive (CMake, Meson, etc.).

  • Copy what package() staged into the resulting wheel, alongside the pure Python part of the package.

This removes the need for a separate, ad-hoc step to fetch and build C/C++ dependencies before packaging, and keeps that logic in the same conanfile.py format used for regular C/C++ packages. It also supports profiles and lockfiles for reproducible builds, dynamic versioning, PEP 621 entry points, and integrates with auditwheel/delocate-wheel/delvewheel and cibuildwheel to produce self-contained wheels with bundled shared libraries.

See also

PyEnv

The PyEnv tool installs executable Python packages with pip inside a dedicated virtual environment, isolating them from the system Python and from the Conan package itself. It’s meant for Python CLI tools needed during a recipe’s build, such as a build system or code generator invoked from build(), not for Python libraries imported by the recipe.

See also