
if the selected poetry environment was created for the workspace. It only makes sense to use poetry CLI for installation, activation etc. Our hypothesis is that users likely don’t use poetry environments created for other folders when choosing environment for the current folder (poetry itself doesn’t provide CLI to do that). venv-named folder should not be much expensive, so we use poetry env info command for now. This can automatically be verified using the command.
Poetry configuration allows local virtual environments. venv folder, which automatically validates the toml file. Or we can run poetry env info -p with cwd set to the folder containing. Note we cannot use poetry check command as that also checks parent directories for pyproject.toml files, when we only need to check the current directory. To be more strict, we can parse the toml file using using npm package toml and get the key tool.poetry instead. Read the pyproject.toml and see if contains the string. venv folder is valid and contains a poetry section. If this doesn't work well, we can follow other alternatives mentioned in the spike. Should be a virtualenv/ venv type environment. Our best guess is to use the environment name pattern which Global poetry environments follow, as evident from the code here:. But that is not the case observed with virtual/Poetry environments for now, so we need not use it. Run scripts using poetry CLI: poetry run command can be useful to run scripts if for some reason activating poetry environment doesn't work properly. Besides, we don't need to activate these environments via poetry, as it manages venv/ virtualenv environments which can directly be activated using the pre-existing activation scripts. Activate environment using poetry CLI: poetry shell command is similar to pipenv shell, which has its issues #4404.
Install dev tools using Poetry when related poetry environment is selected.Identify if a provided custom interpreter path belongs to a Poetry environment.Discover environments created using Poetry.Thus adding Poetry support to the extension makes sense. by being an all-in-one tool, and hence is becoming increasingly popular. Poetry attempts to solve problems with all predating tools used to manage Python packages: virtualenv, pip, pipenv, etc. Support for poetry environments is currently our highest upvoted feature request on GitHub.