routelit


Nameroutelit JSON
Version 0.4.2 PyPI version JSON
download
home_pageNone
SummaryProject to build easy user interfaces, agnostic for http frameworks
upload_time2025-07-14 15:44:15
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseNone
keywords python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # routelit

[![Release](https://img.shields.io/github/v/release/routelit/routelit)](https://img.shields.io/github/v/release/routelit/routelit)
[![Build status](https://img.shields.io/github/actions/workflow/status/routelit/routelit/main.yml?branch=main)](https://github.com/routelit/routelit/actions/workflows/main.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/routelit/routelit/branch/main/graph/badge.svg)](https://codecov.io/gh/routelit/routelit)
[![Commit activity](https://img.shields.io/github/commit-activity/m/routelit/routelit)](https://img.shields.io/github/commit-activity/m/routelit/routelit)
[![License](https://img.shields.io/github/license/routelit/routelit)](https://img.shields.io/github/license/routelit/routelit)

![Routelit](https://wsrv.nl/?url=res.cloudinary.com/rolangom/image/upload/v1747976918/routelit/routelit_c2otsv.png&w=300&h=300)

**routelit** is a Python framework for building interactive web user interfaces that are framework-agnostic and easy to use. It allows you to create dynamic web applications with a simple, declarative API similar to Streamlit, but designed to work with any HTTP framework (Flask, FastAPI, Django, etc.).

## ✨ Features

- **Framework Agnostic**: Works with any Python web framework (Flask, FastAPI, Django, etc.)
- **Declarative UI**: Build interfaces using simple Python functions
- **Interactive Components**: Buttons, forms, inputs, selects, checkboxes, and more
- **State Management**: Built-in session state management
- **Reactive Updates**: Automatic UI updates based on user interactions
- **Fragment Support**: Partial page updates for better performance
- **Flexible Layouts**: Containers, columns, flex layouts, and expandable sections
- **Rich Content**: Support for markdown, images, and custom styling

## πŸš€ Installation

Install routelit using pip:

```bash
pip install routelit
```

## πŸ“– Quick Start

Here's a simple example of how to use routelit:

```python
from routelit import RouteLit, RouteLitBuilder

# Create a RouteLit instance
rl = RouteLit()

def my_app(builder: RouteLitBuilder):
    builder.title("Welcome to RouteLit!")

    name = builder.text_input("Enter your name:", value="World")

    if builder.button("Say Hello"):
        builder.text(f"Hello, {name}!")

    builder.markdown("This is a **markdown** text with *emphasis*.")

# Use with your preferred web framework
# Example with Flask:
from flask import Flask, request

app = Flask(__name__)

flask_adapter = ... # TODO: publish package for this

@app.route("/", methods=["GET", "POST"])
def index():

    # Return HTML response
    return flask_adapter.response(my_app)
```

## πŸ—οΈ Core Concepts

### Builder Pattern
RouteLit uses a builder pattern where you define your UI using a `RouteLitBuilder` instance:

```python
def my_view(builder: RouteLitBuilder):
    builder.header("My Application")

    with builder.container():
        builder.text("This is inside a container")

        col1, col2 = builder.columns(2)
        with col1:
            builder.text("Left column")
        with col2:
            builder.text("Right column")
```

### State Management
RouteLit automatically manages state between requests:

```python
def counter_app(builder: RouteLitBuilder):
    # Get current count from session state
    count = builder.session_state.get("count", 0)

    builder.text(f"Count: {count}")

    if builder.button("Increment"):
        builder.session_state["count"] = count + 1
        builder.rerun()  # Trigger a re-render
```

### Interactive Components
Build rich forms and interactive elements:

```python
def form_example(builder: RouteLitBuilder):
    with builder.form("my_form"):
        name = builder.text_input("Name")
        age = builder.text_input("Age", type="number")

        options = ["Option 1", "Option 2", "Option 3"]
        choice = builder.select("Choose an option", options)

        newsletter = builder.checkbox("Subscribe to newsletter")

        if builder.button("Submit", event_name="submit"):
            builder.text(f"Hello {name}, you are {age} years old!")
            if newsletter:
                builder.text("Thanks for subscribing!")
```

## πŸ”§ Framework Integration

RouteLit is designed to work with any Python web framework.
TODO: Add framework integration examples.

## πŸ“š Documentation

- **Github repository**: <https://github.com/routelit/routelit/>
- **Documentation**: <https://routelit.github.io/routelit/>

## 🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## πŸ™ Acknowledgments

RouteLit is inspired by [Streamlit](https://streamlit.io/) but designed to be framework-agnostic and more flexible for web development use cases.

---

Repository initiated with [fpgmaas/cookiecutter-uv](https://github.com/fpgmaas/cookiecutter-uv).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "routelit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "python",
    "author": null,
    "author_email": "Rolando G\u00f3mez Tabar <rolangom@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ee/e6/827c2ff76b38851e1f495ced588a9de6e97298e28767aa989b4b23e11344/routelit-0.4.2.tar.gz",
    "platform": null,
    "description": "# routelit\n\n[![Release](https://img.shields.io/github/v/release/routelit/routelit)](https://img.shields.io/github/v/release/routelit/routelit)\n[![Build status](https://img.shields.io/github/actions/workflow/status/routelit/routelit/main.yml?branch=main)](https://github.com/routelit/routelit/actions/workflows/main.yml?query=branch%3Amain)\n[![codecov](https://codecov.io/gh/routelit/routelit/branch/main/graph/badge.svg)](https://codecov.io/gh/routelit/routelit)\n[![Commit activity](https://img.shields.io/github/commit-activity/m/routelit/routelit)](https://img.shields.io/github/commit-activity/m/routelit/routelit)\n[![License](https://img.shields.io/github/license/routelit/routelit)](https://img.shields.io/github/license/routelit/routelit)\n\n![Routelit](https://wsrv.nl/?url=res.cloudinary.com/rolangom/image/upload/v1747976918/routelit/routelit_c2otsv.png&w=300&h=300)\n\n**routelit** is a Python framework for building interactive web user interfaces that are framework-agnostic and easy to use. It allows you to create dynamic web applications with a simple, declarative API similar to Streamlit, but designed to work with any HTTP framework (Flask, FastAPI, Django, etc.).\n\n## \u2728 Features\n\n- **Framework Agnostic**: Works with any Python web framework (Flask, FastAPI, Django, etc.)\n- **Declarative UI**: Build interfaces using simple Python functions\n- **Interactive Components**: Buttons, forms, inputs, selects, checkboxes, and more\n- **State Management**: Built-in session state management\n- **Reactive Updates**: Automatic UI updates based on user interactions\n- **Fragment Support**: Partial page updates for better performance\n- **Flexible Layouts**: Containers, columns, flex layouts, and expandable sections\n- **Rich Content**: Support for markdown, images, and custom styling\n\n## \ud83d\ude80 Installation\n\nInstall routelit using pip:\n\n```bash\npip install routelit\n```\n\n## \ud83d\udcd6 Quick Start\n\nHere's a simple example of how to use routelit:\n\n```python\nfrom routelit import RouteLit, RouteLitBuilder\n\n# Create a RouteLit instance\nrl = RouteLit()\n\ndef my_app(builder: RouteLitBuilder):\n    builder.title(\"Welcome to RouteLit!\")\n\n    name = builder.text_input(\"Enter your name:\", value=\"World\")\n\n    if builder.button(\"Say Hello\"):\n        builder.text(f\"Hello, {name}!\")\n\n    builder.markdown(\"This is a **markdown** text with *emphasis*.\")\n\n# Use with your preferred web framework\n# Example with Flask:\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\nflask_adapter = ... # TODO: publish package for this\n\n@app.route(\"/\", methods=[\"GET\", \"POST\"])\ndef index():\n\n    # Return HTML response\n    return flask_adapter.response(my_app)\n```\n\n## \ud83c\udfd7\ufe0f Core Concepts\n\n### Builder Pattern\nRouteLit uses a builder pattern where you define your UI using a `RouteLitBuilder` instance:\n\n```python\ndef my_view(builder: RouteLitBuilder):\n    builder.header(\"My Application\")\n\n    with builder.container():\n        builder.text(\"This is inside a container\")\n\n        col1, col2 = builder.columns(2)\n        with col1:\n            builder.text(\"Left column\")\n        with col2:\n            builder.text(\"Right column\")\n```\n\n### State Management\nRouteLit automatically manages state between requests:\n\n```python\ndef counter_app(builder: RouteLitBuilder):\n    # Get current count from session state\n    count = builder.session_state.get(\"count\", 0)\n\n    builder.text(f\"Count: {count}\")\n\n    if builder.button(\"Increment\"):\n        builder.session_state[\"count\"] = count + 1\n        builder.rerun()  # Trigger a re-render\n```\n\n### Interactive Components\nBuild rich forms and interactive elements:\n\n```python\ndef form_example(builder: RouteLitBuilder):\n    with builder.form(\"my_form\"):\n        name = builder.text_input(\"Name\")\n        age = builder.text_input(\"Age\", type=\"number\")\n\n        options = [\"Option 1\", \"Option 2\", \"Option 3\"]\n        choice = builder.select(\"Choose an option\", options)\n\n        newsletter = builder.checkbox(\"Subscribe to newsletter\")\n\n        if builder.button(\"Submit\", event_name=\"submit\"):\n            builder.text(f\"Hello {name}, you are {age} years old!\")\n            if newsletter:\n                builder.text(\"Thanks for subscribing!\")\n```\n\n## \ud83d\udd27 Framework Integration\n\nRouteLit is designed to work with any Python web framework.\nTODO: Add framework integration examples.\n\n## \ud83d\udcda Documentation\n\n- **Github repository**: <https://github.com/routelit/routelit/>\n- **Documentation**: <https://routelit.github.io/routelit/>\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\nRouteLit is inspired by [Streamlit](https://streamlit.io/) but designed to be framework-agnostic and more flexible for web development use cases.\n\n---\n\nRepository initiated with [fpgmaas/cookiecutter-uv](https://github.com/fpgmaas/cookiecutter-uv).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Project to build easy user interfaces, agnostic for http frameworks",
    "version": "0.4.2",
    "project_urls": {
        "Documentation": "https://routelit.github.io/routelit/",
        "Homepage": "https://routelit.github.io/routelit/",
        "Repository": "https://github.com/routelit/routelit"
    },
    "split_keywords": [
        "python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "51bfe1f2c8d424c5e8cc7b2f085c9dbec99f5560e64d88c35614d449f3d3ce9d",
                "md5": "0387caf2a653ac0eec7bd6d1009668a4",
                "sha256": "1b7ee7f3174d146b7a59e7699290d100f493b3427e3950e999fbaf2568f8a46b"
            },
            "downloads": -1,
            "filename": "routelit-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0387caf2a653ac0eec7bd6d1009668a4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 192845,
            "upload_time": "2025-07-14T15:44:13",
            "upload_time_iso_8601": "2025-07-14T15:44:13.770075Z",
            "url": "https://files.pythonhosted.org/packages/51/bf/e1f2c8d424c5e8cc7b2f085c9dbec99f5560e64d88c35614d449f3d3ce9d/routelit-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "eee6827c2ff76b38851e1f495ced588a9de6e97298e28767aa989b4b23e11344",
                "md5": "f96bbe271bb8ba20948de6fa65da9e77",
                "sha256": "f2d2a107dfc10929704fbee4ea4701dbb8d7fd432ee04855e41cddf41f168f18"
            },
            "downloads": -1,
            "filename": "routelit-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f96bbe271bb8ba20948de6fa65da9e77",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 12760508,
            "upload_time": "2025-07-14T15:44:15",
            "upload_time_iso_8601": "2025-07-14T15:44:15.514835Z",
            "url": "https://files.pythonhosted.org/packages/ee/e6/827c2ff76b38851e1f495ced588a9de6e97298e28767aa989b4b23e11344/routelit-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 15:44:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "routelit",
    "github_project": "routelit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "routelit"
}
        
Elapsed time: 0.57762s