Skip to main content

jinja2-shell

CI Status Documentation Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License

Jinja2 Extension for running shell commands. Makes use of subprocess.run(shell=False).

Installation

Install this via pip (or your favourite package manager):

pip install jinja2-shell

Usage

The extension class is jinja2_shell.ShellExtension.

If the second argument is True (default), the output is stripped of trailing whitespace and newlines. (a\n\b \n -> a\nb)

As a statement:

{% shell "echo Hello World" %}
{% shell "echo Hello World", False %}
{% shell "echo 'Hello World', False %}
{% shell "echo \"Hello World\"", False %}
Hello World
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)

As a expression:

{{ "echo Hello World" | shell }}
{{ "echo Hello World" | shell(False) }}
{{ "echo 'Hello World'" | shell(False) }}
{{ "echo \"Hello World\"" | shell(False) }
Hello World
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)
Hello World (Ubuntu), Hello World\n (Windows)

Contributors ✨

Thanks goes to these wonderful people (emoji key):

34j
34j

💻 🤔 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Metadata

Release files for jinja2-shell 0.1.4

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

Source distribution (sdist)

Source distribution for jinja2-shell 0.1.4
File Size Uploaded
jinja2_shell-0.1.4.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jinja2-shell 0.1.4
File Interpreter ABI Platform
jinja2_shell-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / jinja2_shell-0.1.4.tar.gz

Download URL jinja2_shell-0.1.4.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d772682f080648e50d3c8a59d20232e4a5a7dec9915fd726f8b20d9d0013c45b
BLAKE2b-256 checksum
How to use checksums
ff61956a1b7379ca5037bd382adf01ee0420ce04a22242483808026b8c8395ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.11.2 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.2.3 tqdm/4.67.0 importlib-metadata/8.5.0 keyring/25.5.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.15

Release files / jinja2_shell-0.1.4-py3-none-any.whl

Download URL jinja2_shell-0.1.4-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0649aaf027b29a718df9814505776b0f616371ac6a34ae70f775385ff32006b4
BLAKE2b-256 checksum
How to use checksums
c36e457c59bcba31c99ef329691f4e5ab038b72661e497ce5ddd0a16bfe81e29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.11.2 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.2.3 tqdm/4.67.0 importlib-metadata/8.5.0 keyring/25.5.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.15

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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