Modern HTML template rendering in Python
Project description
This package is in early development and not yet stable. The API may change without notice between releases.
Modern HTML template rendering in Python. No build step, no template files, and native HTML awareness out of the box. Read More
from fastapi import APIRouter
router = APIRouter()
@router.get("/", response_class=HTMLResponse)
async def index() -> str:
published = [p for p in POSTS if p.published]
return <>
<Layout title="My Blog">
<h1>Latest Posts</h1>
<PostCard for={{ post in published }} post={{ post }} />
</Layout>
</>
IDE Support
Type checking, completions, hover docs, go-to-definition, rename, and semantic highlighting. All working inside fragment syntax.
Install the Python Fragments VS Code extension to get started.
Installation
pip install python-fragments
Register the loader at your application's entry point, before importing any modules that contain fragments:
from fragments import loader # isort: skip
Any .py file containing <> is transpiled automatically. Nothing else to configure.
Documentation
Full documentation is available at python-fragments.io.
Contributing
Bug reports, feature requests, and documentation improvements are all welcome. Code contributions aren't open yet while we work toward v1. See CONTRIBUTING.md for details.
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 python_fragments-0.36.tar.gz.
File metadata
- Download URL: python_fragments-0.36.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca7dfe0417168e2aab6abcf1288a56d90c07860d88418714af595b5692a87532
|
|
| MD5 |
515567ecf9b821603a6ae58599bf343a
|
|
| BLAKE2b-256 |
78507f24da05454437d90fd547522d6dc7e9ce57fbe8feb85251da8d5863394f
|
Provenance
The following attestation bundles were made for python_fragments-0.36.tar.gz:
Publisher:
release.yml on TheRunningAlgorithm2/python-fragments
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_fragments-0.36.tar.gz -
Subject digest:
ca7dfe0417168e2aab6abcf1288a56d90c07860d88418714af595b5692a87532 - Sigstore transparency entry: 1982368010
- Sigstore integration time:
-
Permalink:
TheRunningAlgorithm2/python-fragments@60e46eb449cfcdd2dd0a569d560faf422a22bae1 -
Branch / Tag:
refs/tags/v0.36 - Owner: https://github.com/TheRunningAlgorithm2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60e46eb449cfcdd2dd0a569d560faf422a22bae1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_fragments-0.36-py3-none-any.whl.
File metadata
- Download URL: python_fragments-0.36-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14f48bc47d5cb144cb4a82add1e1292856669eb11b19f672b9e5959ea5108dea
|
|
| MD5 |
9e1a6d0bda3558d96a23aabaeeb97fbe
|
|
| BLAKE2b-256 |
572231e370e3050628abf87ca2872d522a650c5cc6b80083b2e40362e92e9c12
|
Provenance
The following attestation bundles were made for python_fragments-0.36-py3-none-any.whl:
Publisher:
release.yml on TheRunningAlgorithm2/python-fragments
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_fragments-0.36-py3-none-any.whl -
Subject digest:
14f48bc47d5cb144cb4a82add1e1292856669eb11b19f672b9e5959ea5108dea - Sigstore transparency entry: 1982368119
- Sigstore integration time:
-
Permalink:
TheRunningAlgorithm2/python-fragments@60e46eb449cfcdd2dd0a569d560faf422a22bae1 -
Branch / Tag:
refs/tags/v0.36 - Owner: https://github.com/TheRunningAlgorithm2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@60e46eb449cfcdd2dd0a569d560faf422a22bae1 -
Trigger Event:
push
-
Statement type: