pyenv vs asdf: Which Python Version Manager for CI?
pyenv manages Python versions only; asdf manages Python plus every other language from one .tool-versions file.
pyenv is a focused Python version manager that installs and switches interpreters via .python-version. asdf is a multi-language manager that handles Python (via plugin) alongside Node, Ruby, and more in one .tool-versions file.
| pyenv | asdf | |
|---|---|---|
| Languages managed | Python only | Many (plugins) |
| Pin file | .python-version | .tool-versions |
| Best for | Python-only repos | Polyglot repos |
| CI alternative | Often setup-python | One tool for all languages |
| Python build | Compiles interpreters | Via python plugin (pyenv under the hood) |
In CI
For a Python-only repo, pyenv (or GitHub's setup-python reading .python-version) is the lightest path. For polyglot repos, asdf pins Python and every other language in one file - and its Python plugin uses pyenv under the hood, so you get the same interpreters with unified pinning. asdf adds plugin setup but removes the need for several separate managers.
Pin and cache
Commit .python-version or .tool-versions so CI builds the exact local interpreter, and cache built interpreters where possible (compiling Python is slow). The build runs on CI runners; faster managed runners shorten cold interpreter compiles.
The verdict
Python-only repo wanting minimal setup: pyenv (or setup-python). Polyglot repo wanting one tool and pin file for every language: asdf. Commit the version file either way for reproducible CI.