python-liquid
A Python engine for the Liquid template language.
What it is and what it does
Python Liquid is a Liquid template engine—a safe, expression-based template language originally from Shopify—implemented in pure Python. It parses and renders templates that contain variable placeholders, filters, control flow (if/for/unless), and other Liquid constructs, making it suitable for customer-facing or untrusted template input where you need safety guarantees that general-purpose Python code execution would not provide.
The package offers two main entry points: a simple `render()` function for one-off template rendering, and an `Environment` class for managing multiple templates, configuring autoescape and template loaders, and reusing parsed templates. It follows Shopify's Liquid specification closely and validates against the Golden Liquid test suite. Runtime dependencies handle date/time operations (python-dateutil, pytz), internationalization (babel), HTML escaping (markupsafe), and resource loading (importlib-resources).
Use it for:
- Render user-supplied or customer-provided templates safely without executing arbitrary Python code
- Generate HTML emails or documents from template files with variable substitution and conditional logic
- Build a template-based reporting or document generation system with Shopify Liquid syntax
- Migrate Liquid templates from Ruby or JavaScript environments to a Python backend
- Implement a theme or customization system where end users write templates in a familiar, safe syntax
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python Liquid is a template engine that renders Liquid templates—a safe, customer-facing template language used by Shopify—from strings or files with variable substitution and control flow.
Yes. Python Liquid is actively maintained, has no known vulnerabilities, installs with low friction, and is MIT-licensed. It is a solid choice if you need Liquid template rendering in Python—particularly if you are migrating from Shopify or another Liquid implementation, or if you need to safely render customer-supplied templates. The Golden Liquid test suite alignment is a strong signal of correctness.
Install
python-liquid on PyPI
pip
pip install python-liquiduv
uv add python-liquidpoetry
poetry add python-liquidInstalling python-liquid
Before you install
Low friction: pure Python wheel with five common runtime dependencies (babel, markupsafe, python-dateutil, pytz, importlib-resources). Actively maintained—last commit 2026-08-08, released 6 days ago. Supports Python 3.9 through 3.14 on CPython and PyPy.
License in practice
MIT license (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions, provided you include the license notice.
Quickstart
from liquid import render
print(render("Hello, {{ you }}!", you="World"))
# Hello, World!
# Or parse once, render many times:
from liquid import parse
template = parse("Hello, {{ you }}!")
print(template.render(you="World"))
Verify before relying
- Performance characteristics compared to other Liquid implementations or template engines
- Whether the Golden Liquid test suite coverage is complete or if edge cases remain
- Support for custom filters, tags, or extensions beyond the standard Liquid spec
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — babel, importlib-resources, markupsafe, python-dateutil, pytz |
| Maintenance | actively maintained — 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,293,845/month — #4,096 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_liquid-2.3.1-py3-none-any.whl
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
liquidpyLiquidpy is a Python port of the Liquid…
permissive · top 15,000 on PyPI
curlylintLints HTML templates in Jinja, Nunjucks,…
permissive · top 15,000 on PyPI
djlintdjlint formats and lints HTML templates with…
copyleft · top 5,000 on PyPI
tinyhtmlRenders HTML5 safely from Python expressions…
permissive · top 15,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
chevronChevron renders Mustache templates in Python,…
permissive · top 5,000 on PyPI
pydantic-handlebarsRenders Handlebars templates for composing LLM…
permissive · top 5,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
django-mjmlProvides a Django template tag that compiles…
permissive · top 15,000 on PyPI