I recently converted this blog to Pelican, a Python powered static site generator.
On the way I added a few customizations.
One customization is a Jinja template filter to truncate a post’s HTML as a summary, using Python’s
Here’s how I wrote it.
pip install will flag a warning saying “The candidate selected for download or install is a yanked version”.
For example, if we install attrs version 21.1.0:
Many languages follow the syntax of C, and use semicolons to indicate the end of a statement.
Take this function:
Django deprecates a small list of features with every feature release, requiring us to update our projects, which can be monotonous.
Today I’m announcing a new tool I’ve created, django-upgrade, that automates some of this drudgery for us all.
When Lambda@Edge first came out, I added it to my blog’s CloudFront distribution in order to add security headers.
Black is the de facto standard code formatter for Python, and these days I use it on all my projects.
blacken-docs is a tool that also allows you to apply Black to code samples in your docs.
I recently rolled it out on my projects to great effect.
I started this blog in 2014 using the popular Jekyll.
Whilst it served me well, I’ve wanted to migrate to a Python-based tool for a while now, for a few reasons:
Writing type hints gives us some familiarity with the
But Python also includes the similarly-named
types module, which can also come in handy.
Let’s look at the history of these two modules, some use cases of
types, and one way in which it’s not so useful.
re module lets us search both
bytes strings with regular expressions (regexes).
Our type checker can ensure we call
re functions with the correct types, thanks to some parametrized classes.