--- id: jinja2-humanize-extension version: "0.4.0" license: BSD license_treatment: permissive maintenance: active --- # jinja2-humanize-extension — a jinja2 extension to use humanize library inside jinja2 templates License: permissive · Maintenance: active · Downloads: 6.4M/mo ## What it is and what it does This package bridges Jinja2 templating and the humanize library by exposing humanize's formatting functions as Jinja2 filters. Instead of calling humanize functions in Python code before rendering, you can apply them directly in templates using a filter syntax like `{{ value|humanize_naturalsize() }}`. It currently maps functions for file sizes, dates, times, numbers, and localization settings. The extension is lightweight—just two dependencies—and works with current Python versions. It's marked stable and actively maintained, though two functions (abs_timedelta and date_and_delta) are retained for compatibility despite being deprecated in humanize >= 4.0. Use it when you want template-level control over human-readable output formatting without pre-processing values in your application code. Use it for: - Format file sizes in web templates: {{ file.bytes|humanize_naturalsize() }} renders as '30.0 MB'. - Display relative dates and times in UI: {{ event.timestamp|humanize_naturaltime() }} shows relative time. - Localize number formatting in multilingual templates using humanize_thousands_separator() and humanize_decimal_separator(). - Render ordinal numbers in templates: {{ rank|humanize_ordinal() }} produces ordinal forms. - Apply scientific or metric notation to large numbers directly in Jinja2 without backend logic. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds humanize library filters to Jinja2 templates, enabling human-readable formatting of numbers, dates, times, and file sizes directly in template expressions. Yes. Low install friction, no known vulnerabilities, permissive license, and active maintenance make it safe. Install if you use Jinja2 templates and want to apply humanize formatting directly in templates rather than preprocessing values in Python—especially useful for web applications and report generation where template-level control over number and date presentation matters. ## Install pip install jinja2-humanize-extension uv add jinja2-humanize-extension poetry add jinja2-humanize-extension ## Installing jinja2-humanize-extension Before you install: Low friction: pure Python wheel with only two runtime dependencies (jinja2 and humanize). Marked Production/Stable with active maintenance; last commit 2026-07-08. License in practice: BSD permissive license allows commercial and private use with minimal restrictions. Quickstart: from jinja2 import Environment from jinja2_humanize_extension import HumanizeExtension env = Environment(extensions=[HumanizeExtension]) template = env.from_string("{{ 30000000|humanize_naturalsize() }}") print(template.render()) Verify before relying: - Whether all humanize functions remain compatible with humanize >= 4.0 beyond the two explicitly deprecated functions noted in the description. - Performance characteristics when rendering templates with many humanize filters on large datasets. - Exact output format for ordinal numbers and other functions across different locales. ## Package facts - License: BSD (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 6.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags jinja2 humanize filters, human readable formatting templates, jinja2 date time formatting, file size formatting jinja2, number formatting templates, humanize jinja2 extension, natural language template filters, jinja2-extension, template-filters, number-formatting [View on SkillFed](https://skillfed.io/packages/jinja2-humanize-extension) · [View on PyPI](https://pypi.org/project/jinja2-humanize-extension/)