The uv client can be used to publish Python packages on PyPI. For more information, see uv.
To connect uv to Artifactory, complete the following steps:
Authenticate the uv Client to Artifactory
Authenticate the uv client to Artifactory to be able to read and install Python packages from your repositories. There are two ways to authenticate the uv client to Artifactory:
Connect uv to Artifactory using uv auth login
Use uv auth login to securely store your Artifactory credentials and connect the uv client to Artifactory.
To connect the uv client to Artifactory using uv auth login:
Run the following command:
uv auth login https://[JFrogPlatformURL]/artifactory/api/pypi/<REPO> --username <USERNAME> --password <AUTH>Where:
[JFrogPlatformURL]: The URL of your Artifactory service endpoint<REPO>: The name of the target repository<USERNAME>: Your Artifactory username<AUTH>: Your Artifactory identity token
For example:
uv auth login https://company.jfrog.io/artifactory/api/pypi/pypi-local --username jeffry --RANDOM_TOKEN_YWRtaW46QVBBVWJjTExkZTU4WT
Note
You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.
Connect uv to Artifactory using .netrc
You can manually configure uv to connect to Artifactory by storing your credentials in the .netrc file.
To manually connect the uv client to Artifactory:
Open your
.netrcfile in a text editor. The file location varies by operating system:Linux/Unix:
~/.netrcWindows:
%USERPROFILE%\_netrc
Add the following snippet to the file:
machine [JFrogPlatformURL] login <USERNAME> password <AUTH>Where:
[JFrogPlatformURL]: The hostname of your JFrog service endpoint<USERNAME>: Your Artifactory username<AUTH>: Your Artifactory identity token
For example:
machine company.jfrog.io login jeffry password RANDOM_TOKEN_YWRtaW46QVBBVWJjTExkZTU4WTSave the changes to the file.
Note
You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.
Add uv Environment Variables for Publishing
While authenticating the uv client allows you to install packages, you need to add environment variables to be able to publish packages to Artifactory.
To add environment variables for publishing:
Run the following command:
export UV_PUBLISH_USERNAME=<USERNAME> export UV_PUBLISH_PASSWORD=<AUTH>
Where:
<USERNAME>: Your Artifactory username<AUTH>: The Artifactory identity token you want to use for publish permissions
For example:
export UV_PUBLISH_USERNAME=jeffry export UV_PUBLISH_PASSWORD=PUBLISH_TOKEN_YWRtaW46QVBBVWJjTExkZTU4WT
Note
You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.
Add Artifactory as the Default Registry for uv
To publish to Artifactory using the uv client, configure Artifactory as the default registry in the uv.toml file.
To add Artifactory as your default registry:
Open the
uv.tomlfile in a text editor. The location of the file varies by operating system:Linux/Unix:
~/.config/uv/uv.tomlWindows:
%APPDATA%\uv\uv.toml
If the file doesn't exist, create it in the appropriate location.
Add the following snippet to the
uv.tomlfile:[[index]] name="<REPO>" publish-url = "https://[JFrogPlatformURL]/artifactory/api/pypi/<REPO>" url = "https://[JFrogPlatformURL]/artifactory/api/pypi/<REPO>/simple" default = true
Where:
<REPO>: The name of the target repository[JFrogPlatformURL]: The hostname for your JFrog service endpoint
For example:
[[index]] name="pypi_local" publish-url = "https://company.jfrog.io/artifactory/api/pypi/pypi_local" url = "https://company.jfrog.io/artifactory/api/pypi/pypi_local/simple" default = true
Save the changes to the file.
Note
You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.
Next step: