Skip to main content

Python Fragments

Tests PyPI version Python versions License Documentation VS Code Extension

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.

VS Code completions demo

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.

Metadata

Release files for python-fragments 0.36

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-fragments 0.36
File Size Uploaded Provenance Actions
python_fragments-0.36.tar.gz 26.3 kB With provenance Details for python_fragments-0.36.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-fragments 0.36
File Interpreter ABI Platform Actions
python_fragments-0.36-py3-none-any.whl Python 3 none any Details for python_fragments-0.36-py3-none-any.whl

Total release size: 57.7 kB

Release files / python_fragments-0.36.tar.gz

Download URL python_fragments-0.36.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ca7dfe0417168e2aab6abcf1288a56d90c07860d88418714af595b5692a87532
BLAKE2b-256 checksum
How to use checksums
78507f24da05454437d90fd547522d6dc7e9ce57fbe8feb85251da8d5863394f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.

Transparency log

Release files / python_fragments-0.36-py3-none-any.whl

Download URL python_fragments-0.36-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14f48bc47d5cb144cb4a82add1e1292856669eb11b19f672b9e5959ea5108dea
BLAKE2b-256 checksum
How to use checksums
572231e370e3050628abf87ca2872d522a650c5cc6b80083b2e40362e92e9c12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.

Transparency log

Security for python-fragments 0.36

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for python_fragments-0.36.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 27, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page