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.
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 gotpl-0.1.0.tar.gz.
File metadata
- Download URL: gotpl-0.1.0.tar.gz
- Upload date:
- Size: 174.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96db2210287ac6fb7748f20eb61e440d91fafc83263f607680493dffd4bc24b3
|
|
| MD5 |
6afbce2f554d7763f93f6a6848fd5393
|
|
| BLAKE2b-256 |
1fcbccf6730ccbe5b11787e530a8cefc8f4c96c5b910726d33b8df5ee7338f16
|
Provenance
The following attestation bundles were made for gotpl-0.1.0.tar.gz:
Publisher:
publish-gotpl.yml on Revolution1/pygotpl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gotpl-0.1.0.tar.gz -
Subject digest:
96db2210287ac6fb7748f20eb61e440d91fafc83263f607680493dffd4bc24b3 - Sigstore transparency entry: 2626292828
- Sigstore integration time:
-
Permalink:
Revolution1/pygotpl@893b887eed1f8185fd0a9009287f7f2b97b7ee98 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Revolution1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-gotpl.yml@893b887eed1f8185fd0a9009287f7f2b97b7ee98 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gotpl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gotpl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 209.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a98f1e8d3af98f74f987b71964b33cf2ad1be22f80d6fee9add9c40ef333523d
|
|
| MD5 |
84bd9de7e0b5bd7fd02137db4bfa3d64
|
|
| BLAKE2b-256 |
053503844869ea52cf6f5d9027d72f8ff3938f46b941ba1fdd08413e6bc5a594
|
Provenance
The following attestation bundles were made for gotpl-0.1.0-py3-none-any.whl:
Publisher:
publish-gotpl.yml on Revolution1/pygotpl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gotpl-0.1.0-py3-none-any.whl -
Subject digest:
a98f1e8d3af98f74f987b71964b33cf2ad1be22f80d6fee9add9c40ef333523d - Sigstore transparency entry: 2626292838
- Sigstore integration time:
-
Permalink:
Revolution1/pygotpl@893b887eed1f8185fd0a9009287f7f2b97b7ee98 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Revolution1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-gotpl.yml@893b887eed1f8185fd0a9009287f7f2b97b7ee98 -
Trigger Event:
push
-
Statement type: