Skip to main content

streamlit-sigmajs

GLWT pypi

A Streamlit component for interactive property graph visualization, powered by Sigma.js.

Demo

image

Roadmap

  • Basic graph visualization
  • Node and edge styling
  • In-component node and edge selection
  • Python interaction callbacks
  • Graph layouts
  • Theming

Local Installation

Install the Python package and development dependencies:

uv sync --extra dev

To build your frontend code, run the following commands from the st_sigma/frontend directory:

npm ci
npm run build

To run in development mode with hot-reloading, in the st_sigma/frontend directory, run:

npm ci
npm run start

To start the bundled example app, run:

uv run --with neo4j streamlit run st_sigma/example.py

Install from PyPI

uv add streamlit-sigmajs

Build and publish to PyPI

  1. Update the version in pyproject.toml.
  2. Build the frontend and Python distributions:
cd st_sigma/frontend
npm ci
npm run build
cd ../..
uv build
  1. Validate the distributions locally:
uvx twine check dist/*

PyPI releases are published by the publish GitHub Actions workflow using Trusted Publishing. Push a version tag such as v0.1.2, or manually dispatch the workflow for an existing tag. No PyPI API token is stored in GitHub.

Usage

The graph visualizer takes a customized graph dictionary in its graphData argument. You can convert a Neo4j graph result to the required dictionary using the neo4jgraph_to_sigma utility function. The neo4jgraph_to_sigma function takes a neo4j.Graph object as input, usually the results you get from driver.execute_query(..., result_transformer_=neo4j.Result.graph).

import streamlit as st
from st_sigma import st_sigmagraph, neo4jgraph_to_sigma

import neo4j
from neo4j import GraphDatabase

NEO4J_URI = "bolt://localhost:7677"
NEO4J_USER = "neo4j"
NEO4J_PASSWORD = "your_password"

def query_neo4j_graph(query):
    
    with GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASSWORD)) as driver:
        result = driver.execute_query( query, result_transformer_ = neo4j.Result.graph )
        
        return result


query = st.text_area(
    "Enter Cypher Query",
    value="MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 4",
    height=100
)

st.subheader("Component with variable args")


height = st.slider("Graph Height", min_value=200, max_value=800, value=600, step=50)


if st.button("Visualize Graph"):
    try:
        with st.spinner("Querying Neo4j..."):
            result = query_neo4j_graph(query)
            result = neo4jgraph_to_sigma(result)
            
            if not result["nodes"]:
                st.warning("No nodes found in the query result.")
            else:
                st.success(f"Found {len(result['nodes'])} nodes and {len(result['relationships'])} relationships")
                
                st_sigmagraph(
                    graphData=result,
                    height=height,
                    key="neo4j_graph"
                )
    except Exception as e:
        st.error(f"Error: {str(e)}")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_sigmajs-0.1.2.tar.gz (146.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_sigmajs-0.1.2-py3-none-any.whl (146.1 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_sigmajs-0.1.2.tar.gz.

File metadata

  • Download URL: streamlit_sigmajs-0.1.2.tar.gz
  • Upload date:
  • Size: 146.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for streamlit_sigmajs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 61cddb22ec3b170403bbbc49042887c8e6deec3dcc0c0c4118b809847c3673e3
MD5 0b6286ed351c696ba825d4c07d1dd516
BLAKE2b-256 bed384db258087eebb77687fe6b61f8d479a6bd5425e0a00065bd34b88a9a0ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for streamlit_sigmajs-0.1.2.tar.gz:

Publisher: publish.yml on gitkeniwo/streamlit-sigmajs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file streamlit_sigmajs-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_sigmajs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24ec2befcd1a1220857e977a30081bc8990345d08366307363b2e42e80ce9594
MD5 ce63fb8d5b537269df987978514abc3f
BLAKE2b-256 25c85a28d15bfa07e7eeaa731001a3c0a5c25da024a0c54458edb987aa1bf614

See more details on using hashes here.

Provenance

The following attestation bundles were made for streamlit_sigmajs-0.1.2-py3-none-any.whl:

Publisher: publish.yml on gitkeniwo/streamlit-sigmajs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page