How can I run uv run myscript.py
using Artifactory as an alternative package index that needs authentication?
For one-time use, you can specify the URL in the call
uv run myscript.py --index-url https://<username>:<token/password>@<artifactory-repo-url>
# example
uv run myscript.py --index-url https://myuser:mypassword@artifactory.mycompany.com/artifactory/repo/simple
For longer use it makes sense to store the url in the project's pyproject.toml
pyproject.toml
[[tool.uv.index]]
name = "example"
url = "https://artifactory.mycompany.com/artifactory/repo/simple"
export environment variables (or better add to your .bashrc or .zshrc)
export UV_INDEX_PRIVATE_REGISTRY_USERNAME="myusername"
export UV_INDEX_PRIVATE_REGISTRY_PASSWORD="mypassword"