https://github.com/routelit/routelit

https://github.com/routelit/routelit

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: routelit
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 1.3 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 25
Created about 1 year ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License

README.md

routelit

Release Build status codecov Commit activity License

Routelit

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 counterapp(builder: RouteLitBuilder): # Get current count from session state count = builder.sessionstate.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 formexample(builder: RouteLitBuilder): with builder.form("myform"): name = builder.textinput("Name") age = builder.textinput("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

🤝 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 file for details.

🙏 Acknowledgments

RouteLit is inspired by Streamlit but designed to be framework-agnostic and more flexible for web development use cases.


Repository initiated with fpgmaas/cookiecutter-uv.

Owner

  • Name: Routelit
  • Login: routelit
  • Kind: organization

GitHub Events

Total
  • Release event: 16
  • Delete event: 3
  • Push event: 33
  • Pull request event: 1
  • Create event: 28
Last Year
  • Release event: 16
  • Delete event: 3
  • Push event: 33
  • Pull request event: 1
  • Create event: 28

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 51
  • Total Committers: 1
  • Avg Commits per committer: 51.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 51
  • Committers: 1
  • Avg Commits per committer: 51.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Rolando Gómez Tabar r****m@g****m 51

Issues and Pull Requests

Last synced: 10 months ago

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 950 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 23
  • Total maintainers: 1
pypi.org: routelit

Project to build easy user interfaces, agnostic for http frameworks

  • Versions: 23
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 950 Last month
Rankings
Dependent packages count: 9.0%
Average: 30.0%
Dependent repos count: 50.9%
Maintainers (1)
Last synced: 10 months ago