Missing type annotation for FILTERS
Author: GabgobieCreated Oct 10, 2025Updated Feb 23, 2026
When using Jinja2 with filters, Pylance is screaming at me because Environment.filters is partially unknown.
Environment.filters is copied from here: https://github.com/pallets/jinja/blob/5ef70112a1ff19c05324ff889dd30405b1002044/src/jinja2/filters.py#L1812
FILTERS does not have a type annotation.
You already defined a TypeVar for the expected signature here:
Is there a specific reason to leave out the annotation? I'd be happy to submit a PR.
# Suggested code
FILTERS: dict[str, F] = {Best, Gab
Environment:
- Python version: 3.12
- Jinja version: 3.1.6
- I searched for other issues with the keywords
typeandfilter - I tested the suggested changes locally by modifying jinja in my venv
Source: pallets/jinja