Mike Zamansky is using some of his newfound free time to learn more about AI. He’s going through Andrew Ng’s Coursera ML class, which requires working in Python. Zamansky used to do a lot of Python but has recently switched to Clojure as his go to language. From his previous Python work, he’s familiar with the idea of virtual Python environments and wanted to upgrade his workflow.
In this latest video he talks about Conda and Direnv to help automate his Python workflow. Conda lets you set up separate environments for such things as the Python version and the packages available to it. This is really handy if you have several different Python projects going on or you want to replicate the environment of someone else’s project.
Of course, you still have to activate the appropriate environment before you start working in it. That’s where Direnv comes in. The idea is that you put a special file in the directory of your project and it will set up whatever environment you need when you enter the directory. It can, for example, activate a Conda environment but it’s more general and not really tied to Python. You can use it anytime you want to automatically set up an environment.
You can get all the details from Zamansky’s post and the associated video. It looks as if Direnv can be a little fussy to set up but he has links to his configuration to help you get going. The video is 15 minutes, 20 seconds long, so you’ll have to set some time aside but, as usual, it’s worth your time. Even if you aren’t using Python, you may find that Direnv can ease your workflow.