Posts
Fatalement
Cancel

How to mock function without typing to not use type ignore

Import only for mypy an internal module If you need to import a module only for mypy, and do not want to create a circular dependency, you can do like that: 1 2 3 4 5 6 7 8 from typing import TYPE...

How to use cache to install python lib with Gitlab CI

If you have a CI process with multiple job that needs to install the same libraries, it can be very time consuming. So you probably want to use a cache to not download each those libraries that you...

Lolcommits

Few months ago, I discovered this really funny repo: lolcommits. It will take a picture of you each time you are making a commit. This is really fun to see how your evolution accross month. How to...

Mock and how to test the arguments

In the case you need to check the parameters with a mock was called. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 from mock import patch @patch('the_function_I_want_to_mock') def test_vanilla_...

My favourite and most useful alias

A few years ago, I discovered this really nice library called youtube-dl. This library allows you to download video from youtube and other platforms. Here is my alias to only download the mp3 and p...

Setup a new github project

When you start a new github repo, just create the folder .github and create these three files, to help you in your day-to-day job: auto_assign.yml pull_request_template.md settings.yml au...

Use MongoDB with Django

We will try to use MongoDB with a Django project. To do that we will use the library called Djongo. I have take the previous project (Django-in-a-docker) and I have removed all files relative to th...

Launch a Django app in a Docker and be ready to put in Production

New year, new resolution, so today I have decided to play a bit with Docker, Django, Gunicorn and Nginx. So first we will create a Django in a Docker with a Postgres DB, and after we will add produ...