Skip to main content

conan-py-build

A PEP 517 build backend that uses Conan to build Python C/C++ extensions.

Documentation · PyPI · Examples

Install

pip install conan-py-build

Quick start

[!NOTE] The steps below use CMake, but the backend is build-system agnostic — it works with anything Conan can drive. For a Meson version, see basic-meson-pybind11.

  1. Set conan-py-build as your build backend:
[build-system]
requires = ["conan-py-build"]
build-backend = "conan_py_build.build"

[project]
name = "mypackage"
version = "0.1.0"
  1. Add a conanfile.py with your C++ dependencies:
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout

class MyPackageConan(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeToolchain", "CMakeDeps"

    def layout(self):
        cmake_layout(self)

    def requirements(self):
        self.requires("fmt/12.1.0")

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def package(self):
        cmake = CMake(self)
        cmake.install()
  1. Your CMakeLists.txt must install the extension into the package directory so it ends up in the wheel:
install(TARGETS _core DESTINATION mypackage)
  1. Build:
pip wheel . -w dist/ -vvv

See the documentation for the full getting started guide, configuration, profiles, dynamic versioning, and more.

Examples

See the examples/ directory:

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conan_py_build-0.6.1.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conan_py_build-0.6.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file conan_py_build-0.6.1.tar.gz.

File metadata

  • Download URL: conan_py_build-0.6.1.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for conan_py_build-0.6.1.tar.gz
Algorithm Hash digest
SHA256 93971610d2890b9ee6a1a85bcbf2c1074511d7a992f4fc6d88e5195d3dde52bb
MD5 104ab9b3f8d6f8edcffd30b8302bd949
BLAKE2b-256 ffd649cb63079f146cacb60e8ae57a1694dc8347e2d007dc4856ab5ba5d3000f

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_py_build-0.6.1.tar.gz:

Publisher: release.yml on conan-io/conan-py-build

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conan_py_build-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: conan_py_build-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for conan_py_build-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42a0385273130fce217e1a4210ad3b092d43e32919b65b243a404064e3af68c8
MD5 06d1cd99e2e22522942495abb30024e3
BLAKE2b-256 fc8609a39f79f7fe21359b10d7a1e962fe7b3233c870b7c6ff2ebb6278867e30

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_py_build-0.6.1-py3-none-any.whl:

Publisher: release.yml on conan-io/conan-py-build

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page