Coder Social home page Coder Social logo

hstream's Introduction

HStream

Easiest interactive python web app using htmx and semantic html

Demo: https://hstream-demo.fly.dev

Usage

pip install hstream

# main.py

from hstream import hs

visitor_name = hs.text_input("What's your name?", default_value = "friend")

hs.markdown(f"Welcome {visitor_name}")

python -m hstream main.py

hstream demo

Motivation

Love Streamlit but:

  • find it hard to deploy
  • impossible to customise beyond PoC phase
  • overly complicated

H-(html)-Stream stream is built with semantic html, FastApi and htmx to provide a fast and simple framework for rapid web app development that follows traditional frontend/server architecture (or at least follow it closer than Streamlit).

Features

  • only reloads changed components after the visitor provides input
  • live server reload on file change (through univorn)
  • semantic html and basic html manipulation from within script
  • basic components - see below
  • swap stylesheet
  • auto ssl certs for easy deployment
  • complex html manipulation from within script (setting attributes)
  • plotly plot supprt

Bugs

  • key handling is a little inconsistent and it's not clear to the user when they need to use keys - meaning if you run into reloading / rending issues provide all you compoennts with unique key parameter
  • state management is a little wonky when scripts branch off a change in a component to create a new component
  • checkbox is a little wonky and doesn't retain state across refreshes (which happens when a component is added)

Components

hs.text_input

hs.checkbox

hs.slider: numeric slider input

hs.plot: output matplotlib figures to the user

hs.image: display an image

hs.html: allows more complex formatting, for example

hs.stylesheet_href = https://unpkg.com/@vladocar/[email protected]/css/basic.css to use a different classless css framework

with hs.html('form'):
    hs.text_input('Name'):
    hs.checkbox('Would you like to be my friend?')

Technologies

Big thanks to the following libraries in particular

  • Streamlit
  • htmx
  • Yattag
  • MVP.css
  • FastAPI
  • uvicorn

hstream's People

Contributors

conradbez avatar blackary avatar collingreen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.