Image missing.
uv Running a Script with Dependencies

Bluestein

created: July 21, 2025, 11:26 p.m. | updated: July 22, 2025, 12:42 a.m.

Using uv to execute scripts ensures that script dependencies are managed without manually managing environments. argv [ 1 :]))$ uv run example.py test test $ uv run example.py hello world! Unlike with projects, scripts must be explicitly locked using uv lock :$ uv lock --script example.pyRunning uv lock --script will create a .lock file adjacent to the script (e.g., example.py.lock ). Once locked, subsequent operations like uv run --script , uv add --script , uv export --script , and uv tree --script will reuse the locked dependencies, updating the lockfile if necessary. exec_ ())PS> uv run --with PyQt5 example_pyqt.pywTo learn more about uv run , see the command reference.

2 weeks ago: Hacker News: Front Page