from hat import rabbit: Hacking your way through Python's import machinery for fun and profit
|Countdown link||Open timer|
Get your finest top hat and dive into the rabbit hole with me for a magic trick like only the best snakes can do: create Python modules out of thin air. We'll import Python modules that don't exist and yet, Presto, here they are.
Inspired by recent work on an open-source library, we wanted a Python framework (Django) to believe there were specific Python modules (migrations) inside a folder that was actually empty. This led us to discover the wonderful world of Loaders and MetaPathFinders and a whole menagerie of objects and methods and calls in the Python import machinery. In this talk, we'll try and recreate the different steps that we went through, and get the opportunity to become friends with the import machinery along the way.
I'm a French Pythonista (he/him), software engineer who started engaging with our dear curlyboi on 2008. I like working on opensource software, I've contributed to bits of the Python Package Index (PyPI) among other projects. I've also spoken at, and/or contributed to organize multiple European Python/Django events. My partner and I live in the city of Poitiers with the top four cutest cats in the world according to us, do you want to see pictures ?