Skip to main content

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

htag2 logo

PyPI Test Status Download Latest Build

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 (not yet)

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 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=True to 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=False on 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 .childs properties: Every GTag exposes its position in the component tree. .root references the main Tag instance, .parent references the direct parent component, and .childs is 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 using with blocks (e.g., with Tag.div(): Tag.h1("Hello")), removing the need for self <= ... boilerplate.
  • Reactive State Management (State): Introducing State(value) for automatic UI reactivity. Simply assign a State to a component using a lambda (e.g. Tag.div(lambda: state.value)), and the UI will auto-update whenever the state changes. Use state.set(new_value) for functional updates inside callbacks.
  • Reactive & Boolean Attributes: Attributes like _class, _style, or _disabled now support lambdas for dynamic updates. Boolean attributes (e.g. _disabled=True) are correctly rendered as key-only or omitted.
  • Rapid Content Replacement (.text): Use the .text property 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) and call_js commands correctly collected and sent to the client.
  • Scoped Styles (styles): Define a styles class 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(), and has_class() for convenient class manipulation without manual string handling.
  • State.notify(): Manually trigger reactive updates after in-place mutations of mutable values (lists, dicts).
  • Simple Events & HashChange: Support for passing primitive values or custom objects from JS. Includes built-in support for _onhashchange with newURL and oldURL attributes.

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

htag2-0.2.0.tar.gz (63.2 kB view details)

Uploaded Source

Built Distribution

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

htag2-0.2.0-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file htag2-0.2.0.tar.gz.

File metadata

  • Download URL: htag2-0.2.0.tar.gz
  • Upload date:
  • Size: 63.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for htag2-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c078b9132c74c3bbc95ba229d525604c8c68574092bac8781f9508c47f2367e
MD5 b2d45e7a943d3d01249d08676a34feb0
BLAKE2b-256 5d9ca2c2fb8341bab8369a3c0cae717e1310268e64b0180920b0a8b970727a02

See more details on using hashes here.

Provenance

The following attestation bundles were made for htag2-0.2.0.tar.gz:

Publisher: release.yml on manatlan/htag2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file htag2-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: htag2-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for htag2-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e56f10f90614405a1b1beec46d688074717f357db3a110a978c37efb3a426592
MD5 a840553fde52584c81d3b6082283d758
BLAKE2b-256 6fd2ec47a6f910bcfb76bd72ecb0467549672c7afbb7308b7c243f906dc81573

See more details on using hashes here.

Provenance

The following attestation bundles were made for htag2-0.2.0-py3-none-any.whl:

Publisher: release.yml on manatlan/htag2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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