tidy-like interface for network manipulation and visualization in Python
Project description
tidygraph
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.
📦️ Installation
This package is available on PyPI.
You can install plot backends (cairo, matplotlib, or plotly) using the extras option.
# Base
pip install tidygraph
uv add tidygraph
# With plot support
pip install "tidygraph[cairo]"
uv add tidygraph --optional cairo
🧑💻 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.
The environment should just work if everything is setup correctly!
🚑️ 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 cannot 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tidygraph-0.6.0.tar.gz.
File metadata
- Download URL: tidygraph-0.6.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fd59dddd4ca9394f5dfa3da4cb591915ecdfe32183d21d2f5b18255a909ace1
|
|
| MD5 |
ba93cb86776842b59b98334556ea909b
|
|
| BLAKE2b-256 |
38f620d1c1ba76a077c1a1d5aaa6aefe2931aa09bdabda9833c977041c7fc327
|
File details
Details for the file tidygraph-0.6.0-py3-none-any.whl.
File metadata
- Download URL: tidygraph-0.6.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea20f2b88e4f265ed025e0b119c4fd797e63e39a2ad35f09b4d99a405baed0bd
|
|
| MD5 |
864e828c50fd7b4ddecdf6c64023145d
|
|
| BLAKE2b-256 |
ecd5eb006f8d83267ecd506400368fa6bef3c020fe0609eed067a1300a70093f
|