freshcrate
Skin:/
Home > Frameworks > jinja2-humanize-extension

jinja2-humanize-extension

a jinja2 extension to use humanize library inside jinja2 templates

Why this rank:Release freshnessHealthy release cadenceStrong adoption

Description

# jinja2_humanize_extension [//]: # (automatically generated from https://github.com/metwork-framework/github_organization_management/blob/master/common_files/README.md) **Status (master branch)** [![GitHub CI](https://github.com/metwork-framework/jinja2_humanize_extension/workflows/CI/badge.svg?branch=master)](https://github.com/metwork-framework/jinja2_humanize_extension/actions?query=workflow%3ACI+branch%3Amaster) [![Maintenance](https://raw.githubusercontent.com/metwork-framework/resources/master/badges/maintained.svg)](https://github.com/metwork-framework/resources/blob/master/badges/maintained.svg) ## What is it ? This is a [jinja2](http://jinja.pocoo.org/) extension to use [humanize](https://python-humanize.readthedocs.io/) library inside jinja2 templates. ## Syntax The generic syntax is `{{ 'VALUE'|humanize_{humanize_fn}([humanize_fn_args]) }}`. Following [humanize](https://python-humanize.readthedocs.io/) functions are currently mapped: - `naturalsize` - `abs_timedelta` (deprecated with humanize >= 4.0, we keep it for compatibility) - `date_and_delta` (deprecated with humanize >= 4.0, we keep it for compatibility) - `naturaldate` - `naturalday` - `naturaldelta` - `naturaltime` - `precisedelta` - `ordinal` - `intcomma` - `intword` - `apnumber` - `fractional` - `scientific` - `clamp` - `metric` - `activate` - `deactivate` - `thousands_separator` - `decimal_separator` See [humanize](https://python-humanize.readthedocs.io/) documentation for argument details. To take a more real example, let's take the [naturalsize()](https://python-humanize.readthedocs.io/en/latest/filesize/) function. To use it inside a [jinja2](http://jinja.pocoo.org/) template with this extension, you have to use: ``` The file size is: {{ 30000000|humanize_naturalsize(binary=False, gnu=True) }} ``` result content will be : `The file size is : 30.0 MB` You can use the same logic with all supported functions. If you need other functions, feel free to open a PullRequest. ## Installation ``` pip install jinja2-humanize-extension ``` ## Full example ```python from jinja2 import Template, Environment # We load the extension in a jinja2 Environment env = Environment(extensions=["jinja2_humanize_extension.HumanizeExtension"]) template = env.from_string("The file size is : {{ 30000000|humanize_naturalsize() }}") result = template.render() # [...] ``` result content will be : `The file size is : 30.0 MB` ## Contributing guide See [CONTRIBUTING.md](CONTRIBUTING.md) file. ## Code of Conduct See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file. ## Sponsors *(If you are officially paid to work on MetWork Framework, please contact us to add your company logo here!)* [![logo](https://raw.githubusercontent.com/metwork-framework/resources/master/sponsors/meteofrance-small.jpeg)](http://www.meteofrance.com)

Release History

VersionChangesUrgencyDate
0.4.0Imported from PyPI (0.4.0)Low4/21/2026
v0.4.0Release v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.4.0Latest release: v0.4.0Low9/1/2023
v0.3.0Release v0.3.0Low7/13/2023
v0.2.2Release v0.2.2Low10/11/2022
v0.2.1- requires humanize < 4.0.0 - replace deprecated evalcontextfilterLow2/24/2022
v0.2.0Release v0.2.0Low2/16/2021
v0.1.1Release v0.1.1Low2/16/2021
v0.1.0Release v0.1.0Low2/16/2021
v0.0.1Release v0.0.1Low2/16/2021

Dependencies & License Audit

Loading dependencies...

Similar Packages

sphinx-designA sphinx extension for designing beautiful, view size responsive web components.0.7.0
schemathesisProperty-based testing framework for Open API and GraphQL based appsv4.21.1
ctranslate2Fast inference engine for Transformer modelsv4.8.0
cadwynProduction-ready community-driven modern Stripe-like API versioning in FastAPI7.0.0
tqdmFast, Extensible Progress Meterv4.68.1

More in Frameworks

spec_driven_developSpec-Driven Develop is a platform-agnostic AI agent skill that automates the pre-development workflow for large-scale complex tasks. It is not a framework, not a runtime, not a package manager — it is
deer-flowAn open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of ta
tqdmFast, Extensible Progress Meter
simBuild, deploy, and orchestrate AI agents. Sim is the central intelligence layer for your AI workforce.