HTMX and SSE alias processor for PJX
Project description
pjx-htmx
HTMX and SSE extension for PJX.
This package provides HTMXExtension, which adds HTMX and SSE attribute aliases
to PJX templates and injects the HTMX browser script on full HTML pages.
Install it directly, or use pjx[htmx].
Installation
pip install pjx-htmx
# or
pip install pjx[htmx]
What It Adds
htmx:post->hx-posthtmx:get->hx-gethtmx:target->hx-targethtmx:swap->hx-swapsse:connect->sse-connectsse:swap->sse-swap
Example
<button htmx:post="/users" htmx:target="#list" htmx:swap="innerHTML">
Save
</button>
<div sse:connect="/events" sse:swap="message"></div>
Compiles to:
<button hx-post="/users" hx-target="#list" hx-swap="innerHTML">
Save
</button>
<div sse-connect="/events" sse-swap="message"></div>
Extension
HTMXExtension implements the PJXExtension ABC. It is discovered
automatically via the pjx.extensions entry point when the package is
installed:
[project.entry-points."pjx.extensions"]
htmx = "pjx_htmx.extension:HTMXExtension"
You can also register it explicitly:
from pjx import PJXEnvironment
from pjx_htmx.extension import HTMXExtension
env = PJXEnvironment(
loader=FileSystemLoader("templates"),
extensions=[HTMXExtension()],
)
Browser Asset Injection
On full HTML pages, PJX auto-injects the HTMX browser script when it detects
hx-* or sse-* attributes. To vendor the asset locally instead of using a
CDN:
pjx assets build static/vendor/pjx --provider htmx
Links
- Repository: https://github.com/oornnery/pjx
- Core package: https://pypi.org/project/pjx/
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 pjx_htmx-0.1.1.tar.gz.
File metadata
- Download URL: pjx_htmx-0.1.1.tar.gz
- Upload date:
- Size: 3.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 |
7a66b8a421615b96155d0f0f06ac84c6abbeab5850d051ccce53a7e132a8aaa7
|
|
| MD5 |
2c590837a2485f99579377286ef3b9e7
|
|
| BLAKE2b-256 |
496e9d84620651fbe052ab9e6c8eacd9c3c51a1ab7f43de246a89c057bc88102
|
Provenance
The following attestation bundles were made for pjx_htmx-0.1.1.tar.gz:
Publisher:
release.yml on oornnery/pjx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pjx_htmx-0.1.1.tar.gz -
Subject digest:
7a66b8a421615b96155d0f0f06ac84c6abbeab5850d051ccce53a7e132a8aaa7 - Sigstore transparency entry: 1239424057
- Sigstore integration time:
-
Permalink:
oornnery/pjx@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/oornnery
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pjx_htmx-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pjx_htmx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 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 |
12548ae9af86e13cd4529e36253f851c0f8eb80774baf8a5d589a55f575222bd
|
|
| MD5 |
0991845bc93d4ba8cf94f7008ab8e6ec
|
|
| BLAKE2b-256 |
c34981e4a17d345545ae66682c9464d2cb645934ebb2207f1d6a1212511d3da7
|
Provenance
The following attestation bundles were made for pjx_htmx-0.1.1-py3-none-any.whl:
Publisher:
release.yml on oornnery/pjx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pjx_htmx-0.1.1-py3-none-any.whl -
Subject digest:
12548ae9af86e13cd4529e36253f851c0f8eb80774baf8a5d589a55f575222bd - Sigstore transparency entry: 1239424065
- Sigstore integration time:
-
Permalink:
oornnery/pjx@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/oornnery
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@05309169b1ecf985fce2f90f642a5f4642e27c79 -
Trigger Event:
release
-
Statement type: