Skip to content

Commit 576180f

Browse files
committed
Draft for user docs for workspaces
These docs are not yet meant to be consumed by end users, for now they allow sharing the state of workspace support in terms of features that are relevant to users, and to gather feedback on the design. We can progressively update this doc as workspace support matures.
1 parent a89e146 commit 576180f

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

docs/workspaces.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
**Warning: this documentation applies to a future version of uv. Please refer to
2+
[README.md](../README.md) for documentation for the latest release.**
3+
4+
Workspaces help you organize large codebases by splitting them into multiple packages with
5+
independent dependencies.
6+
7+
When using the `uv pip` interface, workspace dependencies behave like automatic editable path
8+
dependencies. Using the `uv` interface, all your workspace packages are locked together. `uv run`
9+
installs only the current package (unless overridden with `--package`) and its workspace and
10+
non-workspace dependencies.
11+
12+
## Configuration
13+
14+
You can create a workspace by adding a `tool.uv.workspace` to a pyproject.toml that is the workspace
15+
root. This table contains `members` (mandatory) and `exclude` (optional), with lists of globs of
16+
directories:
17+
18+
```toml
19+
[tool.uv.workspace]
20+
members = ["packages/*", "examples/*"]
21+
exclude = ["example/excluded_example"]
22+
```
23+
24+
If you define `tool.uv.sources` in your workspace root, it applies to all packages, unless
25+
overridden in the `tool.uv.sources` of a specific project.
26+
27+
## Common usage
28+
29+
There a two main usage patterns: A root package and helpers, and the flat workspace.
30+
31+
Root package and helpers: In this layout `albatross/pyproject.toml` has both a `project` section and
32+
a `tool.uv.workspace` section.
33+
34+
```
35+
albatross
36+
├── packages
37+
│ ├── provider_a
38+
│ │ ├── pyproject.toml
39+
│ │ └── src
40+
│ │ └── provider_a
41+
│ │ ├── __init__.py
42+
│ │ └── foo.py
43+
│ └── provider_b
44+
│ ├── pyproject.toml
45+
│ └── src
46+
│ └── provider_b
47+
│ ├── __init__.py
48+
│ └── bar.py
49+
├── pyproject.toml
50+
├── README.md
51+
├── uv.lock
52+
└── src
53+
└── albatross
54+
└── main.py
55+
```
56+
57+
Flat workspace: In this layout `albatross/pyproject.toml` has only `tool.uv.workspace` section, but
58+
no `project`.
59+
60+
```
61+
albatross
62+
├── packages
63+
│ ├── albatross
64+
│ │ ├── pyproject.toml
65+
│ │ └── src
66+
│ │ └── albatross
67+
│ │ ├── __init__.py
68+
│ │ └── foo.py
69+
│ ├── provider_a
70+
│ │ ├── pyproject.toml
71+
│ │ └── src
72+
│ │ └── provider_a
73+
│ │ ├── __init__.py
74+
│ │ └── foo.py
75+
│ └── provider_b
76+
│ ├── pyproject.toml
77+
│ └── src
78+
│ └── provider_b
79+
│ ├── __init__.py
80+
│ └── bar.py
81+
├── pyproject.toml
82+
├── README.md
83+
└── uv.lock
84+
```

0 commit comments

Comments
 (0)