Skip to content

Commit

Permalink
Add scripts section to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Aug 20, 2024
1 parent f51e1c0 commit a5e7b99
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 single-file scripts](https://docs.astral.sh/uv/guides/scripts), with support for
- ❇️ [Runs single-file scripts](#script-support), with support for
[inline dependency metadata](https://docs.astral.sh/uv/guides/scripts#declaring-script-dependencies).
- 🗂️ Provides [comprehensive project management](#project-management), with a
[universal lockfile](https://docs.astral.sh/uv/concepts/projects#lockfile).
Expand Down Expand Up @@ -175,6 +175,30 @@ Pinned `.python-version` to `[email protected]`
See the [Python installation documentation](https://docs.astral.sh/uv/guides/install-python/) 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 documentation](https://docs.astral.sh/uv/guides/scripts/) to get started.

### A pip-compatible interface

uv provides a drop-in replacement for common `pip`, `pip-tools`, and `virtualenv` commands.
Expand Down

0 comments on commit a5e7b99

Please sign in to comment.