One of my first TIL entries was about how you can imitate Node’s node_modules semantics in Python on UNIX-like operating systems. A lot has happened

Python Project-Local Virtualenv Management Redux

submited by
Style Pass
2024-04-03 04:30:13

One of my first TIL entries was about how you can imitate Node’s node_modules semantics in Python on UNIX-like operating systems. A lot has happened since then (to the better!) and it’s time for an update. direnv still rocks, though.

One major thing that happened to Python is uv (have you seen my video about it?) and another thing that “happened” to me is an ARM-based computer and my need to run Python both in Intel and ARM mode which somewhat complicated my life (see also How to Automatically Switch to Rosetta With Fish and Direnv).

I have also embraced the emerging standard of putting a project’s virtual environment into an in-project directory called .venv.

With Astral releasing uv and taking over Rye, I think it’s fair to say that Python packaging and project workflow tools have entered a transitional period. So, it’s unclear how well this post will age. But in the worst case, it will be a historical record once we’re all riding unicorns through the sky.

I also want to stress that I’m not trying to be prescriptive here and instead explain the context in which I’m building my workflows. It’s perfectly possible my workflows are a bad fit for you. But my core believe is that I shouldn’t have to remember anything because I forget everything all the time.

Leave a Comment