Skip to main content

fastTEA: Build Elegant Web Applications in Python

fastTEA is a powerful and intuitive Python framework for building web applications with ease. Inspired by The Elm Architecture (TEA), fastTEA brings simplicity and predictability to your Python web development workflow.

Features

  • Simple and Intuitive: Build web apps using a clear, archtectural approach.
  • Based on The Elm Architecture: Benefit from a time-tested, scalable architecture.
  • FastAPI Backend: Leverage the speed and simplicity of FastAPI.
  • HTMX Integration: Create dynamic UIs without writing JavaScript.
  • Flexible CSS Framework Support: Choose from Pico, Bootstrap, or Tailwind CSS.
  • Type Safety: Utilizes Pydantic for robust data validation.

Installation

Install fastTEA using pip:

pip install fasttea-web

Quick Start

Let's dive into a simple "Hello, World!" application to showcase the power and simplicity of fastTEA.

from fasttea import FastTEA, Model, Msg, Cmd, Element, CSSFramework
from fasttea.html import div, h1, input_, button, p

class AppModel(Model):
    name: str = ""
    greeting: str = ""

app = FastTEA(AppModel(), css_framework=CSSFramework.PICO)

@app.update
def update(msg: Msg, model: AppModel) -> tuple[AppModel, Cmd | None]:
    if msg.action == "update_name":
        model.name = msg.payload["name"]
    elif msg.action == "greet":
        model.greeting = f"Hello {model.name}!"
    return model, None

@app.view
def view(model: AppModel) -> Element:
    return div({},
        h1({}, "FastTEA Hello Example"),
         input_({
                "id": "input",
                "type": "text",
                "value": model.name,
                "name": "name",
                "placeholder": "Enter your name"
        }, ""),
        button({
                "onClick": "greet",
                "getValue": "input"
        },"Greet"),
        p ({}, model.greeting)
    )

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

Core Principles Explained

  1. Model: The AppModel class defines the application's state. In this example, it stores the user's name and the greeting message.

  2. Update: The update function handles state changes based on messages. It takes the current model and a message, then returns the updated model and any commands to be executed.

  3. View: The view function renders the UI based on the current model state. It returns a tree of Element objects that fastTEA converts to HTML.

  4. HTMX Integration: fastTEA leverages HTMX for dynamic updates without writing JavaScript. The button in our example uses HTMX attributes to trigger a server request.

  5. CSS Framework: fastTEA supports various CSS frameworks. In this example, we're using Pico CSS for a clean, minimal design.

Get Started Today!

fastTEA combines the best of Python, The Elm Architecture, and modern web technologies to provide a delightful development experience. Whether you're building a small prototype or a large-scale web application, fastTEA has you covered.

Start building your next web application with fastTEA and experience the joy of functional web development in Python!

Coming Soon!

We're constantly working to improve fastTEA and add new features. Here's a sneak peek at what's coming:

  1. More Examples: We're developing a variety of examples to showcase fastTEA's capabilities in different scenarios.

  2. Simple Chatbot: A demonstration of how to implement a basic chatbot using fastTEA, showing off its real-time update capabilities.

  3. Form Processing: Enhanced support for handling and processing form submissions, making it even easier to create data-entry applications.

  4. Client-Side Commands: Introducing a way to define commands that can be executed locally in the browser, improving responsiveness and reducing server load for certain operations.

  5. Server-Triggered Commands: Allowing the server to trigger these client-side commands, enabling more complex interactions between the server and client.

  6. UiBubbles and CmdBubbles: More structure.

These upcoming features will make fastTEA even more powerful and flexible, opening up new possibilities for your web applications. Stay tuned for updates!

For more examples, documentation, and community support, visit our GitHub repository.

Happy coding with fastTEA! 🍵✨

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fasttea_web-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

fasttea_web-0.1.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasttea_web-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for fasttea_web-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8c8599acdd946cef2528a289efd48f33e7fc78505e413a8ca780f689d7fe6022
MD5 237abec49772514cc979cc0a47b13125
BLAKE2b-256 774d2b9a7afcf63562a7abe364e89da16415a474183db07084e0eea3d3539ed4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasttea_web-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for fasttea_web-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2af1d62e3b7198478777c7948b4a1cbb2ae9ee5645626e9679df9313a54216f3
MD5 100fe70c1d9c9215c6da178c079dcd75
BLAKE2b-256 a24dc41395ba44485d3c52ca1d9b3ae69d8cc8ea45326ea282d5156cda8fea17

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.0

2 files

This release

0.1.1 This release

2 files

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