Skip to main content

TypedJinja

Python companion package for the VSCode extension that adds type safety and LSP features to Jinja2 templates by generating Python stub files (.pyi).

Installation

pip install typedjinja

Usage

1. Annotate Types

In your Jinja2 template, declare variables using an @types block:

{# @types
from mytypes import User
user: User
#}
Hello, {{ user.name }}!

Generate a stub:

python -m typedjinja path/to/sample_template.html

This creates sample_template.pyi alongside your template.

2. Annotate Macros

Use an @typedmacro block to define macro signatures:

{# @typedmacro
one_macro(name: str = "world")
This macro greets a user.
#}
{% macro one_macro(name = "world") %}
  Hello, {{ name }}!
{% endmacro %}

Stub output includes:

def one_macro(name: str = "world"): ...

Examples

Browse samples/templates:

  • sample_template.html for @types
  • another_template.html for @typedmacro

License

MIT

Metadata

Release files for typedjinja 0.1.3

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

Source distribution (sdist)

Source distribution for typedjinja 0.1.3
File Size Uploaded Provenance Actions
typedjinja-0.1.3.tar.gz 9.0 kB Without provenance Details for typedjinja-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for typedjinja 0.1.3
File Interpreter ABI Platform Actions
typedjinja-0.1.3-py3-none-any.whl Python 3 none any Details for typedjinja-0.1.3-py3-none-any.whl

Total release size: 18.4 kB

Release files / typedjinja-0.1.3.tar.gz

Download URL typedjinja-0.1.3.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
733ffbb3835ab0da2cf62a3439b7f2473ddfe9a6290bf6bbf23da69c83b900c8
BLAKE2b-256 checksum
How to use checksums
b339c8f837430f4e211eed27c197b1ef8019b25c6fb439ea57812f72ba4af91f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release files / typedjinja-0.1.3-py3-none-any.whl

Download URL typedjinja-0.1.3-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2073f8bb73440b1aaeb63e4244f74fb24afdcf71b0621cbccb4c9cfa8554913a
BLAKE2b-256 checksum
How to use checksums
4135f79f4047e01e8314e8aa3b96dd8bf800c5f6902dda30b559f1d74d6f2114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Security for typedjinja 0.1.3

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.

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