Skip to main content

Triplate (Python)

A templating engine for RDF query & data languages (SPARQL, Turtle, …) with a typed --- frontmatter header, injection-safe values, loops and conditionals. Python reference implementation of the Triplate language.

from triplate import compile

template = """\
---
params {
  classes: iri[] min 1
  limit:   int optional
}
---
SELECT ?s WHERE {
{% for c in classes join "UNION" %}
  { ?s a ${c} }
{% endfor %}
}
{% if limit %}LIMIT ${limit}{% endif %}
"""

tmpl = compile(template)
sparql = tmpl.render(classes=["http://example.org/Person"], limit=10)

Every input is declared in the mandatory --- frontmatter header with its RDF type; the context is validated and each value escaped accordingly, so rendered output is injection-safe and an unprocessed template fails fast.

See triplate.dev for the full guide and specification.

Download files

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

Source Distribution

triplate-0.7.1.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

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

triplate-0.7.1-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file triplate-0.7.1.tar.gz.

File metadata

  • Download URL: triplate-0.7.1.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for triplate-0.7.1.tar.gz
Algorithm Hash digest
SHA256 4d41b409a0a8ce0a72080ca44174e1356521a4f94bd3e58410bbb03c08d24fff
MD5 437776a2c26a3d3c8da2f82f2c57ca30
BLAKE2b-256 18ce85457de6e3e07af78732d622b931779ef601167eea89404c6e6dfcb2de59

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplate-0.7.1.tar.gz:

Publisher: release-please.yml on triplate/triplate

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

File details

Details for the file triplate-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: triplate-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for triplate-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ba1d3878b2a443927a695eb1c736a4d41dcb0e169e62b3a6a83fd6cf2ea5a1a
MD5 095467d413cd5c667ec328cff6d627d5
BLAKE2b-256 7a4c0800305fd5aa1f6b6f861acfc11c4eaa5b1b7543a752325580312b1422ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for triplate-0.7.1-py3-none-any.whl:

Publisher: release-please.yml on triplate/triplate

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.7.1 This release

2 files

0.7.0

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

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