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
- Set
conan-py-buildas your build backend:
[build-system]
requires = ["conan-py-build"]
build-backend = "conan_py_build.build"
[project]
name = "mypackage"
version = "0.1.0"
- Add a
conanfile.pywith 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()
- Your
CMakeLists.txtmust install the extension into the package directory so it ends up in the wheel:
install(TARGETS _core DESTINATION mypackage)
- 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:
- basic —
fmtextension, recipe viaconanfile-path - basic-pybind11 — pybind11 +
fmt, dynamic version, PEP 639 - basic-nanobind — nanobind +
fmt,extra-profilefor C++17 - external-sources — pybind11, C++ dep fetched in
source() - cibw-example — pybind11 + cibuildwheel
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file conan_py_build-0.4.0.tar.gz.
File metadata
- Download URL: conan_py_build-0.4.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a019a626b8f813c420208943437a762f210d9a4ccec730db9c15d941b64ad03e
|
|
| MD5 |
485e8501355cb3120d670a99e9108810
|
|
| BLAKE2b-256 |
9c2685b42473d43f0c07cf26cbd91e63a3292f9ed620a32ba0c2740c1f082ff7
|
Provenance
The following attestation bundles were made for conan_py_build-0.4.0.tar.gz:
Publisher:
release.yml on conan-io/conan-py-build
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conan_py_build-0.4.0.tar.gz -
Subject digest:
a019a626b8f813c420208943437a762f210d9a4ccec730db9c15d941b64ad03e - Sigstore transparency entry: 1318364598
- Sigstore integration time:
-
Permalink:
conan-io/conan-py-build@18a77b0c241291671d0b12d88b1e8aeb5fc62ac2 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/conan-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@18a77b0c241291671d0b12d88b1e8aeb5fc62ac2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file conan_py_build-0.4.0-py3-none-any.whl.
File metadata
- Download URL: conan_py_build-0.4.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bc05ea6ea2b0683d96739c0b68cedc0335e6b89dd8395504fe694bb41a1bd23
|
|
| MD5 |
9c65767842a2ec749b56adc7e5fe8a4c
|
|
| BLAKE2b-256 |
fa1e906d6400d2d5613be30ce27b7473a3eb913e6cbe33f6f8249f999fbf3468
|
Provenance
The following attestation bundles were made for conan_py_build-0.4.0-py3-none-any.whl:
Publisher:
release.yml on conan-io/conan-py-build
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
conan_py_build-0.4.0-py3-none-any.whl -
Subject digest:
8bc05ea6ea2b0683d96739c0b68cedc0335e6b89dd8395504fe694bb41a1bd23 - Sigstore transparency entry: 1318364967
- Sigstore integration time:
-
Permalink:
conan-io/conan-py-build@18a77b0c241291671d0b12d88b1e8aeb5fc62ac2 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/conan-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@18a77b0c241291671d0b12d88b1e8aeb5fc62ac2 -
Trigger Event:
release
-
Statement type: