A Jupyter widget using sigma.js to render interactive networks.
Project description
ipysigma
A Jupyter widget using sigma.js to render interactive networks.
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
g = nx.read_gexf('./path/to/file.gexf')
Sigma(g)
Development Installation
Be sure to have a working installation of Node.js >= 14.
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
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
File details
Details for the file ipysigma-0.20.0.tar.gz
.
File metadata
- Download URL: ipysigma-0.20.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0408818eb46924c119efaac5c1a4f7cf1cbca14e74dd1a36a16e8ead6f2662b2 |
|
MD5 | 134a18c0353e76eadb45d71e9d89b97d |
|
BLAKE2b-256 | 6d2ae4db3fc5e0afa1addec226b1a20edec8046620c37975e024e5c9b4df6fab |
File details
Details for the file ipysigma-0.20.0-py2.py3-none-any.whl
.
File metadata
- Download URL: ipysigma-0.20.0-py2.py3-none-any.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c767b54934d4591fc60ee8c37fc85193ae1eb51fbe59cf73fb53fb056542b2e9 |
|
MD5 | e2cc235212871e155b49815d887509d0 |
|
BLAKE2b-256 | 89b73c34ec72ed6b1b575c83212dba59cdd9e2636d18ca712629db48888107fd |