Skip to main content

Simplified packaging for pybind11-based C++ extensions

Project description

setuptools-cpp

Simplified packaging for pybind11-based C++ extensions

Build Coverage Netlify status
Package version


Documentation: https://setuptools-cpp.davidmontague.xyz

Source Code: https://github.com/dmontagu/setuptools-cpp


Features

  • Pybind11Extension: For standard Pybind11 extensions from C++ source files
  • CMakeExtension: Useful for incorporating CMake-dependent libraries like CGAL
  • Poetry Compatibility: Easy to use with poetry's custom build system

Basic Usage

You can use the CMakeExtension or Pybind11Extension classes in your setup.py as follows:

from setuptools import setup

from setuptools_cpp import CMakeExtension, ExtensionBuilder, Pybind11Extension

ext_modules = [
    # A basic pybind11 extension in <project_root>/src/ext1:
    Pybind11Extension(
        "my_pkg.ext1", ["src/ext1/ext1.cpp"], include_dirs=["src/ext1/include"]
    ),

    # An extension with a custom <project_root>/src/ext2/CMakeLists.txt:
    CMakeExtension(f"my_pkg.ext2", sourcedir="src/ext2")
]

setup(
    name="my_pkg",
    version="0.1.0",
    packages=["my_pkg"],
    # ... other setup kwargs ...
    ext_modules=ext_modules,
    cmdclass=dict(build_ext=ExtensionBuilder),
    zip_safe=False,
)

You can then use standard setuptools commands like python setup.py install.

See the User Guide for more details.

Requirements

This package is intended for use with Python 3.6+.

Installation

pip install setuptools-cpp

License

This project is licensed under the terms of the MIT license.

Project details


Download files

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

Files for setuptools-cpp, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size setuptools_cpp-0.1.0-py3-none-any.whl (6.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size setuptools_cpp-0.1.0.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page