pyenv-poetry-virtual-envlisted
Install: claude install-skill Voronenko/ai-files
# Working with virtual environments
## Detect path to needed for virtual environment python version
Usually project team specifies which version of python is used by project.
path might be provided in environment variable PROJECT_BASE_PYTHON_PATH, or in project info files,known to you.
If not possible, but you know python version from project docs, check installed python versions via command
```bash
pyenv versions --bare | grep -E '^[0-9]+(\.[0-9]+)*$'
```
having found python version, like for VERSION=3.9.15, path to python will be `$(pyenv root)/versions/3.9.15/bin/python`
## Working with python versions
There are two approaches.
### Poetry controlled virtual environment
1. when you are asked to create virtual environment managed by poetry with specific python version, you need to provide path to the python executable with
poetry env use <path to python>. If not specified, system python will be used, which is not optimal.
Use "Detect path" section to get path to the python version to use, once you have
validate `python --version` on this path to validate, that you've selected proper version and path
After that use command
`poetry env use <PROJECT_BASE_PYTHON_PATH>` to create new virtual environment based on custom project version.
### pyenv controlled virtual environment
When you are asked to create virtual environment, controlled by pyenv:
Step 1. Detect python version, PYVER check if pyenv versions lists this version
Step 2: Choose a Python version, check