Skip to main content

jinjarope

JinjaRope

PyPI License Package status Daily downloads Weekly downloads Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this week Github commits this month Github commits this year Package status

Read the documentation!

jinjarope is a toolkit for Jinja2: an enhanced Environment with a large set of extra filters, tests and globals, loaders for fsspec filesystems and nested dicts, composable loader classes, and TOML-based "JinjaFiles" to declare filters / tests / environment config.

Installation

pip install jinjarope

Optional extras: cli (command line interface), extras (formatting, highlighting, humanize, natsort filters), httpx2 (alias httpx), icons (icon filters), llm (llm_complete filter via agentpool), yaml.

pip install "jinjarope[cli]"

Quickstart

import jinjarope

env = jinjarope.Environment(loader=jinjarope.DictLoader({"hello.jinja": "Hello {{ name }}!"}))
print(env.render_template("hello.jinja", name="World"))  # Hello World!
print(env.render_string("{{ 'Hello World' | slugify }}"))  # hello_world

Features

  • jinjarope.Environment: drop-in jinja2.Environment subclass with ~150 additional filters / tests / functions, render_string / render_file / render_template, with_globals(), selectable undefined behavior ("strict", "lax", ...), and an entry-point (jinjarope.environment) to let other packages extend every environment.
  • Subclasses of all jinja2 loaders with __eq__, __hash__, __repr__ and __getitem__, plus fsspec-based and dict-based loaders.
  • JinjaFiles: TOML files declaring filters, tests, functions and environment config.
  • A read-only fsspec filesystem exposing a loader's templates (for debugging).
  • A jinjarope CLI to render (remote) templates: jinjarope -i template.jinja -j config.toml -o out.md (with the cli extra).

FsSpecFileSystemLoader

Works like a FileSystemLoader, but on any fsspec-supported (remote) location. Using the dir:: prefix, any folder can be set as root.

import fsspec
import jinjarope

# protocol path
loader = jinjarope.FsSpecFileSystemLoader("dir::github://phil65:jinjarope@main/tests/testresources")
env = jinjarope.Environment(loader=loader)
env.get_template("testfile.jinja").render()

# protocol and storage options
loader = jinjarope.FsSpecFileSystemLoader("github", org="phil65", repo="jinjarope")
env = jinjarope.Environment(loader=loader)
env.get_template("README.md").render()

# fsspec filesystem
fs = fsspec.filesystem("github", org="phil65", repo="jinjarope")
loader = jinjarope.FsSpecFileSystemLoader(fs)
env = jinjarope.Environment(loader=loader)
env.get_template("README.md").render()

FsSpecProtocolPathLoader

Accepts complete fsspec protocol paths as template names.

loader = jinjarope.FsSpecProtocolPathLoader()
env = jinjarope.Environment(loader=loader)
env.get_template("github://phil65:jinjarope@main/tests/testresources/testfile.jinja").render()

NestedDictLoader

[example]
template = "{{ something }}"
import tomllib

with open("templates.toml", "rb") as toml_file:
    content = tomllib.load(toml_file)
loader = jinjarope.NestedDictLoader(content)
env = jinjarope.Environment(loader=loader)
env.get_template("example/template").render(something="value")

Loader composition

loader = jinjarope.FileSystemLoader("templates/")
template = loader["path/to/template.jinja"]  # jinja2.Template
source = loader.get_template_source("path/to/template.jinja")

# OR loaders to get a ChoiceLoader
choice_loader = jinjarope.FileSystemLoader("templates/") | jinjarope.PackageLoader("my_package")

# pathlib-style division creates a PrefixLoader
prefix_loader = "path_prefix" / jinjarope.FileSystemLoader("templates/")

Filters, tests and functions

See the documentation for the full list of built-in filters, tests and functions with examples.

Metadata

Release files for jinjarope 1.2.0

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

Source distribution (sdist)

Source distribution for jinjarope 1.2.0
File Size Uploaded Provenance Actions
jinjarope-1.2.0.tar.gz 2.7 MB Without provenance Details for jinjarope-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jinjarope 1.2.0
File Interpreter ABI Platform Actions
jinjarope-1.2.0-py3-none-any.whl Python 3 none any Details for jinjarope-1.2.0-py3-none-any.whl

Total release size: 5.4 MB

Release files / jinjarope-1.2.0.tar.gz

Download URL jinjarope-1.2.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
e4dd407f2fb8f284e33da9a77a61472dc9351a7104f94febf6999f43d418559b
BLAKE2b-256 checksum
How to use checksums
8d26294547820e860116c47a7f3fb4bc93c28c75b4abf8470bfe85bba3526f05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / jinjarope-1.2.0-py3-none-any.whl

Download URL jinjarope-1.2.0-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a2f4afb02ff818bbb2399560bd5fab959bffde269259e18c0932396448eb7f49
BLAKE2b-256 checksum
How to use checksums
6e52b431141db5ecefc47aaa58c9f300ad452ab33c7b15d5b9ab22bf1829f470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for jinjarope 1.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

1.2.0 This release

2 release files No 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