-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script support to feature highlights in index
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 `[email protected]` | |
|
||
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. | ||
|