pypi django-components 0.145.0

7 hours ago

What's Changed

Perf

Rendering components is now ~20% faster, thanks to:

  • using Rust-based template tag parsing
  • skipping eager input validation in favour of on-exception handling

Feat

  • BaseNode class now has the filters and tags attributes. These dictionaries keep track of what filters and tags can be used within the {% %} tag.

    Extensions can use these attributes to add custom filters and tags to the tag.

Refactor

  • In template, when a component tag has a positional argument
    after a keyword argument it now raises SyntaxError instead of TypeError.

    {% mytag 'John' msg='Hello' 123 %}
  • When a component tag receives multiple kwargs with the same name, it no longer raises TypeError.

    Instead, the later kwargs overwrite the earlier ones.

    {% mytag 'John' x=123 x=456 %}
  • All template tags ({% component %}, {% slot %}, etc.) now include the exact tag (as found in the template) in the error message when an error occurs:

    TypeError: Error in mytag: missing 1 required keyword-only arguments: 'msg'
        1 | {% mytag 'John' %}
            ^^^^^^^^^^^^^^^^^^
  • When creating custom template tags with BaseNode class or @template_tag decorator, you now get an error when
    the tag name is the same as one of the flags:

    class SlotNode(BaseNode):
        tag = "slot"
        allowed_flags = ["slot"]  # Raises!

Full Changelog: 0.144.0...0.145.0

Don't miss a new django-components release

NewReleases is sending notifications on new releases.