Skip to content

Commit

Permalink
Make some minor tweaks to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 5, 2024
1 parent 6a80f17 commit 9ba2bb7
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 31 deletions.
36 changes: 26 additions & 10 deletions docs/concepts/dependencies.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# Specifying dependencies

In uv, project dependency specification is divided between two `pyproject.toml` tables:
`project.dependencies` and `tool.uv.sources`.
In uv, project dependencies are declared across two `pyproject.toml` tables: `project.dependencies`
and `tool.uv.sources`.

`project.dependencies` is used to define the standards-compliant dependency metadata, propagated
when uploading to PyPI or building a wheel. `tool.uv.sources` is used to specify the _sources_
required to install the dependencies, which can come from a Git repository, a URL, a local path, a
different index, etc. This metadata must be expressed separately because the `project.dependencies`
standard does not allow these common patterns.
`project.dependencies` defines the standards-compliant dependency metadata, propagated when
uploading to PyPI or building a wheel.

`tool.uv.sources` enriches the dependency metadata with additional sources, incorporated during
development. A dependency source can be a Git repository, a URL, a local path, or an alternative
registry.

`tool.uv.sources` enables uv to support common patterns like editable installations and relative
paths that are not supported by the `project.dependencies` standard. For example:

```toml title="pyproject.toml"
[project]
name = "albatross"
version = "0.1.0"
dependencies = [
"bird-feeder",
]

[tool.uv.sources]
bird-feeder = { path = "/path/to/bird-feeder" }
```

## Project dependencies

