RSSAmplifier

Blog

Lily's Blog

Recent content on Lily's Blog

blog.lilyf.orgRSS feed ↗5 posts

Latest posts

Quirks in Django's template language part 3

Django Rusty Templates Since September 2024, I (and some collaborators) have been building a reimplementation of Django’s templating language in Rust, called Django Rusty Templates . During this process, we have discovered several weird edge-cases and bugs, some of which I’ve talked about before ( Part 1 , Part 2 ). The {% now %} tag The {% now %} tag is provided by Django to display…

Sharing a mutable reference with Python

Background As part of my ongoing project to reimplement Django’s templating language in Rust, I have been adding support for custom template tags . Simple tags The simplest custom tag will look something like: # time_tags.py from datetime import datetime from django import template register = template . Library() @register.simple_tag def time (format_string): now = datetime . now() return…

Quirks in Django's template language part 2

Django Rusty Templates Since September 2024, I have been building a reimplementation of Django’s templating language in Rust, called Django Rusty Templates . During this process, I have discovered several weird edge-cases and bugs, some of which I’ve talked about before . Centring strings Django supports a template filter for centring strings: {{ "Django"|center:10 }} which adds…

Quirks in Django's template language

Django Rusty Templates Since September 2024, I have been building a reimplementation of Django’s templating language in Rust, called Django Rusty Templates . During this process, I have discovered several weird edge-cases and bugs. Scientific notation Django supports writing floats in scientific notation (e.g. 6.28e23 ) in templates. However using a negative exponent was not supported: '{{…

How we reduced the memory usage of our Rust extension by 4x

This post was originally published on the Kolo Blog and has been republished here with thanks to Wil Klopp. What is Kolo? Kolo is a dynamic code analysis tool for Python. We use Python’s sys.setprofile to introspect Python’s call stack and local variables. For performance reasons, Kolo is partially implemented in Rust using the excellent PyO3 crate . The bug report Recently, we…