Python adventures: Finding unused dependencies
Introduction This article is about an issue I got a couple of times when working on medium to largish Python projects and having to deploy them. It happens quite often that the dependencies are messy and whoever is, or was working on the project happened to install a bunch of libraries because they needed to add a new feature now. But when deployment comes, we want the environments or containers to be lean for multiple reasons, build time and pipelines latency being some of them....
A tiny script to explore package sizes in Anaconda
Today at work, I was trying to reduce the size of a container image and I wanted to check what’s in some conda environments, especially what packages are taking up all that sweet storage (looking at you Tensorflow). I thought, surely conda has a way to show me the packages and their sizes in general and not just when I install them? But it seems that it doesn’t, so I hacked together something silly with the help of the coreutils and awk....
Building tree-sitter languages for Emacs
Emacs 29 tree-sitter support If you follow Emacs' development, you’ll probably have heard that the upcoming 29 release will have support for tree-sitter, which is an incremental code parser. In short, it provides a syntax tree for the source file that you’re currently viewing. This is especially useful for syntax highlighting as well as code navigation. Since it builds a syntax tree for the language, we can actually get proper highlighting that isn’t regex dependent, Emacs' highlighting strategy for most languages....
Managing and grouping files with Python
Introduction We are sometimes faced with systems which generate lots of files that we have to deal with, be it for triage or later reading; it could be logs, data dumps, automatically generated reports and so on. In many cases, we don’t have a say in the how and why of the files' organization and might want to deal with them automatically, later on. Which is what I’d like to tackle here, using Python standard library....
Python getters and setters
If you have ever worked with a language such as Java, the concept of getter or setter won’t be foreign to you. If you haven’t, getters and setters are methods which let you access and modify class attributes; usually where you wouldn’t have access otherwise because of the restricting scope. It may then come as a surprise that Python, where all members are public, also has a concept of getters, setters and deleters....