Modern, PEP 517 compliant build backend for building Python packages with
Project description
py-build-cmake
Modern, PEP 517 compliant build backend for building Python packages with extensions built using CMake.
Features
- Build C, C++ or Fortran extension modules for Python using CMake
- Declarative configuration using
pyproject.toml
(PEP 621), compatible with flit - Editable/development installations for Python modules (PEP 660)
- Compatible with pybind11
- Generate stubs for type checking and autocompletion
- Customizable CMake configuration, build and installation options
- Support for multiple installation configurations and components
- Cross-compilation support
- No dependency on setuptools
Installation
The py-build-cmake package is available on PyPI:
pip install py-build-cmake
Documentation
The documentation can be found on https://tttapa.github.io/py-build-cmake.
The format of the configuration file is explained in Config.md.
Alternatively, use the following command to get the documentation for all supported options:
python -m py_build_cmake.help
Usage
If you don't have one already, add a pyproject.toml
configuration file to your
project's repository. Specify the metadata required by PEP 621,
and tell py-build-cmake how to build your project. For example:
[project] # Project metadata
name = "example-project"
readme = "README.md"
requires-python = ">=3.8"
license = { "file" = "LICENSE" }
authors = [{ "name" = "Pieter P", "email" = "pieter.p.dev@outlook.com" }]
keywords = ["some", "keywords"]
classifiers = ["Topic :: Scientific/Engineering"]
urls = { "Documentation" = "https://tttapa.github.io/py-build-cmake" }
dependencies = ["numpy"]
dynamic = ["version", "description"]
[build-system] # How pip and other frontends should build this project
requires = ["py-build-cmake", "mypy"]
build-backend = "py_build_cmake.build"
[tool.py-build-cmake.module] # Where to find the Python module to package
directory = "src-python"
[tool.py-build-cmake.sdist] # What to include in source distributions
include = ["CMakeLists.txt", "src/*"]
[tool.py-build-cmake.cmake] # How to build the CMake project
build_type = "RelWithDebInfo"
source_path = "src"
build_args = ["-j"]
install_components = ["python_modules"]
[tool.py-build-cmake.stubgen] # Whether and how to generate typed stub files
The README of examples/minimal
describes this configuration file in much more detail.
Then use pip
, build
or another PEP 517 compatible frontend to install and/or build the package.
Build sdist and wheel packages you can upload to PyPI:
python -m build . # find the sdist and wheel file in the 'dist' folder
Install the package in the current environment:
pip install . # normal installation
pip install -e . # editable installation
Examples
For example usage, see the examples/minimal
and examples/pybind11-project
example projects.
Planned features
-
Entry point support - Namespace package support (PEP 420)
- Doxygen and Sphinx support
- OSX support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file py-build-cmake-0.0.6.tar.gz
.
File metadata
- Download URL: py-build-cmake-0.0.6.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 065e4fba25732548773a365d43df8a286819d3e0fc7cb20a0f6f5c24da1b92ec |
|
MD5 | a8de1daf9c88dba883153586c43ea34f |
|
BLAKE2b-256 | f5fbd026b576dfa139df05c56d0ee1ef4392cc9212deeeccbb1466b7397ea882 |
File details
Details for the file py_build_cmake-0.0.6-py310-none-any.whl
.
File metadata
- Download URL: py_build_cmake-0.0.6-py310-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48258b2d0670df856f500d156e26824b418bab4987b5133c1f8891e5df6f28d8 |
|
MD5 | 667d193ffbc552cc74f739c629ed5bb9 |
|
BLAKE2b-256 | 3c483afd551dd1872cb9b98aee21a339b3bfab4e0d78b1d8fca804d82df63583 |
File details
Details for the file py_build_cmake-0.0.6-py39-none-any.whl
.
File metadata
- Download URL: py_build_cmake-0.0.6-py39-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b47154c7ec123b86b6922f51a891829e65e15aac51230d492a80e1385cd80ab3 |
|
MD5 | 17dbfb3ad98290a61b7a731f31490773 |
|
BLAKE2b-256 | e0eb75280de87ae712e9fcce589fca2f2ffa9a606e508bbcfeff892ead6a1d29 |
File details
Details for the file py_build_cmake-0.0.6-py38-none-any.whl
.
File metadata
- Download URL: py_build_cmake-0.0.6-py38-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d942e3be564c7a266fab565db14befee2c8529457fdde1210c3fc44fb2af0322 |
|
MD5 | 391c286f761ae13a2e49c478cda5b75b |
|
BLAKE2b-256 | c88cda181829fde7f8ad2434adeae936d41bd5707e3e89f14900464d92254a26 |