Skip to content
Projets

À propos

Hyper Stream

Développement web et applicatif

Comment ces chiffres sont mesurés

What you can do

  • Linear scripts. Inputs return values; each interaction reruns the script top to bottom.
  • Components: markdown, text/number inputs, sliders, select boxes, multiselects, checkboxes, buttons, file uploads, screenshots of the page or one element, matplotlib plots, pandas tables. Full list.
  • Placeholders: p = hs.placeholder() reserves a spot to fill or overwrite later in the script.
  • Navigation: page = hs.nav(["Home", "About"]) and with hs.nav_bar: render a nav bar where you call them (or in a placeholder: with header.nav_bar:).

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

HStream

Turn a Python script into an interactive web app:

from hstream import hs

name = hs.text_input("What's your name?")
hs.markdown(f"Hello, **{name}**!")

Powered by Django + htmx: plain HTML over HTTP, no JavaScript build step, deploys anywhere Django can, with four runtime dependencies. Inspired by Streamlit.

Usage

pip install hstream
hstream init            # writes example.py
hstream run example.py  # http://127.0.0.1:8000

hstream demo

Features

  • Linear scripts. Inputs return values; each interaction reruns the script top to bottom.
  • Components: markdown, text/number inputs, sliders, select boxes, multiselects, checkboxes, buttons, file uploads, screenshots of the page or one element, matplotlib plots, pandas tables. Full list.
  • Placeholders: p = hs.placeholder() reserves a spot to fill or overwrite later in the script.
  • Navigation: page = hs.nav(["Home", "About"]) and with hs.nav_bar: render a nav bar where you call them (or in a placeholder: with header.nav_bar:).
  • Your own HTML: with hs.html("section"):, Pico CSS theming, and @component for custom components.
  • Component packages: other packages can add components to hs through an entry point. pip install "hstream[webawesome]" gives you all 78 Web Awesome components (from hstream import wa, then wa.input(...); hstream-webawesome); pip install "hstream[3d]" adds clickable 3D viewers (viewer3d.model_viewer, viewer3d.babylon; hstream-3d); write your own.
  • Agent friendly: GET / returns the rendered page, and each control's hx-post URL is in the HTML, so another program (or LLM agent) can drive the app with plain HTTP and a cookie jar.
  • Easy deployment: hstream deploy app.py writes a Dockerfile.
  • No server option: hstream build app.py --serve builds a static site that runs in the browser with Pyodide (details).

In the browser (Pyodide)

The same script also runs with no server: hstream build writes a static site where Pyodide runs your Python in the visitor's browser.

hstream build app.py          # writes dist/ (index.html, hstream_browser.js, hstream.zip, app.py)
hstream build app.py --serve  # build and serve on http://127.0.0.1:8000, live-reloading edits to app.py
hstream build app.py --static              # one self-contained app.html (-o name.html to rename)
hstream build app.py --static --clipboard  # copy that HTML to the clipboard instead

The --static file opens straight from disk (double-click it) and can be emailed or pasted anywhere that takes HTML. Only Pyodide itself comes from its CDN.

Host dist/ on any static host (GitHub Pages, S3, Netlify), or put it in an existing page with <iframe src="dist/index.html"></iframe>. hstream boots Pyodide itself, so you don't need a PyScript <script type="py"> tag (and that route isn't supported). Pyodide's own packages (numpy, pandas, matplotlib) load from your imports. Other PyPI packages come from a requirements.txt next to your script (used automatically), or from -r humanize / -r other.txt. See docs/features/browser.md.

See motivation.md for the rationale and architecture.md for how it works. More examples are in demo/ (hstream run demo/nav_bar.py browses them).

hstream demo

Technologies

Big thanks to Streamlit, htmx, Yattag, Pico CSS and Django.

Explorer des projets similaires

Chargement…