---
source: https://iinventedlight.com/library/notes/uv-workspaces.md
title: "Group Python packages in a uv workspace that shares one lockfile"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (uv docs); Public-Domain (Python PEPs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: uv docs, Using workspaces; Python PEPs, PEP 621 – Storing project metadata in pyproject.toml. MIT; Public-Domain."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: uv workspaces"
tags: [uv, workspaces, lockfile, packaging, pep-621]
client: Librarian
sources:
  - id: S1
    title: "Using workspaces"
    publisher: uv docs
    url: https://docs.astral.sh/uv/concepts/projects/workspaces/
    accessed: 2026-11-19
    license: "MIT"
  - id: S2
    title: "PEP 621 – Storing project metadata in pyproject.toml"
    publisher: Python PEPs
    url: https://peps.python.org/pep-0621/
    accessed: 2026-11-19
    license: "Public-Domain"
---
# Group Python packages in a uv workspace that shares one lockfile
**Answer:** Inspired by Cargo, uv treats a workspace as packages (the workspace members) managed together as one collection. Each package defines its own project metadata, but the workspace shares a single lockfile, so it operates with a consistent set of dependencies.

## Layout

Every workspace needs a root, which is a workspace member. To create a workspace, add a workspace table and specify members, including include or exclude directories. Creating a package inside an existing package will add the newly created member to the workspace, and can create the table in the workspace root if it doesn't already exist. A command operates on the entire workspace at once by default, or on the workspace root, though you can run a command in a particular workspace member from any workspace directory.

## Metadata

PEP 621 specifies how to write a project's core metadata in `pyproject.toml`. Workspace members keep that per-package table. The shared lockfile is how the workspace keeps a consistent set of dependencies.

## Gotcha

In defining a workspace, you must specify the members.

## See also

- [uv-index](https://iinventedlight.com/library/notes/uv-index/)
- [python-pathlib](https://iinventedlight.com/library/notes/python-pathlib/)
- [python-argparse](https://iinventedlight.com/library/notes/python-argparse/)

## Claims

- id: C1
  claim: A workspace is a collection of packages managed together.
  source: S1
  evidence: "a collection of one or more packages, called workspace members"

- id: C2
  claim: Members share a single lockfile for consistent dependencies.
  source: S1
  evidence: "the workspace shares a single lockfile"

- id: C3
  claim: Each package still has its own project metadata in pyproject.toml.
  source: S2
  evidence: "This PEP specifies how to write a project's core metadata"

## Sources

- [S1] Using workspaces. uv docs. https://docs.astral.sh/uv/concepts/projects/workspaces/ . License: MIT. Accessed 2026-11-19.

- [S2] PEP 621 – Storing project metadata in pyproject.toml. Python PEPs. https://peps.python.org/pep-0621/ . License: Public-Domain. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: uv docs, Using workspaces; Python PEPs, PEP 621 – Storing project metadata in pyproject.toml. MIT; Public-Domain. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
