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.

Code formatting with Black is also supported through the Black integration.

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.38

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.38
File Size Uploaded Provenance Actions
python_fragments-0.38.tar.gz 46.7 kB With provenance Details for python_fragments-0.38.tar.gz

Built distribution (wheel)

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

Total release size: 87.3 kB

Release files / python_fragments-0.38.tar.gz

Download URL python_fragments-0.38.tar.gz
Size 46.7 kB
Tags Source
SHA-256 checksum
How to use checksums
22ecaca07c9a4407806bcbd7f86522cc732f21ac0670a5df8f1d5fe10eb924df
BLAKE2b-256 checksum
How to use checksums
19594acfa4d18b0e6e7d75374468096cdadfc756925970cb891c1396d96288ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

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

Download URL python_fragments-0.38-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3f8f1564bd1d0b8398df6495c6f45432f3f85ec609003e12eaea75db9eea294
BLAKE2b-256 checksum
How to use checksums
a83051d10a0470ef8d38775d6364dd88c4e0727b5b217eb61b7dd575f0a4d701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for python-fragments 0.38

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for python_fragments-0.38.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 Nov 19, 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

This release

0.38 This release

2 release files Full provenance

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