Add --script support to uv export for PEP 723 scripts (#10160)

## Summary

You can now run `uv export --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/8609.

Closes https://github.com/astral-sh/uv/issues/9657.
This commit is contained in:
Charlie Marsh
2025-01-08 16:48:53 -05:00
committed by GitHub
parent 9d5779b68c
commit 18b53c5b45
7 changed files with 400 additions and 53 deletions
+4
View File
@@ -2532,6 +2532,10 @@ uv export [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>Export the dependencies for 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>--upgrade</code>, <code>-U</code></dt><dd><p>Allow package upgrades, ignoring pinned versions in any existing output file. Implies <code>--refresh</code></p>
</dd><dt><code>--upgrade-package</code>, <code>-P</code> <i>upgrade-package</i></dt><dd><p>Allow upgrades for a specific package, ignoring pinned versions in any existing output file. Implies <code>--refresh-package</code></p>