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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gotpl-0.1.0.tar.gz (174.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gotpl-0.1.0-py3-none-any.whl (209.9 kB view details)

Uploaded Python 3

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

Hashes for gotpl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96db2210287ac6fb7748f20eb61e440d91fafc83263f607680493dffd4bc24b3
MD5 6afbce2f554d7763f93f6a6848fd5393
BLAKE2b-256 1fcbccf6730ccbe5b11787e530a8cefc8f4c96c5b910726d33b8df5ee7338f16

See more details on using hashes here.

Provenance

The following attestation bundles were made for gotpl-0.1.0.tar.gz:

Publisher: publish-gotpl.yml on Revolution1/pygotpl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for gotpl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a98f1e8d3af98f74f987b71964b33cf2ad1be22f80d6fee9add9c40ef333523d
MD5 84bd9de7e0b5bd7fd02137db4bfa3d64
BLAKE2b-256 053503844869ea52cf6f5d9027d72f8ff3938f46b941ba1fdd08413e6bc5a594

See more details on using hashes here.

Provenance

The following attestation bundles were made for gotpl-0.1.0-py3-none-any.whl:

Publisher: publish-gotpl.yml on Revolution1/pygotpl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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