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.
pygotplis pre-1.0. Completed areas have oracle-backed compatibility evidence, while the complete Gotext/templateandhtml/templatesurfaces 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"><Search></a>'
Where to Go Next
- Getting Started — installation, repeated renders, and registering Python functions.
- Template Language — pipelines, control flow, variables, associations, and built-ins.
- Reusable Templates and Environments — choose
Template,HTMLTemplate,Environment, orTemplateEngine; load named sources; and reuse immutable configuration. - Async Rendering — async callbacks, writers, cancellation, and concurrency.
- HTML Templates — contextual escaping and trusted content.
- Function Libraries — Sprig, Slim-Sprig, Sprout, Helm-compatible functions, and Python-native helpers.
- Runtime Extensions — context-aware integrations, associated rendering, capabilities, and extension authoring.
- Sandboxing — policies, budgets, and the security boundary.
- Build an HTML Site — a Jinja2-style template directory with reusable header and footer definitions.
- Helm Functions and Runtime and Build a Helm Renderer — reusable Helm APIs and the complete local-chart application workflow.
- API Overview — the candidate 1.0 public surface.
- Compatibility and Performance — measured support and benchmark evidence.
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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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 logRelease 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 logSecurity 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.
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 logA 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.