Skip to content

[Feature] Add ability to set command to discover the interpreter #1662

Description

@bmarroquin

This would help in the situation where the IDE does not start the LSP with the Virtual Environment activated and where the virtual environment path is not fixed. See #1655

[tool.pyrefly]
# poetry interpreter path is different for all users, use info command instead
# python-interpreter-path=""C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-pyrefly-lsp-Pe66xNAj-py3.13\Scripts\python.exe""
python-interpreter-find-cmd = ["poetry", "env", "info", "-e"]

Alternatively, just specifying the tool that supports a run sub command could make this generic

[tool.pyrefly]
venv_manager  = "poetry | hatch | uv | pipenv"

interpreter = run([venv_manager, "run", "python", "-c", "import sys;print(sys.executable)"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationhelp wantedLarger than "good first issue", but still well-defined and ready for someone to pick up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions