This release is a pre-release and may not be stable for production use.
Intro
Hypie, pronounced "high-pie", is a python library for building web frontends, built on top of _hyperscript, a scripting language for the web made by the htmx folks, and htpy, a library for generating HTML in python.
The goal of hypie is to be able to code powerful web frontends, server-side rendered or client-side rendered (or a mix of both), without having to leave python, or switch your favorite backend, using relatively little abstractions and no reactivity.
New README in the process, for now enjoy this counter example:
import htpy
import hypie as hp
class CounterWidget(hp.ServerComponent):
initial_count: int = 0
def template(self):
count_var = hp.var(":count")
return htpy.div[
htpy.button(
_=hp.hs(
hp.set_(count_var, to=self.initial_count),
hp.On("click")[
hp.set_(count_var, to=count_var + 1),
hp.set_(hp.me.textContent, to=f"Count is: {count_var}"),
],
)
)[f"Count is: {self.initial_count}"]
]
@hp.style(CounterWidget)
def counter_style():
return {
"button": {
"background-color": "#4A90D9",
"color": "#ffffff",
"border": "none",
"border-radius": "6px",
"padding": "10px 20px",
"font-size": "16px",
"font-weight": "600",
"cursor": "pointer",
"transition": "background-color 0.2s ease",
},
"button:hover": {"background-color": "#3A7BC8"},
}
hypie build -i ./app/CounterWidget.py -o ./app/static
(or your favourite backend)
import pathlib
import htpy
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import HTMLResponse
from .CounterWidget import CounterWidget
app = FastAPI()
app.mount(
"/static", StaticFiles(directory=pathlib.Path(__file__).parent.resolve() / "static")
)
@app.get("/")
def counter_example(count: int = 0):
return HTMLResponse(
htpy.html[
htpy.head[
htpy.link(),
htpy.link(rel="stylesheet", href="/static/_hypie_styles.css"),
htpy.script(src="https://cdn.jsdelivr.net/npm/hyperscript.org@0.9.93"),
htpy.title["Counter Example"],
],
htpy.body[CounterWidget(count)],
]
)
Metadata
Release files for hypie 0.1.1.dev5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hypie-0.1.1.dev5.tar.gz | 17.8 kB | Without provenance | Details for hypie-0.1.1.dev5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hypie-0.1.1.dev5-py3-none-any.whl | Python 3 | none | any | Details for hypie-0.1.1.dev5-py3-none-any.whl |
Total release size: 42.2 kB
Release files / hypie-0.1.1.dev5.tar.gz
| Download URL | hypie-0.1.1.dev5.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67cffbec00621dab8dfafe00573e57b5fd58f22f5e48ab13fd30ce9f3f4baba8
|
|
BLAKE2b-256 checksum How to use checksums |
0141e50b6afdc28373d6c13168427d76a07b258fbc245bd09a2c1838df6c24ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / hypie-0.1.1.dev5-py3-none-any.whl
| Download URL | hypie-0.1.1.dev5-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76421810c9d59f9b1abb2cc9337c9f098ef48d01ea4744739b12c507e2165fd8
|
|
BLAKE2b-256 checksum How to use checksums |
3a1282e8b7b8375392e37a0f7f8838e7208873aa71f3287210b0ec735929f646
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for hypie 0.1.1.dev5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.