Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An example of a hybrid python/C++ package with unit tests

License

NotificationsYou must be signed in to change notification settings

benjaminjack/python_cpp_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains an example Python module which wraps C++ code. The code presented here was designed to meet four requirements:

  1. Python bindings for C++ code (usingpybind11 and built withCMake)
  2. Unit tests for C++ code (usingcatch)
  3. Unit tests for Python code (usingunittest)
  4. Asetuptools setup.py script for building, installation, and testing

Please see theblog post that accompanies this repository for more information.

NOTE: If you'd like to see the version of the repository that corresponds to myoriginal June 2017 blog post, go tothis release. However, I no longer recommend using the repository structure from this old release.

Installation

To build and installpython_cpp_example, clone or download this repository and then, from within the repository, run:

python3 ./setup.py install

or

pip3 install.

Tests

To execute all unit tests, run the following command:

python3 ./setup.pytest

Requirements

  • Python 2 or 3
  • CMake 2.8.12 or higher
  • A modern compiler with C++11 support

Acknowledgements

Much of the code in this repository was adapted from thepybind11 tutorial and thepybind11 example CMake repository.

About

An example of a hybrid python/C++ package with unit tests

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp