Some tips on observables
Posted on 2025-06-29 in Trucs et astuces • Tagged with JavaScript
Posted on 2025-06-29 in Trucs et astuces • Tagged with JavaScript
Posted on 2025-06-24 in Programmation • Tagged with Python, Django, Web, JavaScript
HTMX is a JavaScript library designed to add interactivity to your web pages. With it, you don’t build a single page application, you use standard templates (written in Django, Jinja) rendered in your backend, add attributes to your HTML elements and let HTMX add the appropriate interactivity. From what …
Posted on 2025-06-22 in Programmation
SPDX (Software Package Data Exchange) is a project managed by the Linux foundation created to standardize how licenses are identified in a human and machine readable way. In a nutshell, instead of adding a big header to your files to identify the applicable license, you apply a copyright text and …
Posted on 2025-06-09 in Trucs et astuces • Tagged with Python
If you use Python, you probably already know of super to call a method from the base class. You probably also know you can use a function as a method if it takes the instance as 1st parameter. What you cannot do, is call super().my_method() directly in such a …
Posted on 2025-05-24 in Programmation • Tagged with JavaScript, TypeScript
Recently at work, I encountered a problem with a function that should have returned a custom promise subclass. The goal of this subclass is to be able to call a cancel method to cancel some pending action done within the promise and then reject it. It looks like this:
class …
Posted on 2025-05-23 in Trucs et astuces • Tagged with Python, JavaScript, TypeScript
While wandering how to run some tests with JavaScript, I discorvered that deno, a JavaScript runtime like NodeJS, has support for jupyter notebooks thanks to this article. It works perfectly. Install deno (probably available in your distribution repositories), run deno jupyter --install and you are good to go!
To get …
Posted on 2025-04-26 in Programmation • Tagged with Python, Pydantic
In previous articles, I provided some tips on enums and explained how to use a custom class with Pydantic. Now, I’ll dig into all kinds of enum usages with Pydantic, including enums whose members are Pydantic models themselves! Let’s dive right in!
Just like before, you can access …
Posted on 2025-04-21 in Trucs et astuces • Tagged with Python, Pydantic
I’ll give some tips to reuse field and model validators and serializers. All my examples will use validators, but it works exactly the same for serializers.
Assign the validator to a variable like so:
def _is_above_ten(value: int): if value > 10: return value raise ValueError(f"{value …
Posted on 2025-04-19 in Programmation • Tagged with Python, Pydantic
Pydantic is an awesome data validation library for Python. It’s getting very popular these days because it’s fast, has lots of features and is pleasant to use. I’m using it at work and it personal projects. It’s one of the strong points of FastAPI, the new …
Posted on 2025-04-17 in Trucs et astuces • Tagged with Python
You can export a notebook directly from the interface under File > Save and Export Notebook As. You can also do it in CLI with:
jupyter nbconvert --execute --to <FORMAT> my_notebook.ipynb
The --execute will execute the notebook to make sure all output cells are up to date. Many export formats …