Skip to main content

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

Project description

Python Wheel Documentation PyPI - Downloads

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

Uploaded Source

Built Distributions

py_build_cmake-0.0.4-py310-none-any.whl (20.5 kB view details)

Uploaded Python 3.10

py_build_cmake-0.0.4-py39-none-any.whl (20.5 kB view details)

Uploaded Python 3.9

py_build_cmake-0.0.4-py38-none-any.whl (20.5 kB view details)

Uploaded Python 3.8

File details

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

File metadata

  • Download URL: py-build-cmake-0.0.4.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

Hashes for py-build-cmake-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3e4647bc8bc884cab8834c3363904071c669ff3b8ce0488aae93be29989da4d9
MD5 8199b41d7f02e700dbd3b76ab21eb3a8
BLAKE2b-256 b23f27c41103dc84d4ba65ad4ac64dfa0ecdfdebbe54dbc399a2d2e79f8bb330

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_build_cmake-0.0.4-py310-none-any.whl
Algorithm Hash digest
SHA256 206204a7b2f4cbb439b78f313e701a329edde298b4523930ba1defd1b749677b
MD5 db0d2bf3a63b824504fe4d43c6090e43
BLAKE2b-256 9295089811e17868ae651fa393e70246b793b2c53db97662d8e0204e1b364c17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_build_cmake-0.0.4-py39-none-any.whl
Algorithm Hash digest
SHA256 ed52b576751e7a1db1eb712bcd4545578588f4d453db3c4f914a373b8b623278
MD5 357e6f5a31ee0458f797c2060054d2fd
BLAKE2b-256 22162ccd1b67a466c6e7f68261a7fdc28c147c2bdd86db69af694ddb12ee624e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_build_cmake-0.0.4-py38-none-any.whl
Algorithm Hash digest
SHA256 51b3930d5f8f20e44a7f15894968118e148e17ff60ad4a7227dda786da6600b1
MD5 85c49fe229d0adb3b830c76e6d33c54f
BLAKE2b-256 a4b6e5c6c502adda2fea03896789628891d89b4f1e93e5b54237bff0cb072a7e

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