Posts tagged: python

All posts with the tag "python"

275 posts latest post 2026-03-31
Publishing rhythm
Feb 2026 | 1 posts

I’ve definitely been missing out on setting up a proper jinja loader on a few projects, I need to lean on this a bit more.

class jinja2.FileSystemLoader(searchpath, encoding='utf-8', followlinks=False): ''' Load templates from a directory in the file system. '''

The path can be relative or absolute. Relative paths are relative to the current working directory.

I love rich inspect. It’s one of my most often used features of rich. It gives you a great human readable insight into python object instances.

>>> from rich import inspect >>> text_file = open("foo.txt", "w") >>> inspect(text_file)

I have a pyflyby entry for it so that I can just run it ang get automatic imports. To not clash with the standard library inspect, which is quite useful on it’s own, I have aliased it to rinspect.

A feature of jinja that I just discovered is including sub templates. Here is an example from the docs.

{% include 'header.html' %} Body goes here. {% include 'footer.html' %}

And inside of my thoughts project I used it to render posts.

<ul id='posts'> {% for post in posts.__root__ %} {% include 'post_item.html' %} {% endfor %} </ul>

note that post_item.html automatically inherits the post variable.

Here is a snippet provided by @tiangolo to store the users jwt inside of a session cookie in fatapi. This was written in feb 12, 2020 and admits that this is not a well documented part of fastapi.

It’s already in place. More or less like the rest of the security tools. And it’s compatible with the rest of the parts, integrated with OpenAPI (as possible), but probably most importantly, with dependencies.

It’s just not properly documented yet. 😞

But still, it works 🚀 e.g.