Skip to content

Commit

Permalink
Improvements to the project concept docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jul 30, 2024
1 parent 67b3bfa commit 94f0ec8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions docs/concepts/projects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Projects

Python projects are help manage Python applications spanning multiple files.
Python projects help manage Python applications spanning multiple files.

!!! tip

Expand Down Expand Up @@ -38,7 +38,7 @@ The `pyproject.toml` also lists dependencies of the project. uv supports modifyi

## Project environments

uv creates a virtual environment in a `.venv` directory next to the `pyproject.toml`. This virtual environment contains the project and its dependencies. It is stored inside the project to make it easy for editors to find — they need the environment to give code completions and type hints. It is not recommended to include the `.venv` directory in version control, it should be excluded via a `.gitignore` entry (or similar).
uv creates a virtual environment in a `.venv` directory next to the `pyproject.toml`. This virtual environment contains the project and its dependencies. It is stored inside the project to make it easy for editors to find — they need the environment to give code completions and type hints. It is not recommended to include the `.venv` directory in version control; it is automatically excluded from `git` with an internal `.gitignore` file.

To run a command in the project environment, use `uv run`. Alternatively the project environment can be activated as normal for a virtual environment.

Expand All @@ -50,15 +50,17 @@ It is _not_ recommended to modify the project environment manually, e.g., with `

uv creates a `uv.lock` file next to the `pyproject.toml`.

`uv.lock` is a "universal" lockfile that contains exact information about your
project's dependencies. Unlike the `pyproject.toml` which is used to specify the
broad requirements of your project, the lockfile contains the exact resolved versions
that are installed in the project environment. This file should be checked into version
control, allowing for consistent and reproducible installations across machines.
`uv.lock` is a _universal_ lockfile that captures the packages that would be installed across all
possible Python markers such as operating system, architecture, and Python version.

A "universal" lockfile captures packages that would be installed across all possible Python markers such as operating system, architecture, and Python version.
Unlike the `pyproject.toml`, which is used to specify the broad requirements of your project, the
lockfile contains the exact resolved versions that are installed in the project environment. This
file should be checked into version control, allowing for consistent and reproducible installations
across machines.

A lockfile ensures that developers working on the project are using a consistent set of package versions. Additionally, it ensures when deploying the project as an application that the exact set of used package versions is known.
A lockfile ensures that developers working on the project are using a consistent set of package
versions. Additionally, it ensures when deploying the project as an application that the exact set
of used package versions is known.

The lockfile is created and updated during uv invocations that use the project environment, i.e., `uv sync` and `uv run`. The lockfile may also be explicitly updated using `uv lock`.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ An extremely fast Python package and project manager, written in Rust.
- 🐍 [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#lock-file).
- 🗂️ 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`
Expand Down

0 comments on commit 94f0ec8

Please sign in to comment.