How to wrap C in Python

There are several ways to wrap C in Python, and I don't know which one to use, so I've summarized them. However, I can't guarantee that it's correct because I didn't actually try it just by checking it. There seems to be other methods with cpp.

Method

Python/C API --Advantages --Can be completed with CPython only --Often used

--Disadvantages --Needs a deep understanding of Python, C, and the Python / C API --Since it is written like C, the amount of code increases

SWIG --Advantages --Automatically wraps

--Disadvantages --Complex code cannot be wrapped automatically

SIP --Advantages --Unknown

--Disadvantages --There is almost no information in Japanese

Boost.Python --Advantages --Automatically wraps

--Disadvantages --You need to mess with the code on the c side

ctypes --Advantages --Automatically wraps --A standard feature of Python

--Disadvantages --Complex code cannot be wrapped automatically

cffi --Advantages --Automatically wraps

--Disadvantages ――When it gets complicated, it cannot be wrapped automatically --There is not much information in Japanese

Cython --Advantages --Faster than other wrap tools --Easy to improve and simplify the interface

--Disadvantages --It doesn't wrap automatically

Summary

Cython looks good

Recommended Posts

How to wrap C in Python
How to develop in Python
How to generate permutations in Python and C ++
[Python] How to do PCA in Python
How to collect images in Python
How to use SQLite in Python
How to use Mysql in python
How to use ChemSpider in Python
How to use PubChem in Python
How to handle Japanese in Python
[Introduction to Python] How to use class in Python?
How to access environment variables in Python
How to dynamically define variables in Python
[Itertools.permutations] How to put permutations in Python
How to use Google Test in C
How to work with BigQuery in Python
How to get a stacktrace in python
How to extract polygon area in Python
How to check opencv version in python
How to switch python versions in cloud9
How to adjust image contrast in Python
How to use __slots__ in Python class
How to dynamically zero pad in Python
How to use regular expressions in Python
How to display Hello world in python
How to use is and == in Python
How to write Ruby to_s in Python
How to install Python
How to install python
C API in Python 3
How to receive command line arguments in Python
[REAPER] How to play with Reascript in Python
How to embed a variable in a python string
How to implement Discord Slash Command in Python
Summary of how to import files in Python 3
How to simplify restricted polynomial fit in python
How to use Python Image Library in python3 series
How to implement shared memory in Python (mmap.mmap)
How to create a JSON file in Python
How to multi-process exclusive control in C language
Summary of how to use MNIST in Python
How to specify TLS version in python requests
How to notify a Discord channel in Python
How to get the files in the [Python] folder
How to use tkinter with python in pyenv
How to run Leap Motion in non-Apple Python
[Python] How to draw a histogram in Matplotlib
How to output "Ketsumaimo" as standard output in Python
How to handle datetime type in python sqlite3
How to make Python Interpreter changes in Pycharm
How to plot autocorrelation and partial autocorrelation in python
How to remove duplicate elements in Python3 list
Extend python in C ++ (Boost.NumPy)
[2020.8 latest] How to install Python
How to install Python [Windows]
python3: How to use bottle (2)
[Python] How to use list 1
Login to website in Python
How to update Python Tkinter to 8.6
How to use Python argparse
Wrap long expressions in python