mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Publish: Support --index <name> (#9694)
When publishing, we currently ask the user to set `--publish-url` to the upload URL and `--check-url` to the simple index URL, or the equivalent configuration keys. But that's redundant with the `[[tool.uv.index]]` declaration. Instead, we extend `[[tool.uv.index]]` with a `publish-url` entry and allow passing `uv publish --index <name>`. `uv publish --index <name>` requires the `pyproject.toml` to be present when publishing, unlike using `--publish-url ... --check-url ...` which can be used e.g. in CI without a checkout step. `--index` also always uses the check URL feature to aid upload consistency. The documentation tries to explain both approaches together, which overlap for the check URL feature. Fixes #8864 --------- Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
parent
a090cf1f12
commit
321101d340
12 changed files with 300 additions and 30 deletions
|
@ -69,14 +69,29 @@ PyPI from GitHub Actions, you don't need to set any credentials. Instead,
|
|||
generate a token. Using a token is equivalent to setting `--username __token__` and using the
|
||||
token as password.
|
||||
|
||||
If you're using a custom index through `[[tool.uv.index]]`, add `publish-url` and use
|
||||
`uv publish --index <name>`. For example:
|
||||
|
||||
```toml
|
||||
[[tool.uv.index]]
|
||||
name = "testpypi"
|
||||
url = "https://test.pypi.org/simple/"
|
||||
publish-url = "https://test.pypi.org/legacy/"
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
When using `uv publish --index <name>`, the `pyproject.toml` must be present, i.e. you need to
|
||||
have a checkout step in a publish CI job.
|
||||
|
||||
Even though `uv publish` retries failed uploads, it can happen that publishing fails in the middle,
|
||||
with some files uploaded and some files still missing. With PyPI, you can retry the exact same
|
||||
command, existing identical files will be ignored. With other registries, use
|
||||
`--check-url <index url>` with the index URL (not the publish URL) the packages belong to. uv will
|
||||
skip uploading files that are identical to files in the registry, and it will also handle raced
|
||||
parallel uploads. Note that existing files need to match exactly with those previously uploaded to
|
||||
the registry, this avoids accidentally publishing source distribution and wheels with different
|
||||
contents for the same version.
|
||||
`--check-url <index url>` with the index URL (not the publish URL) the packages belong to. When
|
||||
using `--index`, the index URL is used as check URL. uv will skip uploading files that are identical
|
||||
to files in the registry, and it will also handle raced parallel uploads. Note that existing files
|
||||
need to match exactly with those previously uploaded to the registry, this avoids accidentally
|
||||
publishing source distribution and wheels with different contents for the same version.
|
||||
|
||||
## Installing your package
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue