mirror of https://github.com/astral-sh/uv
Update scripts docs with package indexes (#11443)
## Summary The [current scripts docs page](https://docs.astral.sh/uv/guides/scripts/) doesn't include detail on how to use a custom package index when setting up a script. I believe this might be because it didn't use to work (see #6688 ) but it now does (thanks for that, by the way! 😄) Given it's a useful feature, I suggest adding a quick example to the scripts page, with the details of authentication, etc. left to the main `indexes.md` doc. I'd also suggests that this closes #6688, though it doesn't actually add that feature - that appears to have already been done :) ## Test Plan No testing is needed, I think! --------- Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
parent
1cd9c37151
commit
0b4a349173
|
|
@ -217,6 +217,25 @@ print(Point)
|
|||
is not installed — see the documentation on [Python versions](../concepts/python-versions.md) for
|
||||
more details.
|
||||
|
||||
## Using alternative package indexes
|
||||
|
||||
If you wish to use an alternative [package index](../configuration/indexes.md) to resolve
|
||||
dependencies, you can provide the index with the `--index` option:
|
||||
|
||||
```console
|
||||
$ uv add --index "https://example.com/simple" --script example.py 'requests<3' 'rich'
|
||||
```
|
||||
|
||||
This will include the package data in the inline metadata:
|
||||
|
||||
```python
|
||||
# [[tool.uv.index]]
|
||||
# url = "https://example.com/simple"
|
||||
```
|
||||
|
||||
If you require authentication to access the package index, then please refer to the
|
||||
[package index](../configuration/indexes.md) documentation.
|
||||
|
||||
## Locking dependencies
|
||||
|
||||
uv supports locking dependencies for PEP 723 scripts using the `uv.lock` file format. Unlike with
|
||||
|
|
|
|||
Loading…
Reference in New Issue