Skip to main content

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

Project description

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.

Project details


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.4.3.tar.gz (19.4 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.4.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for conan_py_build-0.4.3.tar.gz
Algorithm Hash digest
SHA256 0cac6c360af22e738cdda57df28eabb4404c3f7be7ef71bbafe5a0b4fb4263d7
MD5 5e191cec7fc2ffc84c52638557ccf97d
BLAKE2b-256 cb30bc7f9feafaec1207344f4ba20280ed5b88b99d4147f45a3a21d5c8afa8cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_py_build-0.4.3.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.4.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for conan_py_build-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e73252ce110e8063db2c06439fd0aca4fba4e5d4134f3508c320a611fc61e08e
MD5 9a98abfab47f24beb90eacbaae3b6fca
BLAKE2b-256 6068da4ee67281c7521356dda054e950b28addfa35f4b5a873431151be4887aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_py_build-0.4.3-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 Pingdom Monitoring Sentry Error logging StatusPage Status page