Ludochaordic
Fantaisies programatico-ludiques

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

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

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