Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrie
MichaelCurrie / Dropzone with Python 3
Last active December 14, 2023 10:19
Drag-and-drop upload files, via JavaScript, to a simple Python 3 HTTP server
#Drag-and-drop upload files, via JavaScript, to a simple Python 3 HTTP server
@oakfang
oakfang / test.py
Last active March 14, 2016 14:35
Using facade.dll to run rust code via python
from facade import dll
import utils
print utils.multi_sum(3)
@seanjensengrey
seanjensengrey / rust-python-cffi.md
Last active April 3, 2024 11:55
Calling Rust from Python/PyPy using CFFI (C Foreign Function Interface)

This is a small demo of how to create a library in Rust and call it from Python (both CPython and PyPy) using the CFFI instead of ctypes.

Based on http://harkablog.com/calling-rust-from-c-and-python.html (dead) which used ctypes

CFFI is nice because:

  • Reads C declarations (parses headers)
  • Works in both CPython and PyPy (included with PyPy)
  • Lower call overhead than ctypes