mirror of https://github.com/astral-sh/uv
Use `uv add --script` in guide (#6215)
This commit is contained in:
parent
a1f98e240a
commit
39c3c01f0c
|
|
@ -119,8 +119,14 @@ Python recently added a standard format for
|
|||
[inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata).
|
||||
This allows the dependencies for a script to be declared in the script itself.
|
||||
|
||||
To use inline script metadata, include a `script` section at the top of the script and declare the
|
||||
dependencies using TOML:
|
||||
uv supports adding and updating inline script metadata for you. Use `uv add --script` to declare the
|
||||
dependencies for the script:
|
||||
|
||||
```console
|
||||
$ uv add --script example.py 'requests<3' 'rich'
|
||||
```
|
||||
|
||||
This will add a `script` section at the top of the script declaring the dependencies using TOML:
|
||||
|
||||
```python title="example.py"
|
||||
# /// script
|
||||
|
|
|
|||
Loading…
Reference in New Issue