Skip to main content

HTML builder with server routing for Python

Project description

Sistine

sistine-fibel

React-like UI framework for Python, powered by Streamlit. Build incredibly flexible, custom-designed UIs with HTML/Tailwind, while leveraging Streamlit's native widgets and data caching.

Why Sistine?

Streamlit is fantastic for data apps, but often developers complain:

  • Hard to customize CSS/Layouts or use Tailwind.
  • Complex nested UIs are difficult to build.
  • UI elements lack flexibility.

Sistine fixes this! You can write full custom HTML, inject Tailwind CSS, and separate your concerns using a React-like component approach, all while letting Streamlit handle the backend server, caching, and state management.

Installation

pip install sistine

Features

  • React-like Syntax (Chaining): Write clean components el.div(cls="...")(children).
  • Tailwind CSS Built-in: One command app.use_tailwind() to enable utility classes.
  • Native Streamlit Interoperability: Mix st.write() or Streamlit buttons alongside Sistine components!
  • Auto-caching: Use @query to fetch API/Database, and it automatically hooks into st.cache_data.
  • MVC Modularity: Fully supports splitting code into Models, Views, and Controllers.

Quick Start

from sistine import streamlit as st, Sistine, el

app = Sistine(title="My App")
app.use_tailwind()

# 1. Modular React-like Component using Chaining Syntax
def Card(title: str, description: str):
    return el.div(cls="bg-white p-6 rounded-xl shadow-md")(
        el.h2(cls="text-2xl font-bold text-gray-800")(title),
        el.p(cls="text-gray-600 mt-2")(description)
    )

# 2. Define Routes Easily
@app.sistine("/")
def home():
    # You can still use Streamlit native features!
    st.toast("Welcome to Sistine!")
    
    return str(
        el.div(cls="min-h-screen bg-gray-50 p-10 flex flex-col items-center justify-center")(
            el.h1(cls="text-4xl font-extrabold text-blue-600 mb-8")("Hello Sistine!"),
            Card("Awesome Framework", "Return HTML/Tailwind seamlessly inside Streamlit.")
        )
    )

if __name__ == "__main__":
    app.run(port=8080)

Run your app normally:

python app.py

The Power of @query

Say goodbye to slow apps! Use @query for any API calls or expensive database queries. Sistine automatically caches it using st.cache_data in the background.

from sistine import query
import requests

@query
def fetch_users():
    # Only hits the network once, subsequent calls are instantly cached!
    res = requests.get("https://jsonplaceholder.typicode.com/users")
    return res.json()

Streamlit State & Widgets

Sistine runs inside Streamlit. You can use st.session_state to make your Sistine UI reactive!

from sistine import streamlit as st, Sistine, el

app = Sistine()

if "count" not in st.session_state:
    st.session_state.count = 0

@app.sistine("/")
def counter():
    # Native Streamlit Widget
    if st.button("Add +1"):
        st.session_state.count += 1
        
    # Sistine UI that reacts to Streamlit state!
    return str(
        el.h1(cls="text-3xl")(f"Count is: {st.session_state.count}")
    )

Examples

Check out the examples/ directory for complete applications:

  • tailwind_app.py - Basic Tailwind setup.
  • routing_app.py - Multi-page routing with URL parameters (/user/{id}).
  • dashboard_app.py - Complex UI layout (sidebar, grid cards).
  • pokeapi_app.py - Working API integration showcasing @query.
  • state_app.py - Interactivity using Streamlit's session_state.
  • mvc_app/ - Example of organizing a massive Sistine app using MVC pattern.

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

sistine-0.2.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

sistine-0.2.3-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file sistine-0.2.3.tar.gz.

File metadata

  • Download URL: sistine-0.2.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sistine-0.2.3.tar.gz
Algorithm Hash digest
SHA256 28980dab145329373547adf7b1b158d715833d286e8fe4c20945f7510f10438a
MD5 dfc83cceb4440c078e1f59a90d16856c
BLAKE2b-256 8b127df5b699295992cdf09c980b351af53b89a5ef0b73eddefb1e4446c5cef0

See more details on using hashes here.

File details

Details for the file sistine-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: sistine-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sistine-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4049927ebd122d80cee5dd604e3a220c6612a87ed9132ef2ef9f43c626e47d8d
MD5 912939b7eb3187b5d6abff879601d214
BLAKE2b-256 cc65f080c7fdd9e621f0593e87b6d3f57d6fa58d5c20fda71b50e0d920ba4a42

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