uv python find --script foo.py
— https://github.com/astral-sh/uv/releases/tag/0.6.10— https://docs.astral.sh/uv/reference/cli/#uv-python-find--scr...
uv python find --script foo.py
— https://github.com/astral-sh/uv/releases/tag/0.6.10— https://docs.astral.sh/uv/reference/cli/#uv-python-find--scr...
Let say I have a project in `/home/boumtac/dev/myproject` with the venv inside.
If I run `uv python find --script /home/boumtac/dev/myproject/my_task.py`, will it find the venv ?
Do you have a standalone script or do you have a project? --script is for standalone scripts. You don’t use it with projects.
If you tell it to run a standalone script, it will construct the venv itself on the fly in $XDG_CACHE_HOME.
If you have a project, then it will look in the .venv/ subdirectory by default and you can change this with the $UV_PROJECT_ENVIRONMENT environment variable. If it doesn’t find an environment where it is expecting to, it will construct one.
pyright --pythonpath $(uv python find --script foo.py) foo.py