Rediscovering fire - on designing portable, multi-language libraries
summary
segyio is a LGPL3 core library (C99) with C++11 and Python 2/3 frontends, available on Debian and PyPI (≈12,000 downloads last month), that prioritizes stable ABI and multi-language reuse. design choices: avoid library-side allocations by exposing a size-query then requiring caller-allocated buffers so Python/NumPy can drive I/O, use small primitive functions with explicit parameters and primitive int error codes (no enums in signatures), provide a separate conversion routine to handle many numeric formats, and read huge files with tiny reusable buffers (e.g. multi-terabyte reads using kilobytes of memory).
AI-written summary · about
chapters (25)
- 0:00Introduction
- 2:06Outline
- 2:26Cement
- 3:24PiPI stats
- 3:54Goals
- 5:41Userfacing
- 7:45ABI
- 9:09API
- 10:08Alignment
- 11:53Primitive types
- 14:00Example
- 15:07Python vs C
- 16:35Native Python
- 18:51Python example
- 24:06Problem with allocation
- 26:14Memory
- 28:56Python
- 31:50Error codes
- 34:13Invalid fields
- 34:49Primitive functions
- 45:46Function
- 47:12Binary stability
- 47:56Separating IO
- 48:40Numerical formats
- 49:56Questions
related talks
33mBuilding with Multiple Languages: A Python-First Approach
01h 05mC++ Reflection Based Libraries to Look Forward To
06mHow We Replace Common C and C++ Libraries
01h 00mHow to call C libraries from C++
35mUsing Rust to write Python modules
01h 00mPlenary: The Beauty and Power of "Primitive" C++
01h 03mWriting sustainable software. The how and the what!
40mRust’s approach of getting things right
