[Python] How can I save the list of packages used after running "uv run --with...

Discussão em 'Python' iniciado por Stack, Maio 6, 2025.

  1. Stack

    Stack Membro Participativo

    Say I have a script MYSCRIPT.py that imports REQUIRED_PACKAGE. REQUIRED_PACKAGE itself could have other dependencies. How can I save the details of the packages downloaded (e.g. into a lock file) when I run uv run --with REQUIRED_PACKAGE MYSCRIPT.py?

    For a specific example, if I save the following in test.py, I can run it with uv run --with xarray test.py and it says 8 packages were installed. How can I know what these packages (and their versions) are?

    import xarray

    print(xarray.__version__)


    Update: Running uv run with the --verbose flag does provide information about the package used, but this is mixed in with other debugging information.

    Continue reading...

Compartilhe esta Página