Skip to main content

Simple component-based Web UI generator in Python (inspired by Vue JS and Flutter)

Project description

Pyue

Simple component-based Web UI generator in Python (inspired by Vue JS and Flutter)

Code example

from pyue import Pyue, BackendType, Page
from pyue.components import Stack, H1, H4, P, UL, LI
from flask import Flask

# Component data
features = [
    "🎯 Easy to use components",
    "⚡ Tailwind included",
    "🚀 Zero runtime overhead",
    "🔌 Pluggable structure",
]

# Component definition
def Feature(text):
    return LI(
        extra_classes=["p-3", "m-1", "border", "border-black", "rounded-xl"],
        content=[text],
    )

# Page definition
p = Page(
    title="Hello Pyue!",
    content=[
        Stack(
            spacing=4,
            align="items-center",
            content=[
                H1(content=["Welcome!"], extra_classes=["mt-3"]),
                P(content=["This page was built with Python 🐍"]),
                H4(extra_classes=["mt-3", "mb-3"], content=["Why Pyue?"]),
                UL(
                    extra_classes=["mt-1"],
                    content=[Feature(feature) for feature in features],
                ),
            ],
        )
    ],
)

# Creating Pyue app
app = Pyue(BackendType.Flask)

# Registering page
app.add_page(page=p, url="/")

f = Flask(__name__)
app.mount(f)

f.run()

Usage

Follow docs link: https://shkvaldev.github.io/pyue

Goals

  • Making MVP web apps creation easy in Python
  • Component-based approach for building web UI without garbage from js frameworks

Features

  • Generating frontend from Python code that is fully integrated with backend (Flask, FastAPI)
  • Very flexible (UI is processed in a separate router, simply includes onto your app)
  • Quite extendable - you can easily implement your own components

TODO

  • ResourceManager for better resources handling
  • HTMX or Alpine.js integration for interactivity
  • Custom HTML/CSS/JS embeddings (now available via content string)
  • FastAPIBackend for FastAPI support
  • MORE COMPONENTS TO THE GOD OF COMPONENTS
  • Experimental Python-Js translator

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

pyue-0.0.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

pyue-0.0.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file pyue-0.0.1.tar.gz.

File metadata

  • Download URL: pyue-0.0.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyue-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bd78e5e4a1ba3289cfd7c77f3fd2121f9ff8086a8889341c42846fba3aaed19e
MD5 ec4cd1544a296a6395a29dc58109a063
BLAKE2b-256 c58ec69f8cbf6ad0d122e19814955208dcba79788f6b6cf18f62a51e4a548394

See more details on using hashes here.

File details

Details for the file pyue-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyue-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyue-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d515e063bb94e5da91030a01b4c72525747e22644ae30457b91966b7531a11ed
MD5 349374f0a6fdc55b113408a632fd0c8a
BLAKE2b-256 ca4e4da5b17d89bc9893fbf80b236c48eb21914fa4361c4954542bdcce84d8d5

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