jinjarope
How to install
pip
The latest released version is available at the Python package index.
pip install jinjarope
With CLI:
pip install jinjarope[cli]
Quick guide
Jinjarope contains a range of Jinja2 loaders (including fsspec-based ones) as well as a jinja2.Environment subclass with added functionality.
For debugging purposes, an FsSpec filesystem implementation for jinja2 loaders is also included.
FsSpecFileSystemLoader
This loader can be used like a FileSystemLoader, but also works on any fsspec-supported
remote path.
Using the dir:: prefix, any folder can be set as root.
# 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
This loader accepts any FsSpec protocol path to be used directly. A complete protocol URL to the template file is required.
loader = jinjarope.FsSpecProtocolPathLoader()
env = jinjarope.Environment(loader=loader)
env.get_template("github://phil65:jinjarope@main/tests/testresources/testfile.jinja").render()
NestedDictLoader
[example]
template = "{{ something }}"
content = tomllib.load(toml_file)
loader = jinjarope.NestedDictLoader(content)
env = jinjarope.Environment(loader=loader)
env.get_template("example/template")
General loader information
jinjarope also contains subclasses for all default jinja2 loaders. These loaders
have implementations for some magic methods (__eq__, __hash__, __repr__, , __getitem__).
loader = jinjarope.FileSystemLoader(...)
template_source = loader["path/to/template.jinja"]
The loaders can also get ORed to return a ChoiceLoader.
choice_loader = jinjarope.FileSystemLoader(..) | jinjarope.PackageLoader(...)
Prefix loaders can get created using pathlib-style string concatenations
prefix_loader = "path_prefix" / jinjarope.FileSystemLoader(...)
Additional filters / tests
Check out the documentation for a list of built-in filters and tests!
Metadata
Release files for jinjarope 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jinjarope-1.0.7.tar.gz | 2.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jinjarope-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 MB
Release files / jinjarope-1.0.7.tar.gz
| Download URL | jinjarope-1.0.7.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
876db5c9b087f8275f9a6ae2686ae12d57999d320500b8ddcbc9ecbf26e3c42b
|
|
BLAKE2b-256 checksum How to use checksums |
90146caaf04cefcf97fff8db5de10e5fc1f6f7af7f20acdb441f089a5dbe130c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / jinjarope-1.0.7-py3-none-any.whl
| Download URL | jinjarope-1.0.7-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6a46558281f74fa2bde31bce368663100962ec0fa2bf68c9faf430030dea298
|
|
BLAKE2b-256 checksum How to use checksums |
17da065560563ffa16799e488f1fddfca96834a905b47a3201a0071b33fac43f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|