Skip to content

Commit 109abf5

Browse files
Improve documentation of manually adding branch, rev, and tag (#8497)
Closes #8490 by improving the documentation to make it more obvious how to manually edit the `pyproject.toml` if you want to explicitly set the branch, rev (commit), or tag. --------- Co-authored-by: Charlie Marsh <[email protected]>
1 parent 72185ba commit 109abf5

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

docs/concepts/dependencies.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,54 @@ dependencies = [
136136
httpx = { git = "https://github.com/encode/httpx" }
137137
```
138138

139-
A revision, tag, or branch may also be included:
139+
A revision (i.e., commit), tag, or branch may also be included:
140140

141141
```console
142142
$ uv add git+https://github.com/encode/httpx --tag 0.27.0
143143
$ uv add git+https://github.com/encode/httpx --branch main
144-
$ uv add git+https://github.com/encode/httpx --rev 326b943
144+
$ uv add git+https://github.com/encode/httpx --rev 326b9431c761e1ef1e00b9f760d1f654c8db48c6
145145
```
146146

147147
Git dependencies can also be manually added or edited in the `pyproject.toml` with the
148-
`{ git = <url> }` syntax. A target revision may be specified with one of: `rev`, `tag`, or `branch`.
148+
`{ git = <url> }` syntax. A target revision may be specified with one of: `rev` (i.e., commit),
149+
`tag`, or `branch`.
150+
151+
=== "tag"
152+
153+
```toml title="pyproject.toml"
154+
[project]
155+
dependencies = [
156+
"httpx",
157+
]
158+
159+
[tool.uv.sources]
160+
httpx = { git = "https://github.com/encode/httpx", tag = "0.27.0" }
161+
```
162+
163+
=== "branch"
164+
165+
```toml title="pyproject.toml"
166+
[project]
167+
dependencies = [
168+
"httpx",
169+
]
170+
171+
[tool.uv.sources]
172+
httpx = { git = "https://github.com/encode/httpx", branch = "main" }
173+
```
174+
175+
=== "rev"
176+
177+
```toml title="pyproject.toml"
178+
[project]
179+
dependencies = [
180+
"httpx",
181+
]
182+
183+
[tool.uv.sources]
184+
httpx = { git = "https://github.com/encode/httpx", rev = "326b9431c761e1ef1e00b9f760d1f654c8db48c6" }
185+
```
186+
149187
A `subdirectory` may be specified if the package isn't in the repository root.
150188

151189
### URL

0 commit comments

Comments
 (0)