{"id":15142577,"url":"https://github.com/python-ninja-hebi/python-fasttea","last_synced_at":"2025-04-16T02:22:38.849Z","repository":{"id":257757138,"uuid":"859221830","full_name":"Python-Ninja-Hebi/python-fastTEA","owner":"Python-Ninja-Hebi","description":"fastTEA: Build Web Applications in Python with fastAPI and html","archived":false,"fork":false,"pushed_at":"2024-11-24T17:09:31.000Z","size":705,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T04:11:15.555Z","etag":null,"topics":["elm-architecture","fastapi","htmx","python","pythonframework","webframework"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Python-Ninja-Hebi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-18T09:45:27.000Z","updated_at":"2024-11-25T07:53:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"acbd6790-9464-47e4-a8de-816a4149e0fe","html_url":"https://github.com/Python-Ninja-Hebi/python-fastTEA","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"007a1c2c3978cc9e1437baef93ac8374ea5521b5"},"previous_names":["python-ninja-hebi/python-fasttea"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpython-fastTEA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpython-fastTEA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpython-fastTEA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpython-fastTEA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Python-Ninja-Hebi","download_url":"https://codeload.github.com/Python-Ninja-Hebi/python-fastTEA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249183837,"owners_count":21226269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm-architecture","fastapi","htmx","python","pythonframework","webframework"],"created_at":"2024-09-26T09:42:50.167Z","updated_at":"2025-04-16T02:22:38.826Z","avatar_url":"https://github.com/Python-Ninja-Hebi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastTEA: Build Elegant Web Applications in Python\n\nfastTEA is a powerful and intuitive Python framework for building web applications with ease. \nInspired by The Elm Architecture (TEA), fastTEA brings simplicity and predictability to your Python web development workflow.\n\n![](./images/fasttea_small.png)\n\n## Features\n\n- **Simple and Intuitive**: Build web apps using a clear, archtectural approach.\n- **Based on The Elm Architecture**: Benefit from a time-tested, scalable architecture.\n- **FastAPI Backend**: Leverage the speed and simplicity of FastAPI.\n- **HTMX Integration**: Create dynamic UIs without writing JavaScript.\n- **Flexible CSS Framework Support**: Choose from Pico, Bootstrap, or Tailwind CSS.\n- **Type Safety**: Utilizes Pydantic for robust data validation.\n\n## Installation\n\nInstall fastTEA using pip:\n\n```bash\npip install fasttea-web\n```\n\n## Quick Start\n\nLet's dive into a simple \"Hello, World!\" application to showcase the power and simplicity of fastTEA.\n\n```python\nfrom fasttea import FastTEA, Model, Msg, Cmd, Element, CSSFramework\nfrom fasttea.html import div, h1, input_, button, p\n\nclass AppModel(Model):\n    name: str = \"\"\n    greeting: str = \"\"\n\napp = FastTEA(AppModel(), css_framework=CSSFramework.PICO)\n\n@app.update\ndef update(msg: Msg, model: AppModel) -\u003e tuple[AppModel, Cmd | None]:\n    if msg.action == \"greet\":\n        model.name = msg.value\n        model.greeting = f\"Hello {msg.value}!\"\n    return model, None\n\n@app.view\ndef view(model: AppModel) -\u003e Element:\n    return div({},\n        h1({}, \"FastTEA Hello Example\"),\n         input_({\n                \"id\": \"input\",\n                \"type\": \"text\",\n                \"value\": model.name,\n                \"name\": \"name\",\n                \"placeholder\": \"Enter your name\"\n        }, \"\"),\n        button({\n                \"onClick\": \"greet\",\n                \"getValue\": \"input\"\n        },\"Greet\"),\n        p ({}, model.greeting)\n    )\n\nif __name__ == \"__main__\":\n    app.run()\n```\n\n![](./images/img1.png)\n\n## Core Principles Explained\n\n1. **Model**: The `AppModel` class defines the application's state. In this example, it stores the user's name and the greeting message.\n\n2. **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.\n\n3. **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.\n\n4. **HTMX Integration**: fastTEA leverages HTMX for dynamic updates without writing JavaScript. The button in our example uses HTMX attributes to trigger a server request.\n\n5. **CSS Framework**: fastTEA supports various CSS frameworks. In this example, we're using Pico CSS for a clean, minimal design.\n\n![](./images/tea.png)\n\n## Get Started Today!\n\nfastTEA 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.\n\nStart building your next web application with fastTEA and experience the joy of functional web development in Python!\n\n## More\n\n**FastTEA: A Python Developer's Quest for Elegant Web Apps - Part 1**\nhttps://medium.com/@hebi_73682/fasttea-a-python-developers-quest-for-elegant-web-apps-part-1-ef86461cbfc5\n\n**FastTEA: A Python Developer's Quest for Elegant Web Apps - Part 2**\nhttps://medium.com/@hebi_73682/fasttea-a-python-developers-quest-for-elegant-web-apps-part-2-a25fc77e09c3\n\n**FastTEA: Behind the Scenes - Diving into JavaScript Integration - Part 3**\nhttps://medium.com/@hebi_73682/fasttea-behind-the-scenes-diving-into-javascript-integration-part-3-90f27d48b424\n\n### Coming Soon!\n\nWe're constantly working to improve fastTEA and add new features. Here's a sneak peek at what's coming:\n\n1. **More Examples**: We're developing a variety of examples to showcase fastTEA's capabilities in different scenarios.\n\n2. **Simple Chatbot**: A demonstration of how to implement a basic chatbot using fastTEA, showing off its real-time update capabilities.\n\n3. **Form Processing**: Enhanced support for handling and processing form submissions, making it even easier to create data-entry applications.\n\n4. **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.\n\n5. **Server-Triggered Commands**: Allowing the server to trigger these client-side commands, enabling more complex interactions between the server and client.\n\n6. **UiBubbles and CmdBubbles**: More structure.\n\nThese upcoming features will make fastTEA even more powerful and flexible, opening up new possibilities for your web applications. Stay tuned for updates!\n\nHappy coding with fastTEA! 🍵✨","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-ninja-hebi%2Fpython-fasttea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-ninja-hebi%2Fpython-fasttea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-ninja-hebi%2Fpython-fasttea/lists"}