Skip to main content

Jinja2 Context Filters

Overview

This Jinja2 Extension plugin provides filters that expose introspection values about the current Jinja2 Context and Environment objects for the current template's Environment().

Included filters

  • context_info
    • blocks(available blocks defined in this or a parent template)
    • exported(vars exported from this template)
    • global_vars(vars passed in to render)
    • name(name of the current template object... often the template filename)
    • vars(vars declared with set both here or from a parent)
  • environment_info
    • extensions
    • filters
    • tests

Install

pip install jinja2-context-filters

Usage

Typical usage with jinja2

  from jinja2 import Environment

...
  env = Environment(extensions=['jinja2_context_filters.Jinja2ContextExtension'])
...
# OR
  from jinja2_context_filters import Jinja2ContextExtension
  env = Environment(extensions=[Jinja2ContextExtension])
...

In a template

{{ 'name' | context_info }}
{{ 'blocks' | context_info }}
{{ 'exported' | context_info }}
{{ 'filters' | environment_info }}
{{ 'tests' | environment_info }}
{{ 'extensions' | environment_info }}

Include into cookiecutter

cookiecutter.json

{
  "_extensions": ["jinja2_context_filters.Jinja2ContextExtension"]
}

License

MIT License

1.0.0 (2019-11-15)

Bug Fixes

  • Fixed setup.cfg by removing quotes from desc (ae45723)

Features

  • Added vars and global vars + tests 100% (677ca37)

MIT License

Copyright (c) 2019 Global InfoTek, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for jinja2-context-filters 1.0.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 jinja2-context-filters 1.0.0
File Size Uploaded Provenance Actions
jinja2-context-filters-1.0.0.tar.gz 2.9 kB Without provenance Details for jinja2-context-filters-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jinja2-context-filters 1.0.0
File Interpreter ABI Platform Actions
jinja2_context_filters-1.0.0-py3-none-any.whl Python 3 none any Details for jinja2_context_filters-1.0.0-py3-none-any.whl

Total release size: 6.8 kB

Release files / jinja2-context-filters-1.0.0.tar.gz

Download URL jinja2-context-filters-1.0.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
08172b1c4c7f834aadf39635af983948faa792fa30480e9f00a7356464dea60d
BLAKE2b-256 checksum
How to use checksums
03fdf97f996dd9cce006edab819d2e59c887e5f1411f7a70b24304f8fc7bfc17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

Release files / jinja2_context_filters-1.0.0-py3-none-any.whl

Download URL jinja2_context_filters-1.0.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d33922756b548600a69a95f8279bc99b802a6b9fde35abfe463d3750e8812a69
BLAKE2b-256 checksum
How to use checksums
b3ad78ad63623c82584030d73b57447625b61b2986f2854f701cf9a739510639
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

Security for jinja2-context-filters 1.0.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.0.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