Expand Down Expand Up @@ -40,12 +56,12 @@ dependencies = [
```

If the project only requires packages from standard package indexes, then `project.dependencies` is
sufficient. If, the project depends on packages from Git, remote URLs, or local sources,
`tool.uv.sources` is needed.
sufficient. If the project depends on packages from Git, remote URLs, or local sources,
`tool.uv.sources` can be used to enrich the dependency metadata.

## Dependency sources

During development, the project may rely on a package that isn't available on PyPI. The following
During development, a project may rely on a package that isn't available on PyPI. The following
additional sources are supported by uv:

- Git: A Git repository.
Expand Down
2 changes: 0 additions & 2 deletions docs/first-steps.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# First steps with uv

uv only provides a command-line interface and must be used from a terminal.

After [installing uv](./installation.md), you can check that uv is available by running the `uv`
command:

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/install-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ system. If you've previously installed Python with uv, a new version will not be

!!! note

Python does not publish official distributable binaries so uv uses third-party distributions from the [`python-build-standalone`](https://github.com/indygreg/python-build-standalone) project. The project is partially maintained by the uv maintainers and is used by many other Python projects. See the [Python distributions](../concepts/python-versions.md#python-distributions) documentation for more details.
Python does not publish official distributable binaries. As such, uv uses third-party distributions from the [`python-build-standalone`](https://github.com/indygreg/python-build-standalone) project. The project is partially maintained by the uv maintainers and is used by other prominent Python projects (e.g., [Rye](https://github.com/astral-sh/rye), [Bazel](https://github.com/bazelbuild/rules_python)). See the [Python distributions](../concepts/python-versions.md#python-distributions) documentation for more details.

<!-- TODO(zanieb): Restore when Python shim management is added
Note that when an automatic Python installation occurs, the `python` command will not be added to the shell. Use `uv python install-shim` to ensure the `python` shim is installed.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/integration/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

uv installation differs depending on the platform.

### on Unix
### Unix

```yaml title="example.yml"
name: Example on Unix
Expand All @@ -22,7 +22,7 @@ jobs:
run: curl -LsSf https://astral.sh/uv/install.sh | sh
```
### on Windows
### Windows
```yaml title="example.yml"
name: Example on Windows
Expand Down
10 changes: 7 additions & 3 deletions docs/guides/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This will create the following directory structure:
├── pyproject.toml
├── README.md
└── src
└── hello-world
└── hello_world
└── __init__.py
```

Expand Down Expand Up @@ -124,8 +124,12 @@ more details.

## Running commands

`uv run` can be used to run arbitrary scripts or commands in your project environment. This ensures
that the lockfile and project environment are up-to-date before executing a given command.
`uv run` can be used to run arbitrary scripts or commands in your project environment.

Prior to every `uv run` invocation, uv will verify that the lockfile is up-to-date with the
`pyproject.toml`, and that the environment is up-to-date with the lockfile, keeping your project
in-sync without the need for manual intervention. `uv run` guarantees that your command is run in a
consistent, locked environment.

For example, to use `flask`:

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ uvx ruff
$ uv tool run ruff
```

`uvx` is provided as a short alias since the operation is very common.
`uvx` is provided as an alias for convenience.

Arguments can be provided after the tool name:

Expand Down
16 changes: 10 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ An extremely fast Python package and project manager, written in Rust.

## Highlights

- 🚀 A single tool to replace `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`, `virtualenv`, and more.
- ⚡️ [10-100x faster](https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md) than `pip`.
- 🐍 [Installs and manages](./guides/install-python.md) Python versions.
- 🛠️ [Runs and installs](./guides/tools.md) Python applications.
- ❇️ [Runs scripts](./guides/scripts.md), with support for
[inline dependency metadata](./guides/scripts.md#declaring-script-dependencies).
- 🗂️ Provides [comprehensive project management](./guides/projects.md), with a
[universal lockfile](./concepts/projects.md#lockfile).
- 🏢 Supports Cargo-style [workspaces](./concepts/workspaces.md) for scalable projects.
- 🚀 A replacement for `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`, `virtualenv`, and more.
- ⚡️ [10-100x faster](https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md) than `pip` and
`pip-tools` (`pip-compile` and `pip-sync`).
- 💾 Disk-space efficient, with a [global cache](./concepts/cache.md) for dependency deduplication.
- ⏬ Installable without Rust or Python via `curl` or `pip`.
- 🖥️ Supports macOS, Linux, and Windows.
Expand Down Expand Up @@ -54,7 +53,8 @@ Then, check out the [first steps](./first-steps.md) or read on for a brief overv

## Project management

uv manages project dependencies and environments:
uv manages project dependencies and environments, with support for lockfiles, workspaces, and more,
similar to `rye` or `poetry`:

```console
$ uv init example
Expand Down Expand Up @@ -158,11 +158,15 @@ See the [installing Python guide](./guides/install-python.md) to get started.

## The pip interface

uv provides a drop-in replacement for common `pip`, `pip-tools`, and `virtualenv` commands. uv
extends their interfaces with advanced features, such as dependency version overrides,
uv provides a drop-in replacement for common `pip`, `pip-tools`, and `virtualenv` commands.

uv extends their interfaces with advanced features, such as dependency version overrides,
platform-independent resolutions, reproducible resolutions, alternative resolution strategies, and
more.

Migrate to uv without changing your existing workflows — and experience a 10-100x speedup — with the
`uv pip` interface.

Compile requirements into a platform-independent requirements file:

```console
Expand Down
13 changes: 7 additions & 6 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Installing uv

Install uv with our standalone installers, from PyPI, or from your package manager of choice.
Install uv with our standalone installers or your package manager of choice (e.g.,
`pip install uv`).

## Standalone installer

uv provides a standalone installer that downloads and installs uv:
uv provides a standalone installer to downloads and install uv:

```console title="macOS and Linux"
$ curl -LsSf https://astral.sh/uv/install.sh | sh
Expand All @@ -14,7 +15,7 @@ $ curl -LsSf https://astral.sh/uv/install.sh | sh
$ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
```

uv is installed to `~/.cargo/bin`.
By default, uv is installed to `~/.cargo/bin`.

!!! tip

Expand Down Expand Up @@ -42,7 +43,7 @@ $ powershell -c "irm https://astral.sh/uv/0.2.11/install.ps1 | iex"

!!! tip

When the standalone installer is used, uv can perform self-updates:
When uv is installed via the standalone installer, self-updates are enabled:

```console
$ uv self update
Expand All @@ -69,8 +70,8 @@ $ pip install uv

!!! note

There are prebuilt distributions (wheels) for many platforms; if not available for a given
platform, uv will be built from source which requires a Rust toolchain to be installed. See the
uv ships with prebuilt distributions (wheels) for many platforms; if a wheel is not available for a given
platform, uv will be built from source, which requires a Rust toolchain. See the
[contributing setup guide](https://github.com/astral-sh/uv/blob/main/CONTRIBUTING.md#setup)
for details on building uv from source.

Expand Down

0 comments on commit 9ba2bb7

Please sign in to comment.