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.2.tar.gz (19.1 kB view details)

Uploaded Source

Built Distributions

py_build_cmake-0.0.2-py310-none-any.whl (20.3 kB view details)

Uploaded Python 3.10

py_build_cmake-0.0.2-py39-none-any.whl (20.3 kB view details)

Uploaded Python 3.9

py_build_cmake-0.0.2-py38-none-any.whl (20.3 kB view details)

Uploaded Python 3.8

File details

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

File metadata

  • Download URL: py-build-cmake-0.0.2.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.0 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.2.tar.gz
Algorithm Hash digest
SHA256 0e824efdafa7ecc1676efceaef1dc0182373827505a3fb4b7d2139b518f583ae
MD5 a0208938d62a1baad1ffd423cdb03e12
BLAKE2b-256 0df1ecb59e934cf3a413b3e968fb729ccd31e0016da6231d4bd2b28546d747bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_build_cmake-0.0.2-py310-none-any.whl
  • Upload date:
  • Size: 20.3 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.0 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.2-py310-none-any.whl
Algorithm Hash digest
SHA256 dc77a7e57ab4d4724d2bdcb7deeba1f62d7902987cc13cf5f29f073292411df2
MD5 617a45d0f0dae6e4ebcef02af1cd5de4
BLAKE2b-256 9796285e084edfbff048fc9debd3dc049bb2e91ca237a6075ca497a655017d40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_build_cmake-0.0.2-py39-none-any.whl
  • Upload date:
  • Size: 20.3 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.0 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.2-py39-none-any.whl
Algorithm Hash digest
SHA256 8bd1ef3b1af910fe5859e56457adec494c6cbf5e185323c668155b09f825431a
MD5 38d6e5c2f4d12cb13472ef8ef5509433
BLAKE2b-256 c6cadf1a9bafc9965fd8a7ab92c5f92ad6ec99ec9760266db3883c14dd15d692

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_build_cmake-0.0.2-py38-none-any.whl
  • Upload date:
  • Size: 20.3 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.0 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.2-py38-none-any.whl
Algorithm Hash digest
SHA256 6215e6819d0ae681ce7deaedea068327c8228a52577bffed3bc7e30d8525d9cf
MD5 88d586e8f2cfca06acc03c7fef022db9
BLAKE2b-256 445029cc3768327b43f9530cec4c990ec2712cb5984efc3f22944165132eb1a5

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