Skip to main content

Add your description here

Project description

st-sigma

Streamlit component that allows you visualize interactive graphs using sigma.js.

Installation instructions

Activate your uv venv, then run:

pip install -e .

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

npm install
npm run build

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

npm install
npm run start

To start your streamlit app, in the st_sigma directory, run:

uv pip install streamlit neo4j
streamlit run example_app.py

Usage instructions

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)}")

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

streamlit_sigmajs-0.1.1.tar.gz (145.4 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.1-py3-none-any.whl (145.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: streamlit_sigmajs-0.1.1.tar.gz
  • Upload date:
  • Size: 145.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for streamlit_sigmajs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b4edf31c65a2b60f9dfa9e14d843f0be4f02dd89ae1c2911a245b6436d7f3e91
MD5 e670788c8f38cbe37277975324335ea8
BLAKE2b-256 9eb04507aa8d46355b6f62878a0042b8a0e37208417c08862ca5753772da75c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streamlit_sigmajs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1bea6b4b24e6b1870f153a8ca68802f3594e5bb84adde82fba8bb8da100df5b
MD5 4136b3a02b4bc1fe9cbfb59de23b4bd5
BLAKE2b-256 d0240065edb4fea18fdf2fe30e498e7a5d255d2f48c215cb782c27a76bef5e00

See more details on using hashes here.

Supported by

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