Skip to content

Build a Streamlit app

Current implementation status

The app_surface + streamlit discovery path, hosted px.client() injection, authenticated gateway route, and Project-scoped isolated App Surface runtime on this page are contract-only and not yet implemented. The public SDK currently exposes explicit px.Client(workspace=..., project=...). Component package installation and executor execution exist, but only as contract/runtime audit paths, not as supported production third-party admission. The production Flow reader projects Component targets as read-only unsupported nodes. Third-party Component data-path access uses exact ProjectScope isolation, but activation, including install admission and execution, is blocked until authenticated-principal authorization, execution-trust closure, and the production gates are implemented. The surface metadata and hosted lifecycle below are the target contract.

Use Streamlit for an input-oriented calculator or task-specific dashboard. The PipelineXLab SDK owns calculation logic, typed ports, units, authorization, execution, and result provenance. Streamlit owns widgets and layout.

The target SDK adapter system treats Streamlit as one format under the app_surface category. The V2 Canvas uses only host-owned component.declarative@2; rich editors belong to component-rich-surface-declaration@1, the RFC-016 successor.

A future Streamlit Extension may also contribute Canvas Components such as parameter forms, data grids, or metric boards. Discovering Component contributions and standalone Streamlit surfaces by their separate category and target remains contract-only.

The Streamlit app reuses a saved Flow and immutable Result instead of recreating calculation logic.

Import the saved Flow into the app. PXFLOW Studio, supported Functions and product-built first-party Nodes, MCP, and Streamlit use the same flowKey, nodeKey, and portKey.

Choose the right surface

GoalSurface
Author a document with values, tables, and mapped Flow resultspx.Report or Report Workbench
A focused calculator or operational dashboardStreamlit app
Visual editing of calculation wiringPXFLOW Studio
A task-specific rich editorOwned by component-rich-surface-declaration@1 (RFC-016)

Report Workbench and Streamlit consume the same saved Flow's public inputs and named results. px.Report or Report Workbench stores mappings in .pxreport; Streamlit passes widget values to exact public input keys through the SDK client. Only supported Functions and product-built first-party Nodes participate inside the current Flow Run; third-party Component Validate/Run remains blocked by the closure above.

Run the same PXFLOW

python
import streamlit as st

from pipelinexlab import px
from structural_checks.flows.bearing_review import flow as bearing_review


client = px.Client(workspace="engineering", project="bridge_project")

st.title("Bearing check")
load = st.number_input("Factored load (kN)", min_value=0.0, value=1850.0)
area = st.number_input("Effective area (m²)", min_value=0.001, value=0.72)
resistance = st.number_input(
    "Design resistance (kN/m²)",
    min_value=0.001,
    value=3500.0,
)

if st.button("Run", type="primary"):
    run = client.run(
        bearing_review,
        load=load,
        area=area,
        resistance=resistance,
    )
    snapshot = run.wait()
    st.metric("Utilization", f"{snapshot.results.utilization:.3f}")

Create px.Client(workspace=..., project=...) explicitly with the current SDK. A hosted px.client() convenience that receives the authenticated session and current Project from the host is planned with App Surface hosting and cannot be called today. Keeping credentials, routing, and internal runtime details in host or Local configuration belongs to that same target boundary.

The keywords passed to client.run(...) are the exact input portKey values declared by the target Flow. Map widgets to those keys explicitly. The returned handle represents a regular PXFLOW Run, and wait() returns its immutable typed ResultSnapshot.

Planned package surface declaration

The target contract keeps surface source in the same package release and .pxflow focused on Flow structure.

toml
[tool.pipelinexlab.surfaces.bearing_check]
format = "streamlit"
format-contract = 1
title = "Bearing check"
description = "Interactive bearing pressure check."
entry = { kind = "python_module", module = "structural_checks.apps.bearing" }
targets = [{ kind = "flow", key = "bearing_review" }]
host-capabilities = []
  • bearing_check is the stable surfaceKey.
  • The surfaces table implies adapterCategory="app_surface"; format selects the supported surface format.
  • format-contract versions the format configuration and lifecycle contract. The dependency lock pins the exact Streamlit library version separately.
  • entry.module is an importable package module; the host resolves its installed path.
  • targets is a typed allowlist; Project ACL and execution policy authorize each Run.
  • Function ports and unit maps remain in the Function and Flow contracts.
  • The surface source, dependency lock, and descriptor digest are pinned by the package release. The current Component installer refuses signed input without a trust authority and records an explicitly accepted unsigned Component only as absent / not-checked; only marketplace admission that verifies the publisher signature and revocation state may call a release verified.

During development, run the module with the standard Streamlit development server in an authenticated Local environment.

bash
streamlit run src/structural_checks/apps/bearing.py

The target Local and SaaS App Surface host starts the same module in a Project-scoped isolated runtime and exposes only an authenticated gateway route. That launcher and Project-scoped isolation are not implemented yet.

Boundaries

  • A Streamlit surface invokes the exported px.Flow through client.run(...); Canvas Nodes remain explicit flow.node(...) placements.
  • UI state may keep widget values and runRef/snapshotRef; Runtime owns the execution ledger and Result truth.
  • Function and Flow contracts own types, units, constraints, and connection metadata; UI labels and layout present them.
  • px.Report or Report Workbench maps authored values and result positions to the Flow's public ports in .pxreport rather than reading Streamlit session state.
  • A Component receives values through ordinary typed connections inside the Flow.
  • AI reads FunctionDescriptor and Flow objects as its contract source.

See Report Workbench for document authoring, Components and Component packages for installed capabilities, and Use the SDK and PXFLOW Studio for the public Flow syntax.