Skip to main content

tiferet-streamlit

A Streamlit extension for the Tiferet Framework — build multi-page Streamlit applications with Domain-Driven Design.

Installation

pip install tiferet-streamlit

Requires tiferet>=2.0.0b3 and streamlit>=1.30.0.

Quick Start

import streamlit as st
from tiferet_streamlit import StreamlitApp, ViewContext

class HomeView(ViewContext):
    def init_state(self):
        self.session.set('count', 0)

    def render(self):
        count = self.session.get('count')
        st.title('Home')
        st.write(f'Count: {count}')
        if st.button('Increment'):
            self.session.set('count', count + 1)
            st.rerun()

StreamlitApp('my_interface', pages={'/': HomeView})

Core Concepts

ViewContext

The code-behind for a Streamlit page. Manages state via SessionCacheContext, dispatches Tiferet features via AppInterfaceContext, and defines UI through render().

  • init_state() — Called once on first construction. Override to set initial state.
  • dispatch(feature_id, headers=None, **data) — Execute a Tiferet feature.
  • render() — Override to define Streamlit widgets.
  • __call__() — Makes the view callable for st.Page composition.

ViewComponent

A lightweight, prop-driven sub-component with parent ViewContext access.

from tiferet_streamlit import ViewComponent

class Counter(ViewComponent):
    def render(self, label='Count', start=0):
        count = self.ctx.session.get('count') or start
        st.write(f'{label}: {count}')

SessionCacheContext

Cache backed by st.session_state with namespace isolation for multi-page apps.

from tiferet_streamlit import SessionCacheContext

cache = SessionCacheContext(namespace='my_view')
cache.set('key', 'value')
cache.get('key')  # 'value'

Multi-Page Applications

Use StreamlitApp (or build_streamlit_app) to register multiple views with routes:

StreamlitApp('my_interface', pages={
    '/': HomeView,
    '/about': AboutView,
    '/settings': SettingsView,
})

Config-Driven Pages

Define pages as Page domain objects for YAML-driven configuration:

from tiferet_streamlit import Page, StreamlitApp

pages = [
    Page(route='/', title='Home', icon='🏠',
         view_module_path='app.views.home', view_class_name='HomeView'),
    Page(route='/about', title='About', icon='ℹ️',
         view_module_path='app.views.about', view_class_name='AboutView'),
]

StreamlitApp('my_interface', page_configs=pages)

Feature Dispatch

Views dispatch Tiferet features for backend logic:

class CalcView(ViewContext):
    def render(self):
        a = st.number_input('a')
        b = st.number_input('b')
        if st.button('Add'):
            result = self.dispatch('calc.add', a=a, b=b)
            st.write(f'Result: {result}')

API Reference

Export Module Description
build_streamlit_app blueprints.streamlit Primary entry point blueprint function
StreamlitApp blueprints Alias for build_streamlit_app
Page domain.view Page configuration domain object
ViewService interfaces.view Abstract service for page management
SessionCacheContext contexts.session Session-state-backed cache with namespacing
ViewContext contexts.view Page code-behind with lifecycle management
ViewComponent contexts.view Prop-driven sub-component
PageContext contexts.page Multi-page navigation manager

Development

# Clone and set up
git clone https://github.com/greatstrength/tiferet-streamlit.git
cd tiferet-streamlit
python -m venv .venv
source .venv/bin/activate
pip install -e .[test]

# Run tests
pytest --verbose

License

MIT

Metadata

Release files for tiferet-streamlit 1.0.1

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

Source distribution (sdist)

Source distribution for tiferet-streamlit 1.0.1
File Size Uploaded
tiferet_streamlit-1.0.1.tar.gz 39.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tiferet-streamlit 1.0.1
File Interpreter ABI Platform
tiferet_streamlit-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.1 kB

Release files / tiferet_streamlit-1.0.1.tar.gz

Download URL tiferet_streamlit-1.0.1.tar.gz
Size 39.3 kB
Tags Source
SHA-256 checksum
How to use checksums
27d4dfeb4371c8eea3811d49f43f6ab7e92eaa851a7bd8ab801b3375e3847402
BLAKE2b-256 checksum
How to use checksums
7989a027198d643304c6d7084ec20793e343af902c9b4c277458815e98918b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 27, 2026.

Transparency log

Release files / tiferet_streamlit-1.0.1-py3-none-any.whl

Download URL tiferet_streamlit-1.0.1-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c411de9acca789f6a667bc5acf454629d1a8983647e0dee3a5776517e167c22
BLAKE2b-256 checksum
How to use checksums
2e8118e398599d5420a90b2905f87746a8a810b1ff014cf529cddb2a33a63a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 27, 2026.

Transparency log
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