Skip to main content

Modern, PEP 517 compliant build backend for building Python packages with

Project description

Python Wheel

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


Download files

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

Source Distribution

py-build-cmake-0.0.3.tar.gz (19.1 kB view details)

Uploaded Source

Built Distributions

py_build_cmake-0.0.3-py310-none-any.whl (20.4 kB view details)

Uploaded Python 3.10

py_build_cmake-0.0.3-py39-none-any.whl (20.4 kB view details)

Uploaded Python 3.9

py_build_cmake-0.0.3-py38-none-any.whl (20.4 kB view details)

Uploaded Python 3.8

File details

Details for the file py-build-cmake-0.0.3.tar.gz.

File metadata

  • Download URL: py-build-cmake-0.0.3.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for py-build-cmake-0.0.3.tar.gz
Algorithm Hash digest
SHA256 167754e38f2f3c734be4345e3e87e9c65ab8e54fa77c08da028e68bc948d268b
MD5 12282500f10a569528dc15db149f0663
BLAKE2b-256 4d370e7cba2b93efbd7496cd003de728a1eae4b5cf6638b5bbbe67ffbba05eeb

See more details on using hashes here.

File details

Details for the file py_build_cmake-0.0.3-py310-none-any.whl.

File metadata

  • Download URL: py_build_cmake-0.0.3-py310-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3.10
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for py_build_cmake-0.0.3-py310-none-any.whl
Algorithm Hash digest
SHA256 18c790dee6b3d3d0948f9cbb51816803b55709622cc8ffa13fdc181b2cce1cfa
MD5 56130fb66d2139f4e2853e6250d3a937
BLAKE2b-256 958a76d5e982bb2b67662bc222d0d383b2628fac2a16f081ca702d44b3eb184a

See more details on using hashes here.

File details

Details for the file py_build_cmake-0.0.3-py39-none-any.whl.

File metadata

  • Download URL: py_build_cmake-0.0.3-py39-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for py_build_cmake-0.0.3-py39-none-any.whl
Algorithm Hash digest
SHA256 8d0bb444ec73a04248dd8bb84e0978f30866e85ad0eeee5b0ccf45a6b6fc24d3
MD5 7e1c2db196fc9bb5289c41b5d32cf66b
BLAKE2b-256 caed3133962e10793fbb02f66704084d3cf323ebaeccbba27cc6708688b27106

See more details on using hashes here.

File details

Details for the file py_build_cmake-0.0.3-py38-none-any.whl.

File metadata

  • Download URL: py_build_cmake-0.0.3-py38-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for py_build_cmake-0.0.3-py38-none-any.whl
Algorithm Hash digest
SHA256 b70f9f1f8e75c121c3236ef50666e45d51688dc02697521a4a874f3aef07c55f
MD5 1af1a09851418d6cbec230c084c3b038
BLAKE2b-256 a8110dcbe436f8dc3e254015385687c9a72a73b32208db86b13c1f5914d44a54

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page