py-build-cmake


Namepy-build-cmake JSON
Version 0.1.8 PyPI version JSON
download
home_page
SummaryModern, PEP 517 compliant build backend for creating Python packages with
upload_time2023-04-17 16:33:07
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords pep517 cmake
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Python Wheel](https://github.com/tttapa/py-build-cmake/actions/workflows/wheel.yml/badge.svg)](https://github.com/tttapa/py-build-cmake/actions/workflows/wheel.yml)
[![Documentation](https://img.shields.io/badge/Documentation-main-blue)](https://tttapa.github.io/py-build-cmake)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/py-build-cmake?label=PyPI)](https://pypi.org/project/py-build-cmake)

# py-build-cmake

Modern, [PEP 517](https://www.python.org/dev/peps/pep-0517/) compliant build
backend for creating Python packages with extensions built using CMake.

## Features

 - Building and packaging C, C++ or Fortran extension modules for Python using CMake
 - Declarative configuration using `pyproject.toml` ([PEP 621](https://www.python.org/dev/peps/pep-0621/)), compatible with
   [flit](https://github.com/pypa/flit)
 - Editable/development installations for Python modules ([PEP 660](https://www.python.org/dev/peps/pep-0660/))
 - Compatible with [pybind11](https://github.com/pybind/pybind11) and [nanobind](https://github.com/wjakob/nanobind)
 - Stub generation 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](https://github.com/pypa/setuptools)
 - Compatible with [cibuildwheel](https://github.com/pypa/cibuildwheel) for building Wheels

## Installation

The py-build-cmake package is available on
[PyPI](https://pypi.org/project/py-build-cmake/):

```sh
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](https://tttapa.github.io/py-build-cmake/Config.html).

Alternatively, use the [command-line interface](https://tttapa.github.io/py-build-cmake/CLI.html)
to get the documentation for all supported options:
```sh
py-build-cmake config format
```

## 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](https://www.python.org/dev/peps/pep-0621/),
and tell py-build-cmake how to build your project. For example:

```toml
[project] # Project metadata
name = "example-project"
readme = "README.md"
requires-python = ">=3.7"
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~=0.1.8"]
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`](https://github.com/tttapa/py-build-cmake/tree/main/examples/minimal)
describes this configuration file in much more detail.

Then use [`pip`](https://github.com/pypa/pip), [`build`](https://github.com/pypa/build)
or another PEP 517 compatible frontend to build and/or install the package.

Build sdist and wheel packages you can upload to PyPI:
```sh
python -m pip install -U build
python -m build . # find the sdist and wheel file in the 'dist' folder
```

Install the package in the current environment:
```sh
pip install .    # normal installation
pip install -e . # editable installation
```

## Examples

As an introduction to py-build-cmake, see [`examples/minimal`](https://github.com/tttapa/py-build-cmake/tree/main/examples/minimal)
for a detailed overview of the configuration files and the directory structure,
using a very simple Python module as an example.  
For a more advanced, real-world example, see [`examples/pybind11-project`](https://github.com/tttapa/py-build-cmake/tree/main/examples/pybind11-project)
and [`examples/nanobind-project`](https://github.com/tttapa/py-build-cmake/tree/main/examples/nanobind-project).  
If you are interested in packaging C/C++/Fortran programs using py-build-cmake,
have a look at [`examples/minimal-program`](https://github.com/tttapa/py-build-cmake/tree/main/examples/minimal-program).

## Projects using py-build-cmake

If you need more examples, you can look at the following projects using
py-build-cmake as their Python build backend:

- [alpaqa](https://github.com/kul-optec/alpaqa/tree/develop)
- [QPALM](https://github.com/kul-optec/QPALM)

## Planned features

 - [x] ~~macOS support~~
 - [x] ~~Entry point support~~
 - [ ] Namespace package support ([PEP 420](https://www.python.org/dev/peps/pep-0420/))
 - [ ] Doxygen and Sphinx support


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "py-build-cmake",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "pep517,cmake",
    "author": "",
    "author_email": "Pieter P <pieter.p.dev@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/eb/64/d3f17afa94c79a49b8bebe95b4bab6f983a0071b603ce6752afea4c2547d/py-build-cmake-0.1.8.tar.gz",
    "platform": null,
    "description": "[![Python Wheel](https://github.com/tttapa/py-build-cmake/actions/workflows/wheel.yml/badge.svg)](https://github.com/tttapa/py-build-cmake/actions/workflows/wheel.yml)\n[![Documentation](https://img.shields.io/badge/Documentation-main-blue)](https://tttapa.github.io/py-build-cmake)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/py-build-cmake?label=PyPI)](https://pypi.org/project/py-build-cmake)\n\n# py-build-cmake\n\nModern, [PEP 517](https://www.python.org/dev/peps/pep-0517/) compliant build\nbackend for creating Python packages with extensions built using CMake.\n\n## Features\n\n - Building and packaging C, C++ or Fortran extension modules for Python using CMake\n - Declarative configuration using `pyproject.toml` ([PEP 621](https://www.python.org/dev/peps/pep-0621/)), compatible with\n   [flit](https://github.com/pypa/flit)\n - Editable/development installations for Python modules ([PEP 660](https://www.python.org/dev/peps/pep-0660/))\n - Compatible with [pybind11](https://github.com/pybind/pybind11) and [nanobind](https://github.com/wjakob/nanobind)\n - Stub generation for type checking and autocompletion\n - Customizable CMake configuration, build and installation options\n - Support for multiple installation configurations and components\n - Cross-compilation support\n - No dependency on [setuptools](https://github.com/pypa/setuptools)\n - Compatible with [cibuildwheel](https://github.com/pypa/cibuildwheel) for building Wheels\n\n## Installation\n\nThe py-build-cmake package is available on\n[PyPI](https://pypi.org/project/py-build-cmake/):\n\n```sh\npip install py-build-cmake\n```\n\n## Documentation\n\nThe documentation can be found on <https://tttapa.github.io/py-build-cmake>.\n\nThe format of the configuration file is explained in \n[Config.md](https://tttapa.github.io/py-build-cmake/Config.html).\n\nAlternatively, use the [command-line interface](https://tttapa.github.io/py-build-cmake/CLI.html)\nto get the documentation for all supported options:\n```sh\npy-build-cmake config format\n```\n\n## Usage\n\nIf you don't have one already, add a `pyproject.toml` configuration file to your\nproject's repository. Specify the metadata required by [PEP 621](https://www.python.org/dev/peps/pep-0621/),\nand tell py-build-cmake how to build your project. For example:\n\n```toml\n[project] # Project metadata\nname = \"example-project\"\nreadme = \"README.md\"\nrequires-python = \">=3.7\"\nlicense = { \"file\" = \"LICENSE\" }\nauthors = [{ \"name\" = \"Pieter P\", \"email\" = \"pieter.p.dev@outlook.com\" }]\nkeywords = [\"some\", \"keywords\"]\nclassifiers = [\"Topic :: Scientific/Engineering\"]\nurls = { \"Documentation\" = \"https://tttapa.github.io/py-build-cmake\" }\ndependencies = [\"numpy\"]\ndynamic = [\"version\", \"description\"]\n\n[build-system] # How pip and other frontends should build this project\nrequires = [\"py-build-cmake~=0.1.8\"]\nbuild-backend = \"py_build_cmake.build\"\n\n[tool.py-build-cmake.module] # Where to find the Python module to package\ndirectory = \"src-python\"\n\n[tool.py-build-cmake.sdist] # What to include in source distributions\ninclude = [\"CMakeLists.txt\", \"src/*\"]\n\n[tool.py-build-cmake.cmake] # How to build the CMake project\nbuild_type = \"RelWithDebInfo\"\nsource_path = \"src\"\nbuild_args = [\"-j\"]\ninstall_components = [\"python_modules\"]\n\n[tool.py-build-cmake.stubgen] # Whether and how to generate typed stub files\n```\nThe README of [`examples/minimal`](https://github.com/tttapa/py-build-cmake/tree/main/examples/minimal)\ndescribes this configuration file in much more detail.\n\nThen use [`pip`](https://github.com/pypa/pip), [`build`](https://github.com/pypa/build)\nor another PEP 517 compatible frontend to build and/or install the package.\n\nBuild sdist and wheel packages you can upload to PyPI:\n```sh\npython -m pip install -U build\npython -m build . # find the sdist and wheel file in the 'dist' folder\n```\n\nInstall the package in the current environment:\n```sh\npip install .    # normal installation\npip install -e . # editable installation\n```\n\n## Examples\n\nAs an introduction to py-build-cmake, see [`examples/minimal`](https://github.com/tttapa/py-build-cmake/tree/main/examples/minimal)\nfor a detailed overview of the configuration files and the directory structure,\nusing a very simple Python module as an example.  \nFor a more advanced, real-world example, see [`examples/pybind11-project`](https://github.com/tttapa/py-build-cmake/tree/main/examples/pybind11-project)\nand [`examples/nanobind-project`](https://github.com/tttapa/py-build-cmake/tree/main/examples/nanobind-project).  \nIf you are interested in packaging C/C++/Fortran programs using py-build-cmake,\nhave a look at [`examples/minimal-program`](https://github.com/tttapa/py-build-cmake/tree/main/examples/minimal-program).\n\n## Projects using py-build-cmake\n\nIf you need more examples, you can look at the following projects using\npy-build-cmake as their Python build backend:\n\n- [alpaqa](https://github.com/kul-optec/alpaqa/tree/develop)\n- [QPALM](https://github.com/kul-optec/QPALM)\n\n## Planned features\n\n - [x] ~~macOS support~~\n - [x] ~~Entry point support~~\n - [ ] Namespace package support ([PEP 420](https://www.python.org/dev/peps/pep-0420/))\n - [ ] Doxygen and Sphinx support\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Modern, PEP 517 compliant build backend for creating Python packages with",
    "version": "0.1.8",
    "project_urls": {
        "Documentation": "https://tttapa.github.io/py-build-cmake",
        "Source": "https://github.com/tttapa/py-build-cmake",
        "Tracker": "https://github.com/tttapa/py-build-cmake/issues"
    },
    "split_keywords": [
        "pep517",
        "cmake"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "28776a9c77040a8ff8a652bcd698fcbcda252cfcd177e4590c52ae8469d4caba",
                "md5": "c396bb5f88427ba35d0687dce318c57e",
                "sha256": "bee4107849d2646df7c1b461e1268e24109dd903e57d14bc99d32864a04e802d"
            },
            "downloads": -1,
            "filename": "py_build_cmake-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c396bb5f88427ba35d0687dce318c57e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 35251,
            "upload_time": "2023-04-17T16:33:04",
            "upload_time_iso_8601": "2023-04-17T16:33:04.561655Z",
            "url": "https://files.pythonhosted.org/packages/28/77/6a9c77040a8ff8a652bcd698fcbcda252cfcd177e4590c52ae8469d4caba/py_build_cmake-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb64d3f17afa94c79a49b8bebe95b4bab6f983a0071b603ce6752afea4c2547d",
                "md5": "c5512561dd1f413abccbeb4ac8ac28bd",
                "sha256": "f90b8e2b9a273670fe7251e744eaede75132e798e5402477282a47012b2e5bdb"
            },
            "downloads": -1,
            "filename": "py-build-cmake-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "c5512561dd1f413abccbeb4ac8ac28bd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 31118,
            "upload_time": "2023-04-17T16:33:07",
            "upload_time_iso_8601": "2023-04-17T16:33:07.082697Z",
            "url": "https://files.pythonhosted.org/packages/eb/64/d3f17afa94c79a49b8bebe95b4bab6f983a0071b603ce6752afea4c2547d/py-build-cmake-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-17 16:33:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tttapa",
    "github_project": "py-build-cmake",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "py-build-cmake"
}
        
Elapsed time: 0.18509s