Tag: python - Articles:

fpdf2 latest news

I wrote my last post on fpdf2 18 months ago. We released 7 more versions of fpdf2 since then! This article will present some of the major features introduced since v2.7.3 to v2.8.1 of fpdf2: click on the buttons below to reveal the various changes brought …

Read More

Another animated dungeon: The Sky-Blind Spire

Following last week animated PDF adventure, I have been reading a series of one page dungeons... And yesterday I had the opportunity to play the best one in my opinion: The Sky-Blind Spire by Michael Prescott. It has everything I love on one page: a maze to explore, mysteries to …

Read More

Animated one-page-dungeon : Escape of the Torment

Last week, while translating John Harper's micro-TTRPG World of Dungeons: Turbo Breakers, I discovered the wonderful world of one page dungeons, starting with Michael Prescott splendid production at trilemma.com and also the yearly One Page Dungeon Context. While crawling through the OPDC 2021 entries, I discovered a great map …

Read More

fpdf2.5.2 : SVG support and borb

fpdf2 is a simple & fast PDF creation library for Python that I have been maintaining since mid-2020. In this article, I'm going to present some of the new features that landed since my last post on the subject. Hence, this will cover versions 2.5.0, 2.5.1 & 2 …

Read More

Hacktoberfest on fpdf2 & v2.4.6

Last month, I realized late that October was hacktoberfest month! This online event is a month-long celebration (October 1-31) of open source software run in partnership with different software companies, with a focus on encouraging contributions to open source projects. While I participated in the 2019 edition as a contributor …

Read More

Images sous licences libres

Ce blog voit l'apparition d'une nouvelle page permanente : Images libres de droits. Cette page recense des site web, des illustrateurs, des icônes et des polices de caractères libres de droits. Depuis octobre 2018, j'ai rassemblé une liste d'artistes dont j'apprécie le travail et qui placent leurs œuvres sous licence Creative …

Read More

Bonnes pratiques Gitlab CI

À E-voyageurs Technologies, je travaille au sein d'une équipe en charge de l'usine logicielle, qui administre depuis plusieurs années une instance Gitlab self-hosted. Cet article contient quelques-unes de nos recommandations à l'intention des utilisateurs de notre Gitlab, ayant pour but à la fois améliorer les performances de leurs pipelines …

Read More

World map of an open-source project contributors

I have been amazed recently at the diversity of contributors on the fpdf2 project, coming from all around the world! Then I thought it would be nice to visualize this diversity by building a world map of all contributors locations. There it is: Click on the image to access an …

Read More

Live demo for Hesperides!

Today I finally took the time to put up a live demo website for Hesperides! https://hesperides.herokuapp.com Hesperides is an open source tool dedicated to configuration management: it stores applications properties and mustache templates for configurations files. It is strongly hierarchized based on few main concepts: modules, applications …

Read More

fpdf2.4.0 and converting GIFs to PDFs

fpdf2 is a minimalist PDF creation library for Python that I am maintaining. With the release yesterday of its v2.4.0, I'm going to present some of its notable new features since the latest minor version. https://github.com/pyfpdf/fpdf2/ Doc: https://pyfpdf.github.io/fpdf2/ JPEG images …

Read More

Undying Dusk : a PDF video game

Undying Dusk is a video game in a PDF format, with a gameplay based on exploration and logic puzzles, in the tradition of dungeon crawlers. A curse set by the Empress keeps the world in an eternal dusk. You have recently found shelter in an eerie monastery. Featuring: ~ 200 000 …

Read More

fpdf2.3.0 Unbreakable! and PDF quines

Today, I am happy to announce version 2.3.0 of fpdf2, code name: Unbreakable! https://github.com/pyfpdf/fpdf2/ Doc: https://pyfpdf.github.io/fpdf2/ Why Unbreakable? As a tribute to M. Night Shyamalan movie Because using fpdf2, your Python code can never break! ... Just kidding, I would be …

Read More

fpdf2 release 2.2.0

Today, I am happy to announce a new version 2.2.0 of fpdf2 ! https://github.com/pyfpdf/fpdf2/ Doc: https://pyfpdf.github.io/fpdf2/ During the last few months, I contributed a few improvements to fpdf2, David Ankin fork of PyFPDF, the user-friendly Python library to generate PDFs: from …

