Member-only story
Manage Python Environments using both ASDF and Poetry
In the world of Python development, managing different project environments can be a challenging task. This is where tools like ASDF and Poetry come into play. ASDF is a versatile runtime version manager that can handle multiple Python versions, while Poetry is a robust Python dependency manager specifically designed to manage Python packages.
TL;DR: The article outlines steps for installing ASDF, setting it up for different operating systems, and using it to install various Python versions. It also covers setting a global Python version and testing it. Additionally, the article introduces Poetry as a tool for managing project dependencies and packaging, with instructions on how to use it alongside ASDF.
Install and Setup ASDF
ASDF is a versatile runtime version manager that allows you to manage all your Python versions with one tool! You can run Python versions 3.8.x, 3.9.x, 3.10.x, 3.11.x, and 3.12.x on the same machine without any conflict.
1. Install ASDF
Installing ASDF is pretty straight forward. It just requires three steps:
- Install dependencies
- Install ASDF
- Configure your shell
It is all documented here -> https://asdf-vm.com/guide/getting-started.html
For Ubuntu (i.e., Windows WSL2), you can:
- Install dependencies
sudo apt install curl git
2. Install ASDF
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
3. Configure your shell — for example, the Bash shell — by adding the necessary lines to the ~/.bashrc
file at the end.
. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"
For macOS, you can:
- Install dependencies
brew install coreutils curl git
2. Install ASDF
brew install asdf
3. Configure yopur shell — for example, the Z shell — adding the necessary line to…