Skip to main content

pygotpl

pygotpl publishes gotpl, a pure Python implementation of Go's text/template and html/template, with Sprig v3 compatibility and separate synchronous and asynchronous rendering paths. Runtime use requires no Go installation, subprocess, shared library, or compiled extension.

pygotpl is pre-1.0. Completed areas have oracle-backed compatibility evidence, while the complete Go text/template and html/template surfaces remain classified as partial. Check the compatibility contract before relying on a specific Go behavior.

Installation

python -m pip install gotpl

Optional cryptographic and Helm capabilities are available through the crypto and helm extras. gotpl installs its compatible goduration and gotime dependencies automatically. See Getting Started for the exact commands and supported Python versions.

Quick Start

Render a text template once:

import gotpl

result = gotpl.render("Hello {{.Name}}", {"Name": "Gopher"})
assert result == "Hello Gopher"

Compile a template when the same source will be rendered repeatedly:

import gotpl

greeting = gotpl.Template("Hello {{.Name}}")

assert greeting.render({"Name": "Ada"}) == "Hello Ada"
assert greeting.render({"Name": "Linus"}) == "Hello Linus"

For HTML output, use the contextual HTML API rather than escaping a completed string:

import gotpl

result = gotpl.render_html(
    '<a href="/search?q={{.Query}}">{{.Label}}</a>',
    {"Query": "python & go", "Label": "<Search>"},
)

assert result == '<a href="/search?q=python%20%26%20go">&lt;Search&gt;</a>'

Where to Go Next

The generated documentation site is published at http://blog.kyonr.com/pygotpl/.

Development

Development dependencies are locked with uv. Go is needed only for reference oracles and comparative benchmarks.

uv sync --frozen --all-groups --extra crypto
./scripts/check.sh

See Contributing, Testing, and the active M10 milestone before changing compatibility behavior.

License

Copyright 2026 Revolution1. Original project work is licensed under the Apache License 2.0. Upstream terms and attribution are recorded in Third-Party Notices.

Metadata

Release files for gotpl 0.1.0

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

Source distribution (sdist)

Source distribution for gotpl 0.1.0
File Size Uploaded Provenance Actions
gotpl-0.1.0.tar.gz 174.4 kB With provenance Details for gotpl-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gotpl 0.1.0
File Interpreter ABI Platform Actions
gotpl-0.1.0-py3-none-any.whl Python 3 none any Details for gotpl-0.1.0-py3-none-any.whl

Total release size: 384.3 kB

Release files / gotpl-0.1.0.tar.gz

Download URL gotpl-0.1.0.tar.gz
Size 174.4 kB
Tags Source
SHA-256 checksum
How to use checksums
96db2210287ac6fb7748f20eb61e440d91fafc83263f607680493dffd4bc24b3
BLAKE2b-256 checksum
How to use checksums
1fcbccf6730ccbe5b11787e530a8cefc8f4c96c5b910726d33b8df5ee7338f16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 28, 2026.

Transparency log

Release files / gotpl-0.1.0-py3-none-any.whl

Download URL gotpl-0.1.0-py3-none-any.whl
Size 209.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a98f1e8d3af98f74f987b71964b33cf2ad1be22f80d6fee9add9c40ef333523d
BLAKE2b-256 checksum
How to use checksums
053503844869ea52cf6f5d9027d72f8ff3938f46b941ba1fdd08413e6bc5a594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 28, 2026.

Transparency log

Security for gotpl 0.1.0

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 gotpl-0.1.0.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 Aug 28, 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.1.0 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