Skip to content

pyvenv.cfg generated by pants export makes ty to fail #430

@achimnol

Description

@achimnol

Summary

When using Pantsbuild, I use pants export to auto-create virtualenvs for a dependency set.
The virtualenv created by it contains pyvenv.cfg like:

home = /home/joongi/.pyenv/versions/3.13.3/bin
include-system-site-packages = false
version = 3.13.3
prompt = 'python-default/3.13.3'
executable = /home/joongi/.pyenv/versions/3.13.3/bin/python3.13
command = /home/joongi/.pyenv/versions/3.13.3/bin/python3.13 -m venv --without-pip --prompt="python-default/3.13.3" /home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3

After activating this virtualenv, uvx ty check currently fails with:

ty failed
  Cause: Invalid search path settings
  Cause: Failed to discover the site-packages directory: Failed to parse the pyvenv.cfg file at /home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3/pyvenv.cfg because line 6 has too many '=' characters

If I apply the following patch to pyvenv.cfg, replacing = with a space in the command's arguments:

@@ -3,4 +3,4 @@
 version = 3.13.3
 prompt = 'python-default/3.13.3'
 executable = /home/joongi/.pyenv/versions/3.13.3/bin/python3.13
-command = /home/joongi/.pyenv/versions/3.13.3/bin/python3.13 -m venv --without-pip --prompt="python-default/3.13.3" /home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3
+command = /home/joongi/.pyenv/versions/3.13.3/bin/python3.13 -m venv --without-pip --prompt "python-default/3.13.3" /home/joongi/bai-edge/dist/export/python/virtualenvs/python-default/3.13.3

uvx ty check runs fine.

Since Python works without any issue with this virtualenv, ty's pyvenv.cfg parsing should allow this case as well.

Version

ty 0.0.1-alpha.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions especially welcomeimportsModule resolution, site-packages discovery, import-related diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions