This repository contains an experimental Python API to the igraph C library, with the following goals:
-
It should contain as little hand-written C code as possible.
-
It should rely on code generation to create most of the glue code between Python and igraph's core C API to make it easier to adapt to changes in the underlying C library without having to re-write too much of the Python code.
-
It should provide full type annotations.
This repo is highly experimental and currently it is only in a proof-of-concept stage. The vast majority of igraph's API is not exposed, and things may break randomly, or they may not even work.
-
Clone the repo.
-
Install
poetry
if you don't have it yet. -
Run
poetry install
to prepare a virtualenv with all the required dependencies. -
Run
poetry run pytest
to run the unit tests, orpoetry run python
to run a Python interpreter where you canimport igraph_ctypes
Benchmarks will be placed in benchmarks
and they will compare the "old",
official Python interface of igraph with this new implementation. To run the
benchmarks, type poetry run richbench benchmarks
.
- Apparently you'll need to ensure that the igraph shared library is built
without sanitizers, otherwise the
dlopen()
call fails, at least on macOS.