Commit 8091a800 authored by Sebastian Kehl's avatar Sebastian Kehl
Browse files

Update ARTICLE.md

parent 7d7ded76
......@@ -2,16 +2,17 @@
## Introduction
With the popularity and success of the python programming language, it has become increasingly important for researches to be able to make software developments available to the python eco-system by means of extension packages. To this end, [Pybind11](https://github.com/pybind/pybind11) library provides a convenient approach to generate python bindings of existing C++ code. In this context, the [sciki-build](https://github.com/scikit-build/scikit-build) project can be used to bridge python's `setuptools` with [CMake](https://cmake.org/). As a resuls, CMake's features such as, e.g., choice of build-generators, dependency management or cross-compilation, can be exploited from within the installation process of the developed python extension.
With the popularity and success of the python programming language, it has become increasingly important for researches to be able to make software developments available to the python eco-system by means of extension packages. To this end, the [Pybind11](https://github.com/pybind/pybind11) library provides a convenient approach to generate python bindings of existing C++ code. In this context, the [sciki-build](https://github.com/scikit-build/scikit-build) project can be used to bridge python's `setuptools` with [CMake](https://cmake.org/). As a resuls, CMake's features such as, e.g., choice of build-generators, dependency management or cross-compilation, can be exploited from within the installation process of the developed python extension.
## Installation
## Basic Usage
scikit-build is available from the 'Python Package Index' and can be installed with
```
pip install scikit-build
```
The basic usage of pybind11 in combindation with scikit-build will be demonstrated in the following using a 'hello-world' python extension that can be accessed [here](sebak/pybind11-hello-world).
## Basic Usage
## pybind11 hello-world
missing content
## build with scikit-learn
scikit-build provides a drop-in replacement for the `setuptools.setup` function that can be used in a project's `setup.py` via
......@@ -19,11 +20,31 @@ scikit-build provides a drop-in replacement for the `setuptools.setup` function
from skbuild import setup
```
Beside the standard setuptools options, it provides [extra options](https://scikit-build.readthedocs.io/en/latest/usage.html#scikit-build-options) to control the CMake build.
Beside the standard setuptools options, it provides [extra options](https://scikit-build.readthedocs.io/en/latest/usage.html#scikit-build-options) to control the CMake build. In addition, a `CMakeLists.txt` file must be available in the top-level directory of the project such as, e.g.,
```
cmake_minimum_required(VERSION 3.18)
project(hello-world VERSION "1.0")
find_package(pybind11)
pybind11_add_module(_hello MODULE src/hello/hello.cpp)
install(TARGETS _hello DESTINATION .)
```
Build-system dependencies have to be specified the project's `pyproject.toml` file:
```
[build-system]
requires = [
"setuptools>=42",
"wheel",
"pybind11[global]~=2.6.0",
"cmake>=3.18",
"scikit-build",
]
build-backend = "setuptools.build_meta"
```
A minimal 'hello-world' example is provided [here](sebak/pybind11-hello-world).
With modern python packaging, it is thus not necessary to manually install scikit-build, but all build-dependencies will be installed in an isolated build-enviroment. Like this, also dependecies like pybind11 or CMake can be made available with an up-to-date version of `pip`. Please note that the `[global]` feature of the pybind11 requirement, which installs headers and libraries, does not apply to the used python installation or environment but to the dedicated build environment and can thus be used savely here.
*Sebastian Kehl, Klaus Reuter*
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment