Simple Python [executable] version management, that is.
Another useful Python version manager is asdf
with python plugin. The most helpful feature of asdf is ability to specify what Python version to use in certain directory by simply placing a .tool-versions
file (contains the version number to use) in that directory. This makes working with multiple projects that requires different version of Python very seamless.
Ooh, thanks for mentioning asdf
! I’ve heard of it, but didn’t realize it could that
AFAIU, asdf uses pyenv for its Python plugin, but rtx does it all just a little better.
indeed, worth linking it: https://github.com/jdxcode/rtx
pyenv
also has this with the .python-version
file which will switch versions. And with the plugin, you can use virtualenvs in pyenv so that a .python-version
can be simply: my-cool-project-virtualenv
and switching to that directory automatically switches to it.
I’ve used pyenv
for years and it’s an awesome tool. Keeps python binaries separate and it has a virtualenv
plugin. I’ve gotten others to use it as well.
It works great for library owners who need to run tox/nox on multiple versions of python in test suites. Love it.
I highly recommend rtx over pyenv/asdf. For one thing, you’ll still be able to which python
and get a useful response, as it works by altering your PATH
rather than relinking shims.
I wouldn’t argue that a useful response from which
isn’t a good thing, but how often do you need to use it with Python? I’ve been using pyenv with pipenv for years and almost never need to do this.
How often? Sometimes 🤷.
There are other benefits to the tool that may be more meaningful for your usage, but of course I wouldn’t claim there’s anything wrong with using the tools you like.
I think when I used pyenv it was the single slowest part of my shell initialization.
I found pyenv
to be buggy at times, not properly setting the default (global) python
version. I ultimately uninstalled pyenv
and also uninstalled any additional Python installs outside of the system default.
Now, I do 100% of my Python work inside of Docker containers. This has solved any issues I’ve ever had with Python environments and PYTHONPATH
. It’s also made me a stronger developer when it comes to using Docker.
I don’t see myself ever going back. A Docker container is the perfect Python environment.
I use it everyday. I feel it’s my secret sauce in python dev… pyenv-virtualenv is pretty useful with it also