A modern, state-of-the-art Python GUI framework
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
htag2
Here is a full rewrite of htag, using only antigravity and prompts/intentions.
It feels very good. Currently, it's not a replacement, it's just a POC.
It's completely crazy, but it works :
- For building desktop apps (ChromeApp on linux/windows)
- For building web apps (WebApp as an asgi app (for starlette/fastapi/...))
- For building SPA HTML Page (with the PyScript runner)
- For building android apps (it works, but need to improve)
Get Started
Check the Official Documentation for more information.
Install
uv add htag2
Or using pip:
pip install htag2
Alternatively, you can run from source:
git clone https://github.com/manatlan/htag2.git
cd htag2
uv run examples/main3.py
Skill
With gemini-cli, claude-code, mistral-vibe (or others), you can use this SKILL.md to create a htag2 application.
Antigravity resumes :
htag2 is a Python library for building web applications using HTML, CSS, and JavaScript.
Key Resiliency Features Added
- Zero-Config Hot-Reload: Passing
reload=Trueto any runner (e.g.ChromeApp(App).run(reload=True)) automatically watches for Python file changes, seamlessly restarts the backend, and gracefully refreshes the frontend without losing your browser window session. - F5/Reload Robustness: Refreshing the browser no longer kills the Python backend; the session reconstructs cleanly.
- HTTP Fallback (SSE + POST): If WebSockets are blocked (e.g. strict proxies) or fail to connect, the client seamlessly falls back to HTTP POST for events and Server-Sent Events (SSE) for receiving UI updates.
- Production Debug Mode: Easily disable error reporting in the client by setting
debug=Falseon the runner (e.g.WebApp(App, debug=False).app), preventing internal stacktraces from leaking to users. - Parano Mode (Payload Obfuscation): By initializing
WebApp(App, parano=True), all data exchanged between the frontend and backend is automatically obfuscated using a dynamic XOR cipher and Base64 wrapping, making network traffic unreadable to MITM proxies.
New API Features
.root,.parent, and.childsproperties: EveryGTagexposes its position in the component tree..rootreferences the mainTaginstance,.parentreferences the direct parent component, and.childsis a list of its children. This allows components to easily navigate the DOM tree and trigger app-level actions.- Declarative UI with Context Managers (
with): You can now build component trees visually usingwithblocks (e.g.,with Tag.div(): Tag.h1("Hello")), removing the need forself <= ...boilerplate. - Dual Attribute Access (Dictionary Style): In addition to
self._class = "foo", you can now useself["class"] = "foo". This is the preferred way to handle attributes with dashes (e.g.,self["data-id"] = 123). - Automatic Attribute Normalization: HTML attributes are normalized to use dashes internally. Setting
self._data_id = "123"is strictly equivalent to settingself["data-id"] = "123". - Reactive State Management (
State): IntroducingState(value)for automatic UI reactivity.Stateacts as a transparent Proxy: you can use comparison/arithmetic operators directly (if self.count > 0: ...), mutate nested structures (includinglists,dicts,sets, andtuples), and delegate attribute assignments seamlessly. - Iterative & Attribute Reactivity: Iterating over a
Statenow yields proxies, meaning mutations likefor item in self.list: item.active = Truetrigger re-renders. Attribute assignments (e.g.self.user.name = "Bob") are automatically delegated to the underlying object and notified. - Reactive & Boolean Attributes: Attributes like
_class,_style, or_disablednow support lambdas for dynamic updates. Boolean attributes (e.g._disabled=True) are correctly rendered as key-only or omitted. - Simplified Removal (
.remove()): To remove a component from its parent, simply callself.remove()without arguments. - Rapid Content Replacement (
.text): Use the.textproperty on any tag to quickly replace its inner text content without needing to manually clear its children first. - Recursive Statics & JS: Components created dynamically (via lambdas) now have their
statics(CSS) andcall_jscommands correctly collected and sent to the client. - Scoped Styles (
styles): Define astylesclass attribute on any component to get automatically scoped CSS. The framework prefixes every rule with.htag-ClassName, handles@media,@keyframes, pseudo-selectors, and multi-selectors. - CSS Class Helpers:
add_class(),remove_class(),toggle_class(), andhas_class()for convenient class manipulation without manual string handling. - Simple Events & HashChange: Support for passing primitive values or custom objects from JS (via
tag["onclick"] = funcortag._onclick = func). Includes built-in support for_onhashchange. - Fragments (
Tag()): Create virtual components that group children without adding a wrapper tag to the DOM. - Advanced Tag Search (
.find_tag()): Effortlessly locate any component in the tree by its internal htag ID or its manually assigned HTMLid. - Custom ID Resilience: Manual HTML
idattributes are now supported without breaking htag2's reactive partial updates, thanks to an automaticdata-htag-idfallback mechanism. - Automatic Attribute Assignment: Non-prefixed keyword arguments passed during component instantiation are automatically assigned as instance attributes, simplifying data passing to custom components.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htag2-0.2.4.tar.gz.
File metadata
- Download URL: htag2-0.2.4.tar.gz
- Upload date:
- Size: 68.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51d63d9ebb5e1f527905065842ea30ec41bf4bbdab00db3c468d55411dc91256
|
|
| MD5 |
25441b3a0049b2fe15cc410d6b58b6bb
|
|
| BLAKE2b-256 |
c94c8f4b7b7bfc329fa271d2ec368064cf6c7ea183dafda4566f6d8916eb9fc3
|
Provenance
The following attestation bundles were made for htag2-0.2.4.tar.gz:
Publisher:
release.yml on manatlan/htag2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
htag2-0.2.4.tar.gz -
Subject digest:
51d63d9ebb5e1f527905065842ea30ec41bf4bbdab00db3c468d55411dc91256 - Sigstore transparency entry: 1056709851
- Sigstore integration time:
-
Permalink:
manatlan/htag2@7e817cf6b32de190d54bec1d8701f638d3903888 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/manatlan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7e817cf6b32de190d54bec1d8701f638d3903888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file htag2-0.2.4-py3-none-any.whl.
File metadata
- Download URL: htag2-0.2.4-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
826dcbc87df4279c4f9f89a1753ba4d252542ae7be82cd8ff0529f91eef21c7c
|
|
| MD5 |
9c4e90cc5c0dab43a77dc260adb21aec
|
|
| BLAKE2b-256 |
88ee251abe15af0c36bc55337eb28b0e544511b4ed069f009d20bde9fbfa67a0
|
Provenance
The following attestation bundles were made for htag2-0.2.4-py3-none-any.whl:
Publisher:
release.yml on manatlan/htag2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
htag2-0.2.4-py3-none-any.whl -
Subject digest:
826dcbc87df4279c4f9f89a1753ba4d252542ae7be82cd8ff0529f91eef21c7c - Sigstore transparency entry: 1056709886
- Sigstore integration time:
-
Permalink:
manatlan/htag2@7e817cf6b32de190d54bec1d8701f638d3903888 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/manatlan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7e817cf6b32de190d54bec1d8701f638d3903888 -
Trigger Event:
push
-
Statement type: