Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A Python port of the Liquid template engine, built on Jinja2 with multiple compatibility modes.
Liquidpy is a Python port of the Liquid template engine, built on top of Jinja2, that renders Liquid templates with four compatibility modes.
Liquidpy is a Python library that implements the Liquid template language (originally created by Shopify) using Jinja2 as its underlying engine. It accepts Liquid template strings or file paths as input and outputs rendered text by injecting Python variables, filters, and tags. The library is developed by pwwang and distributed on PyPI with the package name liquidpy.
Liquid.from_env.python block tag so you can execute arbitrary Python code inside a template, such as from os import path.from_file=False to the constructor.from_file and mode in the defaults module once, then construct Liquid instances without repeating those options.Liquid('{{a}}', from_file=False) and call render(a=1) to get the string '1'.Environment(loader=FileSystemLoader('./')) to Liquid.from_env and load templates from disk with your existing setup.mode='wild', embed a python block that imports modules and uses the results in the output, like joining path components.Install with pip install -U liquidpy, then import Liquid and instantiate it with a template string or file path. The render method accepts keyword arguments that become template variables; if a Jinja2 Environment is provided, Liquidpy renders through it. Changing defaults via the defaults module lets you set from_file and mode globally so they do not need to be passed each time.
Yes, liquidpy is an open-source Python package distributed on PyPI; there is no paid tier or licensing fee mentioned in the documentation.
It supports four modes: standard (the default), Jekyll, Shopify, and wild. Wild mode allows raw Python code inside template tags, while the other three match the public Liquid dialects from Shopify's ecosystem.
Yes, use Liquid.from_env and pass a jinja2.Environment instance; Liquidpy will render Liquid templates using that environment's loader and extensions.
Pass the file path to Liquid, for example Liquid('/path/to/template.html'), and the library reads the file. Alternatively, set defaults.FROM_FILE = True so all template paths are treated as file paths by default.
Yes, there is a browser-based playground powered by PyScript at https://pwwang.github.io/liquidpy/playground where you can test Liquid templates online.