Add support for locking PEP 723 scripts (#10135)

## Summary

You can now run `uv lock --script main.py` to lock a given script
(though as of this PR, the script itself isn't used anywhere).

Closes https://github.com/astral-sh/uv/issues/6318.
This commit is contained in:
Charlie Marsh 2025-01-08 13:36:53 -05:00 committed by GitHub
parent 2f7f9ea571
commit 5d33b94c42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 434 additions and 23 deletions

View file

@ -2135,6 +2135,10 @@ uv lock [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>Lock the specified Python script, rather than the current project.</p>
<p>If provided, uv will lock the script (based on its inline metadata table, in adherence with PEP 723) to a <code>.lock</code> file adjacent to the script itself.</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>