From 39c3c01f0c57667abd2810dc8928f37f11372722 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 19 Aug 2024 17:47:17 -0500 Subject: [PATCH] Use `uv add --script` in guide (#6215) --- docs/guides/scripts.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/guides/scripts.md b/docs/guides/scripts.md index 2af99db18..3ab513df7 100644 --- a/docs/guides/scripts.md +++ b/docs/guides/scripts.md @@ -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