Skip to main content

tidy-like interface for network manipulation and visualization in Python

Project description

tidygraph

ci

A tidy-like API for network manipulation with the igraph library inspired by:

The main purpose of using this library on top of python-igraph is to support relational data manipulation.

tg = Tidygraph.from_dataframe(...)
tg.activate(ActiveType.EDGES).join(..., how="outer").mutate({"rank": lambda x: 1.0 - x["score"]})

[!IMPORTANT] This library is experimental, and updates may be infrequent. Use at your own risk.

🧑‍💻 Development

The easiest way to get started with development is through nix and related ecosystem tools.

I recommend installing nix using either options:

[!NOTE] The nix installer provided by the official nix team (since writing, 2026-01-16) is experimental. As a general rule of thumb, choose to install from Determinate Nix if you prefer the additional functionalities provided by the Determinate Nix team, otherwise, use the experimental installer for upstream.

Additionally you will need direnv and nix-direnv.

Most (if not all) nix development workflows use direnv to auto-load the nix shell environment.

The main editor of choice is VSCode. Recommended extensions are included in the workspace file.

If everything is set up correctly, the environment should just work!

🚑️ FAQ

Nix, Python, and VSCode

Unfortunately VSCode does not have a programmatic way to set which python interpreter to use. Because the python environment is managed by nix, and nix installs/builds packages in a non-standard location, VSCode can not auto-detect where your packages are.

You will need to update the python interpreter path whenever your nix shell environment updates.

The easiest way to do this is the following:

# print the python interpreter you are currently tracking
which python

The path should look something like /nix/store/XXXXXXXXXXXXXXXXXX-venv/bin/python. This is the python virtual environment generated by pyproject-nix and uv2nix.

Update the interpreter path in VSCode's python language settings.

[!TIP] You can find the modal quickly using the command palette and searching Python: Select Interpreter.

Is Tidygraph thread-safe?

No. Tidygraph is built on top of igraph, which the core C library is inherently not thread-safe. See official response for details.

👥 Acknowledgements

This library would not have been possible without existing work from dedicated teams:

🔨 TODO

  • Consider adding more verbs available in R tidygraph
  • Cleanup test code

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tidygraph-0.1.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tidygraph-0.1.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file tidygraph-0.1.1.tar.gz.

File metadata

  • Download URL: tidygraph-0.1.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tidygraph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a02b4c3e35846ddce21844c172067f95d21bbdf55c1e0881c982d15f7bb2c329
MD5 bf9d2717613fa3066c5df2f05454c28f
BLAKE2b-256 791b0d66e3f2828b058c417281fc99f903106ad86a0430a5d810a3e81ce29189

See more details on using hashes here.

File details

Details for the file tidygraph-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tidygraph-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tidygraph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d2bbc3415e6f19d50864947174bfccc6da2bd29f90f15f4e53a950a074e8bc
MD5 d0298572131d518d926eb8113694f8cd
BLAKE2b-256 2748ac78c11bbac389e9528b6869ee24de5a0847ff3c13c75942d051285d8cdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page