Simon Willison’s Weblog

Subscribe

March 2018

31 posts: 1 entry, 21 links, 7 quotes, 2 beats

March 29, 2018

import-pypi. A devious Python 3 hack which abuses importlib.machinery to add a hook such that any time you type “import modulename” it checks to see if the module is installed and runs “pip install modulename” first if it isn’t. Intended as a joke, but if you habitually fire up temporary virtual environments for exploratory programming like I do this could actually be a neat little time-saver.

# 10:16 pm / pypi, python, virtualenv

2018 » March

MTWTFSS
   1234
567891011
12131415161718
19202122232425
262728293031