Skip to main content

StreamBricks

PyPI License Package status Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this month Package status PyUp

Read the documentation!

Reusable widgets and helpers for Streamlit apps. The core feature is automatic form generation: pass a Pydantic model (or a dataclass or another fieldz-supported class) and get an editable or read-only form back, including nested models, unions, enums, literals, lists and sets.

Installation

pip install streambricks
# optional extras
pip install "streambricks[auth]"  # Google / Microsoft login via st.login
pip install "streambricks[llm]"   # LLM model selector (tokonomics)

Quickstart

from typing import Literal

from pydantic import BaseModel, Field
import streamlit as st

import streambricks as sb


class Settings(BaseModel):
    name: str = Field(default="World", description="Who to greet")
    retries: int = Field(default=3, ge=0, le=10)
    mode: Literal["fast", "safe"] = "fast"
    tags: list[str] = Field(default_factory=list)


def main():
    settings = sb.model_edit(Settings)  # returns an updated Settings instance
    st.write(f"Hello, {settings.name}!")
    sb.model_display(Settings, settings)  # read-only view


sb.run(main)

Run it with streamlit run app.py, or with python app.py: sb.run starts Streamlit for you when called outside of it.

Features

Model forms

  • model_edit(model_or_instance, *, readonly=False, exclude=None): render a form for a class (defaults are used) or an instance, return the edited instance.
  • model_display(model_class, instance): read-only rendering.
  • Field descriptions (Field(description=...), or attribute docstrings with ConfigDict(use_attribute_docstrings=True)) become help texts; fields with json_schema_extra={"category": ...} are grouped into tabs.

Typed session state

# app_state.py
import streambricks as sb


class AppState(sb.State):
    counter: int = 0
# app.py
import streamlit as st

from app_state import AppState

state = AppState.get()  # stored in st.session_state, survives reruns
if st.button("Increment"):
    state.counter += 1
st.write(state.counter)
state.form()  # edit the state with a generated form

State subclasses also provide set_state(value=...) and reset(). Define them in a separate module: classes defined in the main script are recreated on every rerun, which resets the stored state.

Function kwargs as widgets

import streamlit as st
import streambricks as sb


def plot(title: str, points: int = 10, smooth: bool = False) -> str:
    return f"{title}: {points} points, smooth={smooth}"


configured = sb.bind_kwargs_as_widget(
    plot, kwargs_to_bind=["points", "smooth"], title="Plot options"
)
st.write(configured("My plot"))

Other widgets

import streambricks as sb

items = [
    sb.MultiSelectItem("Apple", "apple", description="Red fruit"),
    sb.MultiSelectItem("Banana", "banana"),
]
selected = sb.multiselect("Fruits", items, state_key="fruits")  # list[MultiSelectItem]

image = sb.image_capture()  # file upload or camera, returns UploadedFile | None

model = sb.model_selector(providers=["openai"])  # needs the "llm" extra

sb.set_sidebar_width(400)
sb.hide_sidebar()

Authentication

Thin, typed wrappers around Streamlit's built-in authentication (st.login, configured in .streamlit/secrets.toml; requires the auth extra):

import streamlit as st
import streambricks as sb

user = sb.google_login("Login with Google")  # GoogleUser | None
# user = sb.microsoft_login()                # MicrosoftUser | None
if user:
    sb.profile_widget(user, size="medium")


@sb.requires_login(unauthorized_handler="Please log in first")
def dashboard():
    st.write("Protected content")


dashboard()

get_current_user() returns the logged-in user (or None) without rendering anything.

Metadata

Release files for streambricks 1.1.0

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

Source distribution (sdist)

Source distribution for streambricks 1.1.0
File Size Uploaded Provenance Actions
streambricks-1.1.0.tar.gz 31.9 kB With provenance Details for streambricks-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streambricks 1.1.0
File Interpreter ABI Platform Actions
streambricks-1.1.0-py3-none-any.whl Python 3 none any Details for streambricks-1.1.0-py3-none-any.whl

Total release size: 68.1 kB

Release files / streambricks-1.1.0.tar.gz

Download URL streambricks-1.1.0.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ec97e3424312626120d02024b1a94616da44796a30fdd3d91e02916d7c5f5b56
BLAKE2b-256 checksum
How to use checksums
71277b483c5f5d87bc812336f745972530251a07312843c1d93b71577971b9c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / streambricks-1.1.0-py3-none-any.whl

Download URL streambricks-1.1.0-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d630ec27e29337790f391617de9a283cd8e8793fca2dc775d80019f145ec9543
BLAKE2b-256 checksum
How to use checksums
b98a86cd2971d11ccb593629058e8606a4ec55f3fd121cda5f1f2b6372351fee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for streambricks 1.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for streambricks-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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.

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