Read More

Pelican, Pingback and Webmentions

Linkback protocols are an old breed. They were born in a time where MySpace, Wikipedia & WordPress had just been launched, and Friendster was more popular than this new website called Facebook. Diagram source: PPRuNe article on linkbacks The latest linkback protocol, Webmention, is relatively recent though, as it became a …

Read More

Using python requests-futures to crawl all jobs on a Jenkins 4 times faster

At work, we needed to retrieve the full list of jobs a given Jenkins instance was hosting. Our first solution was to use the jenkinsapi Python package: import xml.etree.ElementTree as XmlElementTree from jenkinsapi.jenkins import Jenkins def get_all_jenkins_jobs(server_url): jenkins = Jenkins(server_url, lazy=True, timeout=30, username=os …

Read More

GitHub project statistics and Python interactive coding

Iframes not supported. Click on the link below to access the graphs. The iframe above displays some graphs I've built last week, in order to get some insight on some GitHub projects issues & pull requests evolution. They are directly inspired by nf-core project activity statistics. Click here to open those …

Read More

Listing all GitHub security alerts of a user's projects using GraphQL and Python

Almost a year ago, GitHub introduced security alerts. They are an awesome feature. They function as notifications you receive whenever a vulnerability affecting one of your project dependencies. But long after receiving a notification, how to list all security alerts affecting your repositories ? I didn't found an out-of-the box solution …

Read More

Traduction du Temple du Non, une histoire interactive Twine du studio Crows Crows Crows

Crows Crows Crows est un studio de jeu vidéo créé en 2015, à l'origine entre autres du jeu complètement déjanté Dr. Langeskov, The Tiger, and The Terribly Cursed Emerald: A Whirlwind Heist et le créateur du studio, William Pugh, est également un des auteurs de The Stanley Parable. En 2016 …

Read More

Displaying chained exceptions stacktraces in Python 2

At work we have a component not yet migrated to Python 3, and we recently had some difficulties diagnosing a problem with the MySQL connector. Because we were catching the mysql.connector.errors.Error and raising a custom exception, we were loosing the underlying stacktrace and hence couldn't troubleshoot the …

Read More

Python module imports visualization

flask httpie requests simplejson botocore scrapy docker-compose ansible What are those diagrams ? They show dependencies between the internal modules of various well-known Python libraries. They goal is to provide a global overview of a Python project architecture, as a map of modules & packages, the top-level code abstractions. Note that all …

Read More

Free alerting-as-a-service drop-in replacement for mail command

On my personnal server, I used to send myself alerts by email using the handy standard mail command. However, recently it appeared that my server became categorized as "spammer" by some online service providers, due to the alerts frequency (a little bit more than one per day). Hence, I got …

Read More

Certification développeur RGAA Access42

Connaissez-vous l'accessibilité numérique ? En très bref: L'accessibilité numérique est la mise à la disposition de tous les individus, quels que soient leur matériel ou logiciel, leur infrastructure réseau, leur langue maternelle, leur culture, leur localisation géographique, ou leurs aptitudes physiques ou mentales, des ressources numériques. Pour plus de détails …

Read More

Compte-rendu de la PyConFr 2017

Cette année, voyages-sncf.com m'a permis d'aller à la conférence annuelle Python à Toulouse. En vrac, voici un petit résumé personnel de cette PyConFr. J'y étais présent 3 jours sur 4 (sprint le premier et conférences les deux autres), et j'y ai donné donné 2 présentations, dont le contenu est …

Read More

Extracting setup_requires dependencies out of a setup.py

I ended up not using this code, but it may be useful to others: mock_setup_provider.py: import sys from unittest.mock import Mock class MockSetupProvider(Mock): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.captured_setup_requires = set() def setup(self, *args, **kwargs): self.captured_setup_requires.update(kwargs.get('setup_requires')) setup_extractor …

Read More

Python gevent terrible failure mode under Windows

What do you think of the following innocuous Python code ? from gevent import monkey monkey.patch_all(thread=False, select=False) import requests requests.get('http://i-do-not-exist.com') print('THIS WILL NEVER BE PRINTED !!!') Guess what ? The string message will never get printed :( Simply remove the monkey.patch_all line and you'll …

Read More

Rendering deep text-based mindmaps with WiseMapping and Python

In this blog post, I'm going to demonstrate how to reuse WiseMapping HTML+JS rendering engine to easily visualize... text-based mindmaps like this one have many benefits they are readable as-it-is they don't require any tool to be edited [they follow the UNIX tenets](http://www.ru.j-npcs.org/usoft …

Read More

Solarized mindmaps with Python and graphviz

This week I wrote a small Python script, that can generate a mindmap from a simple indented text input like this: Winter december january february Spring march april may Summer june july august Autumn september october november The command: ./graphviz_mindmap.py seasons.txt. The results, with various layout parameters: Another …

Read More

Battledev de RegionJobs : Python vs Java

En mars dernier, j'ai participé à la Battledev de RegionJobs. Et c'était super fun. Pour ceux qui ne connaissent pas, c'est une compétition de programmation en ligne, où l'on doit résoudre 5 questions de difficulté croissante en 2 heures. J'ai eu l'occasion d'y participer avec quelques collègues, et ça a …

Read More

Intro à Python & les frameworks web

Le mois dernier j'ai rapidement présenté le language Python et les frameworks web existants à mon équipe à Voyages-Sncf.com. Les slides sont accessibles ici, ainsi que les sources Markdown pour Reveal.js. Iframes non supportées. Cliquez sur le lien dans le paragraphe au-dessus pour accéder directement aux slides. Il …

Read More

Colored diff output with Python

Say you are generating a colored diff output with the standard difflib Python package: diff = difflib.ndiff(file1_lines, file2_lines) print('\n'.join(diff)) Now, I'll show you how to write a simple color_diff function that you can use to color your diff like this: diff = difflib.ndiff(file1_lines, file2_lines) diff …

Read More

youtube_playlist_watcher

Depuis plusieurs années, je ruminais contre Youtube: chaque fois qu'une vidéo est supprimée d'une playlist (parce que l'utilisateur qui l'avait uploadé l'a supprimé par exemple), son nom n'est même pas conservé, seul un lien mort persiste dans la liste. Et la seule solution est alors de googler le nom de …

Read More

God I hate Java Regex API

Pourquoi, mais pourquoi faut-il 3 lignes en Java pour juste extraire un groupe d'une expression régulière qui "match" ??? Matcher matcher = Pattern.compile("o?k(b|i)s+").matcher("kiss"); matcher.matches(); assert matcher.group(1) == "i"; En Python: assert re.match("o?k(b|i)s+", "kiss").group(1) == "i …

Read More

Django tips & tricks

I recently worked on a short website project using Django & Heroku. It was my very time using this Python framework, and I really liked it ! This is a compendium of tips & tricks that I, as a Django beginner, found quite useful : Django enhanced shell To install it : pip install django-extensions …

Read More

Convert source code to PDF with syntax coloring

Sometimes, it's useful to print some source code on paper. And PDF is a very common file format, that you can be sure your printer will accept, and that will let you preview the final page layout. But how to quickly perform syntax-coloring and export to PDF ? I've been experimenting …

Read More

Replicating PHPSESSID and srctoken session authentication with mitmproxy

A month ago, I wanted to automate queries to a website that is using the PHPSESSID cookie to keep track of sessions. I struggled a lot and couldn't find any documentation covering the behaviour I was observing. But yesterday I finally found a solution ! In hope it could help others …

Read More

Python 3 non consistent set & dict iteration gotcha

Consider the following Python expression: print("".join(set("ABCDE"))) What do you think it produces ? Not necessarily "ABCDE". Right, but you would expect the result to be consistent, isn't it ? $ for i in {1..3}; do python2.7 -c 'print("".join(set("ABCDE")))'; done ACBED ACBED ACBED Great ! ... But with …

Read More

Mimicking testling HTML rendering of TAP javascript tests

This post is only relevant to you if you use browserify. For a good introduction to this powerful Javascript bundling tool, check this doc. First of all, I'd like to take my hat off to James Hallyday and Peteris Krumins who have built such amazing tools as browserify, testling and …

Read More