Repository navigation
Commit 34d3bb0
authored
fix(pypi): build uv.lock git sources with pip (#4209)
`pip.parse(uv_lock = ...)` passes a git-sourced package's raw uv source
string (`https://host/repo?rev=<ref>#<commit>`) to the Bazel downloader
as a URL, which cannot fetch a git repository (#4139). #4086 fixed the
invalid repo name for these sources but kept the URL, so they still fail
at fetch time.
This makes uv.lock git sources match how a `foo @ git+...` line from a
requirements file is already handled:
- The src gets an empty `url` and `filename`, so `_whl_repo` takes the
existing pip path instead of the downloader.
- The requirement line becomes a pip direct reference, `foo @ git+<repo
url>@<commit>`, pinned to the commit uv resolved rather than the
requested `rev`/`tag`/`branch`. Before, it was `foo==<version>`, which
pip cannot satisfy for a VCS-only version such as `0.12.0a0+39be1c6`.
- A `subdirectory` query parameter carries over as
`#subdirectory=<dir>`. uv percent-encodes it
(`subdirectory=python%2Ffoo`) and pip reads the fragment as a literal
path, so it is decoded. I checked both against uv 0.9.30 and pip 26.2.1:
pip fails on the encoded form with "does not appear to be a Python
project" and builds the decoded one.
Tests: updated `test_uv_lock_vcs_entry` for the new src shape and added
`test_uv_lock_vcs_entry_subdirectory`.
`//tests/pypi/parse_requirements/...` and `//tests/pypi/hub_builder/...`
pass. End to end, a large monorepo using `pip.parse(uv_lock = ...)`
builds its git-sourced `torchdata` dependency against this branch via
`--override_module`; we have been carrying the same change as a patch on
2.3.1.
Fixes #41391 parent 381762a commit 34d3bb0
3 files changed
Lines changed: 106 additions & 18 deletions
File tree
- news
- python/private/pypi
- tests/pypi/parse_requirements
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
235 | 233 | | |
236 | | - | |
237 | | - | |
| 234 | + | |
| 235 | + | |
238 | 236 | | |
239 | 237 | | |
240 | | - | |
| 238 | + | |
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
| |||
275 | 273 | | |
276 | 274 | | |
277 | 275 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
283 | 288 | | |
284 | 289 | | |
285 | 290 | | |
| |||
313 | 318 | | |
314 | 319 | | |
315 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
316 | 370 | | |
317 | 371 | | |
318 | 372 | | |
| |||
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| |||
1321 | 1322 | | |
1322 | 1323 | | |
1323 | 1324 | | |
1324 | | - | |
| 1325 | + | |
1325 | 1326 | | |
1326 | 1327 | | |
1327 | 1328 | | |
| |||
1335 | 1336 | | |
1336 | 1337 | | |
1337 | 1338 | | |
1338 | | - | |
| 1339 | + | |
1339 | 1340 | | |
1340 | | - | |
| 1341 | + | |
1341 | 1342 | | |
1342 | | - | |
| 1343 | + | |
1343 | 1344 | | |
1344 | 1345 | | |
1345 | 1346 | | |
| |||
1348 | 1349 | | |
1349 | 1350 | | |
1350 | 1351 | | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
1351 | 1380 | | |
1352 | 1381 | | |
1353 | 1382 | | |
| |||
0 commit comments