Add --script support to uv tree for PEP 723 scripts (#10159)

## Summary

You can now run `uv tree --script main.py` to show the dependency tree
for a given script. If a lockfile doesn't exist, it will create one.

Closes https://github.com/astral-sh/uv/issues/7328.
This commit is contained in:
Charlie Marsh 2025-01-08 16:32:46 -05:00 committed by GitHub
parent 31b2d3f988
commit 9d5779b68c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 483 additions and 13 deletions

View file

@ -2959,6 +2959,10 @@ uv tree [OPTIONS]
<li><code>lowest-direct</code>: Resolve the lowest compatible version of any direct dependencies, and the highest compatible version of any transitive dependencies</li>
</ul>
</dd><dt><code>--script</code> <i>script</i></dt><dd><p>Show the dependency tree the specified PEP 723 Python script, rather than the current project.</p>
<p>If provided, uv will resolve the dependencies based on its inline metadata table, in adherence with PEP 723.</p>
</dd><dt><code>--universal</code></dt><dd><p>Show a platform-independent dependency tree.</p>
<p>Shows resolved package versions for all Python versions and platforms, rather than filtering to those that are relevant for the current environment.</p>