A Streamlit custom component for Cytoscape.js
Project description
Streamlit Cytoscape.js
Streamlit wrapper of React Cytoscape.js.
Installation
pip install streamlit-cytoscapejs
Try it
import streamlit as st
from streamlit_cytoscapejs import st_cytoscapejs
elements = [
{"data": {"id": "one", "label": "Node 1"}, "position": {"x": 0, "y": 0}},
{"data": {"id": "two", "label": "Node 2"}, "position": {"x": 100, "y": 0}},
{"data": {"source": "one", "target": "two", "label": "Edge from Node1 to Node2"}},
]
stylesheet = [
{"selector": "node", "style": {"width": 20, "height": 20, "shape": "rectangle"}},
{"selector": "edge", "style": {"width": 10}},
]
st.title("Hello Cytoscape.js")
st_cytoscapejs(elements, stylesheet)
Development
Install
- JS side
cd streamlit_cytoscape/frontend
npm install
- Python side
conda create -n streamlit-cytoscapejs python=3.7
conda activate streamlit-cytoscapejs
pip install -e .
Run
Both webpack dev server and Streamlit should run at the same time.
- JS side
cd streamlit_cytoscape/frontend
npm run start
- Python side
streamlit run app.py
Next steps
I don't plan to make a lot of progress on this for now (except if huge interest) but if you want to contribute/take over its development I'm happy to lend a hand :).
Obviously missing lots of things like:
- viewport manipulation props from React cytoscapejs.
- custom layout
- adding an extension (but also you'd better fork this repo and add the extension yourself I think :/)
References
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
Close
Hashes for streamlit-cytoscapejs-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3094e4b1d7ab0d562cdd14461272ab90f7ab1c09cee25ca3ac14a0c58000eab1 |
|
MD5 | 2b6e64c65b1e0a49a3f1e7b1162b753c |
|
BLAKE2b-256 | 18d2856232dd9f7ae75266c2d963e746030109bf4082fcf74cdf7e1226e3cee2 |
Close
Hashes for streamlit_cytoscapejs-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b94c7ce046e5d2177205aad82f3ba94e471cb6847b1af50af1fef52e09c8f426 |
|
MD5 | 1ce986b67a643e64d2252958867ab4ad |
|
BLAKE2b-256 | 8e0b22c88671434950e5d2add0bbb4ab80f4eb9ade97dfafb60c0212e7375c27 |