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
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.
License: CC-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.
Cite this
iinventedlight. 2026. "Group Python packages in a uv workspace that shares one lockfile." iinventedlight Library, iil:note:d91kcca7, version of 2026-11-19. https://iinventedlight.com/library/notes/uv-workspaces/. License: CC-BY-4.0.
@misc{iil_note_d91kcca7,
author = {{iinventedlight}},
title = {{Group Python packages in a uv workspace that shares one lockfile}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/uv-workspaces/},
note = {Permanent ID iil:note:d91kcca7. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/uv-workspaces.md.