Other articles


  1. Renaming files using Python script

    Lately, I wanted to rename lot of files and directories on my personal server, in particular media like TV Shows episodes. As there was lot of files I decided to look for an UNIX command to ease my burden. Unfortunately, I could not find such command on my server (a Synology NAS) and was unable to figure out how to install additional packages on it so I decided to build my own rename command using a Python script.

    read more
  2. On the importance of naming in programming

    I heard about the importance of naming in programming a couple years ago while reading Uncle Bob's Clean Code book. But I found this article to provide interesting examples as well as some nice tips on how to help you actually naming things. It also emphasis on the fact that names heavily depends on context and can actually highlight "bad code" in some ways.

    read more
  3. Execute a function until a specific value is returned

    I had barely no idea that the iter function could do that in Python. You can call it with two arguments, a function and a stop value, and have your function being executed until the stop value is returned. It can have some interesting usages, as shown in the article. I would not use it all over the place because it looks like a bit dark magic but still a nice tool to keep in mind.

    read more
  4. 10 Python programming optimisation techniques.

    In this article, the author provide some interesting techniques for optimising Python code, in particular, memory consumption for cases where memory is critical or resources are limited. I would personally not apply all those techniques by default and reserve them for specific use cases, preferring readability in a first place. Still, those techniques are interesting to have in mind.

    read more
  5. Integrating Problem Details RFC with FastAPI

    During my past development projects, I built a lot of HTTP APIs using various langages (TypeScript, JavaScript, Python) and frameworks (fastify, FastAPI, flask, express). One thing I've noticed is that each of those frameworks have their own way of shaping HTTP error responses. This is actually not a big deal considering that most clients (i.e: HTTP clients) do not really rely on strict structure for such errors.

    read more
  6. Testing Python code integration with an Azure Eventhub

    On one of my project I needed to create a simple API allowing clients to publish some messages into an Azure EventHub. Because authentication is ensured by a JWT we could not rely on our clients to directly publish messages to the Eventhub (and by the way I prefer abstracting this away through a HTTP API).

    read more
  7. One way to fix Python circular imports

    I've already encountered issues regarding circular imports, most of the time it was related to typings only (two modules referencing types from each others) and is easily resolved using a if TYPE_CHECKING: block. For other cases I try my best to shape my modules in a way that it does not require circular imports. In the following article I discovered another way to overcome circular imports that I could not have think about simply by defering imported names lookup.

    read more

Projects

social