Skip to main content

Python Liquid

Python Liquid is a Python engine for Liquid, the safe, customer-facing template language.
We follow Shopify/Liquid closely and test against the Golden Liquid test suite.


Table of Contents

Install

Install Python Liquid using Pipenv:

$ pipenv install -u python-liquid

Or pip:

$ pip install python-liquid

Or from conda-forge:

$ conda install -c conda-forge python-liquid

Quick Start

render()

This example renders a template from a string of text with the package-level render() function. The template has just one placeholder variable you, which we've given the value "World".

from liquid import render

print(render("Hello, {{ you }}!", you="World"))
# Hello, World!

parse()

Often you'll want to render the same template several times with different variables. We can parse source text without immediately rendering it using the parse() function. parse() returns a BoundTemplate instance with a render() method.

from liquid import parse

template = parse("Hello, {{ you }}!")
print(template.render(you="World"))  # Hello, World!
print(template.render(you="Liquid"))  # Hello, Liquid!

Configure

Both parse() and render() are convenience functions that use the default Liquid environment. For all but the simplest cases, you'll want to configure an instance of Environment, then load and render templates from that.

from liquid import CachingFileSystemLoader
from liquid import Environment

env = Environment(
    autoescape=True,
    loader=CachingFileSystemLoader("./templates"),
)

Then, using env.parse() or env.get_template(), we can create a BoundTemplate from a string or read from the file system, respectively.

# ... continued from above
template = env.parse("Hello, {{ you }}!")
print(template.render(you="World"))  # Hello, World!

# Try to load "./templates/index.html"
another_template = env.get_template("index.html")
data = {"some": {"thing": [1, 2, 3]}}
result = another_template.render(**data)

Unless you happen to have a relative folder called templates with a file called index.html within it, we would expect a TemplateNotFoundError to be raised when running the example above.

Contributing

Please see Contributing to Python Liquid.

Metadata

Release files for python-liquid 2.3.7

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

Source distribution (sdist)

Source distribution for python-liquid 2.3.7
File Size Uploaded Provenance Actions
python_liquid-2.3.7.tar.gz 95.7 kB With provenance Details for python_liquid-2.3.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-liquid 2.3.7
File Interpreter ABI Platform Actions
python_liquid-2.3.7-py3-none-any.whl Python 3 none any Details for python_liquid-2.3.7-py3-none-any.whl

Total release size: 237.3 kB

Release files / python_liquid-2.3.7.tar.gz

Download URL python_liquid-2.3.7.tar.gz
Size 95.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ee88a941ee603dd4a371ff18411ffb4d1479c5cb0ac617dbd43df89ec73855d
BLAKE2b-256 checksum
How to use checksums
0dd3e5d3e21763f979ee18ccedafb8a1bc40198414c4743689d1e46753d765e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Release files / python_liquid-2.3.7-py3-none-any.whl

Download URL python_liquid-2.3.7-py3-none-any.whl
Size 141.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da567a75e5cdfbbfdd2a93a92658b28f50f3f57e0ca6b6380c34639662c67265
BLAKE2b-256 checksum
How to use checksums
9c2fb4188184a0705befbb67ab8cda06569c7823466301d81a1e08a47a5d3059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Security for python-liquid 2.3.7

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 python_liquid-2.3.7.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 Nov 13, 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

2.3.7 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