Skip to content

ty does not respect VIRTUAL_ENV and TY_PYTHON environment variable #2794

@morotti

Description

@morotti

Summary

Hello,

Trying to run ty but it's refusing to use the venv.
The venv is correctly set with the VIRTUAL_ENV variable.
Trying to set TY_PYTHON to specify the location but that doesn't work either.

(note that I filled a similar ticket in uv nearly 2 years ago and you added a UV_PYTHON environment variable to uv).

related: the doc could use some clarification whether the python setting should be a python executable or a directory or something else (both seem to work).

$ ty check tests/unit
ty failed
  Cause: Failed to discover local Python environment
  Cause: Invalid `VIRTUAL_ENV` environment variable `/turbo/rmorotti/pyenvs/man.core.311`: points to a broken venv with no pyvenv.cfg file
  Cause: No such file or directory (os error 2)


$ ty check --python=$VIRTUAL_ENV tests/unit
Checking ------------------------------------------------------------ 634/893 files         
...


$ ty check --python=$VIRTUAL_ENV/bin/python3 tests/unit
Checking ------------------------------------------------------------ 682/893 files        


$ TY_PYTHON=$VIRTUAL_ENV ty check tests/unit
ty failed
  Cause: Failed to discover local Python environment
  Cause: Invalid `VIRTUAL_ENV` environment variable `/turbo/rmorotti/pyenvs/man.core.311`: points to a broken venv with no pyvenv.cfg file
  Cause: No such file or directory (os error 2)

Cheers.

Version

0.0.16 (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationRelated to settings and configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions