GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - igraph/python-igraph-ctypes: Experimental pure Python ctypes-based interface for igraph

BranchesTags
Open more actions menu

Latest commit

 

History

141 Commits
141 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
benchmarks
benchmarks
 
 
docs
docs
 
 
src
src
 
 
tests
tests
 
 
.coveragerc
.coveragerc
 
 
.git_archival.json
.git_archival.json
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
README.md
README.md
 
 
mise.toml
mise.toml
 
 
mkdocs.yml
mkdocs.yml
 
 
pyproject.toml
pyproject.toml
 
 
uv.lock
uv.lock
 
 

Repository files navigation

python-igraph-ctypes

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.

Status

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.

Usage

  1. Clone the repo.

  2. Install uv if you don't have it yet.

  3. Run uv sync to prepare a virtualenv with all the required dependencies.

  4. Run uv run pytest to run the unit tests, or uv run python to run a Python interpreter where you can import igraph_ctypes

Development

During development, you need to have the shared library of igraph's C core (libigraph.4.so on Linux, libigraph.4.dylib on macOS) available in your LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (macOS).

Large chunks of the code in the library are generated from the interface specification file in igraph (functions.yaml). Stimulus is the name of the component responsible for the code generation and it is in a separate project, referred from this project as a dev dependency. To regenerate the code, run uv run python3 -m codegen.run, which uses Stimulus to parse the interface specification file from igraph and generate the Python code.

Benchmarking

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 uv run richbench benchmarks.

Caveats

  • Apparently you'll need to ensure that the igraph shared library is built without sanitizers, otherwise the dlopen() call fails, at least on macOS.

About

Experimental pure Python ctypes-based interface for igraph

Resources

Readme

Code of conduct

Code of conduct

Security policy

Security policy
Activity
Custom properties

Stars

5 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.