Skip to main content

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")
clicked_elements = st_cytoscapejs(elements, stylesheet)

if clicked_elements is not None:
    st.write(clicked_elements)

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

Metadata

Release files for streamlit-cytoscapejs 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-cytoscapejs 0.0.2
File Size Uploaded Provenance Actions
streamlit-cytoscapejs-0.0.2.tar.gz 1.0 MB Without provenance Details for streamlit-cytoscapejs-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-cytoscapejs 0.0.2
File Interpreter ABI Platform Actions
streamlit_cytoscapejs-0.0.2-py3-none-any.whl Python 3 none any Details for streamlit_cytoscapejs-0.0.2-py3-none-any.whl

Total release size: 2.1 MB

Release files / streamlit-cytoscapejs-0.0.2.tar.gz

Download URL streamlit-cytoscapejs-0.0.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
353872ecaeced2ca208b2d2dc170bbcfd2cd4015d4b802a960b25a577d15b169
BLAKE2b-256 checksum
How to use checksums
69f8d057645434f71b7f3881ed4bd9ce632cacca0fa102541f309f0a13dd14f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.12

Release files / streamlit_cytoscapejs-0.0.2-py3-none-any.whl

Download URL streamlit_cytoscapejs-0.0.2-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bd073c3646fd735e210aa8803361a71f4c12c7355648c061902389b64f7f72ab
BLAKE2b-256 checksum
How to use checksums
1c72a20c760d8262f7177a3cd052ee394e2aec19c58d0f39294b6852ff48d3b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.12

Security for streamlit-cytoscapejs 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page