Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jamesetsmith/pybind11_numpy

A sandbox for me to practice passing NumPy arrays back and forth to C++ with pybind11.
https://github.com/jamesetsmith/pybind11_numpy

Last synced: 15 days ago
JSON representation

A sandbox for me to practice passing NumPy arrays back and forth to C++ with pybind11.

Awesome Lists containing this project

README

        

# Overview
![Build](https://github.com/jamesETsmith/pybind11_numpy/actions/workflows/cmake.yml/badge.svg) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/b63545b9023a466e961b4aeed9c12806)](https://www.codacy.com/gh/jamesETsmith/pybind11_numpy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jamesETsmith/pybind11_numpy&utm_campaign=Badge_Grade)

This a set of simple examples for using `pybind11` with NumPy arrays focusing specifically on passing arrays from Python to C++, modifying them, and then using them some more in Python.

# Software Prerequisites
- CMake >= 3.19
- C++ compiler (`-std=c++11` or later)
- Python 3.X
- pytest
- pybind11 (included in this package)

# Install and Test

```bash
git clone --recursive https://github.com/jamesETsmith/pybind11_numpy.git
cd pybind11_numpy
CXX=YOUR_C++_COMPILER cmake -B build
cmake --build build
PYTHONPATH=build/:$PYTHONPATH pytest -v test
```