mirror of https://github.com/astral-sh/uv
Add script support to feature highlights in index (#6251)
This commit is contained in:
parent
81a50dcb08
commit
a988ebe6e7
|
|
@ -22,6 +22,8 @@ See the [guide on installing Python](../guides/install-python.md) to get started
|
|||
Executing standalone Python scripts, e.g., `example.py`.
|
||||
|
||||
- `uv run`: Run a script.
|
||||
- `uv add --script`: Add a dependency to a script
|
||||
- `uv remove --script`: Remove a dependency from a script
|
||||
|
||||
See the [guide on running scripts](../guides/scripts.md) to get started.
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ An extremely fast Python package and project manager, written in Rust.
|
|||
- ⚡️ [10-100x faster](https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md) than `pip`.
|
||||
- 🐍 [Installs and manages](#python-management) Python versions.
|
||||
- 🛠️ [Runs and installs](#tool-management) Python applications.
|
||||
- ❇️ [Runs scripts](./guides/scripts.md), with support for
|
||||
- ❇️ [Runs scripts](#script-support), with support for
|
||||
[inline dependency metadata](./guides/scripts.md#declaring-script-dependencies).
|
||||
- 🗂️ Provides [comprehensive project management](#project-management), with a
|
||||
[universal lockfile](./concepts/projects.md#lockfile).
|
||||
|
|
@ -158,6 +158,30 @@ Pinned `.python-version` to `pypy@3.11`
|
|||
|
||||
See the [installing Python guide](./guides/install-python.md) to get started.
|
||||
|
||||
### Script support
|
||||
|
||||
uv manages dependencies and environments for single-file scripts.
|
||||
|
||||
Create a new script and add inline metadata declaring its dependencies:
|
||||
|
||||
```console
|
||||
$ echo 'import requests; print(requests.get("https://astral.sh"))' > example.py
|
||||
|
||||
$ uv add --script example.py requests
|
||||
Updated `example.py`
|
||||
```
|
||||
|
||||
Then, run the script in an isolated virtual environment:
|
||||
|
||||
```
|
||||
$ uv run example.py
|
||||
Reading inline script metadata from: example.py
|
||||
Installed 5 packages in 12ms
|
||||
<Response [200]>
|
||||
```
|
||||
|
||||
See the [scripts guide](./guides/scripts.md) to get started.
|
||||
|
||||
## The pip interface
|
||||
|
||||
uv provides a drop-in replacement for common `pip`, `pip-tools`, and `virtualenv` commands.
|
||||
|
|
|
|||
Loading…
Reference in New Issue