Skip to main content

A custom Jupyter widget library to display graphs using sigma.js.

Project description

ipysigma

A custom Jupyter widget library to display graphs using sigma.js.

Summary

Installation

You can install using pip:

pip install ipysigma

If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:

jupyter nbextension enable --py --sys-prefix ipysigma

# You might need one of those other commands
jupyter nbextension enable --py --user ipysigma
jupyter nbextension enable --py --system ipysigma

Usage

import networkx as nx
from ipysigma import Sigma

# Creating a dummy graph to serve as example
g = nx.karate_club_graph()

# Displaying the graph
Sigma(g)

# Tweaking height of widget
Sigma(g, height=300)

# Starting layout automatically
Sigma(g, start_layout=True)

# Displaying a gexf file
Sigma.from_gexf('./path/to/file.gexf')

Development Installation

Create a dev environment using conda or pyenv:

# Using pyenv
pyenv virtualenv 3.6.10 ipysigma
pyenv local ipysigma

# Using conda
conda create -n ipysigma-dev -c conda-forge nodejs yarn python jupyterlab
conda activate ipysigma-dev

Install the python package. This will also build the TS package.

pip install -e ".[test, examples]"

When developing your extensions, you need to manually enable your extensions with the notebook / lab frontend. For lab, this is done by the command:

jupyter labextension develop --overwrite .
yarn run build

For classic notebook, you need to run:

jupyter nbextension install --sys-prefix --symlink --overwrite --py ipysigma
jupyter nbextension enable --sys-prefix --py ipysigma

Note that the --symlink flag doesn't work on Windows, so you will here have to run the install command every time that you rebuild your extension. For certain installations you might also need another flag instead of --sys-prefix, but we won't cover the meaning of those flags here.

Alternatively you can also run make deps that will handle all of the above for you.

How to see your changes

Typescript:

If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the widget.

# Watch the source directory in one terminal, automatically rebuilding when needed
yarn run watch
# Run JupyterLab in another terminal
jupyter lab

After a change wait for the build to finish and then refresh your browser and the changes should take effect.

Python:

If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.

How to bump version

You need to make sure to update the version in the following files:

  • package.json
  • package-lock.json
  • ipysigma/_frontend.py
  • ipysigma/_version.py

How to release

Run make release.

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

ipysigma-0.7.0.tar.gz (565.3 kB view details)

Uploaded Source

Built Distribution

ipysigma-0.7.0-py2.py3-none-any.whl (951.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ipysigma-0.7.0.tar.gz.

File metadata

  • Download URL: ipysigma-0.7.0.tar.gz
  • Upload date:
  • Size: 565.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.10

File hashes

Hashes for ipysigma-0.7.0.tar.gz
Algorithm Hash digest
SHA256 ef38b6c4d5ac459147239be31a2aafd290ce4cd329998dc1065d2651c3f00452
MD5 3264c774ab69ac7a5b98f082f3aca726
BLAKE2b-256 662f487490d1453fbe9c99fe12c2eafd8de939b43f0ac36192d64a0800e835dc

See more details on using hashes here.

File details

Details for the file ipysigma-0.7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ipysigma-0.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 951.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.10

File hashes

Hashes for ipysigma-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 45791259e4d2be7edde48764b45fb82a176ea385780b5675541eddde319064f3
MD5 481f810429719b3e02cb0cb4c3698c4d
BLAKE2b-256 a8fd57e7cd8aba2e864c00044dccfb293be4fa5fdde84ad713fbcebbcb0c4ed3

See more details on using hashes here.

Supported by

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