swyddfa/esbonio

[Task] Improve Python interpreter selection step

Opened this issue · 3 comments

The step to choose Python interpreter (in #734 and #735) might be improved so that the user doesn't need to open a Python file and then make selection.

  • Maybe use a status bar icon?
  • Maybe use a prompt during extension initialization?

It would also be lovely if the interpreter could be configured per-folder (with multiple paths, first found is chosen).

We have a documentation project with the following workflow:

  1. Users (who are not writing Python) execute a command that creates a virtual environment.
  2. Then they start Esbonio.
  3. Esbonio defaults to the VSCode-selected interpreter, which is not the virtualenv, and Esbonio breaks.

I assume when you say "per-folder" in this instance you're referring to the configuration associated with a specific project rather than a multi-root workspace? (which the pre-release can now support)

While Esbonio does default to using the interpreter selected via the Python extension, you should be able to override it by setting the esbonio.sphinx.pythonCommand option for the project. A similar setup was possible in the stable version, including using "variables" like ${workspaceFolder} to make the setting machine independent, but I haven't tested this kind of setup in the pre-release version yet so there's a chance not everything has been ported across yet.

What is missing is the ability to provide multiple paths to choose from...

I assume when you say "per-folder" in this instance you're referring to the configuration associated with a specific project

A specific Sphinx project located inside a large monorepo.

What is missing is the ability to provide multiple paths to choose from...

Yeah, this is necessary for supporting both Windows and Linux (we have to use virtualenv for one and venv for the other, so the paths to try are smth like [.virtualenv/Scripts/python.exe, .venv/bin/python]).