Authenticating the uv client
pyx is supported as a first-class package registry in the uv client as of uv v0.8.15. You can install uv with our standalone installers, or with your package manager of choice:If you’re running in a headless environment, e.g., when SSH’d into a remote
server, you’ll be prompted to open a browser window to authenticate.
PYX_API_KEY environment variable:
Authenticating external tools
pyx uses JWT-based authentication. When authenticating via theuv auth login
command, uv will store a JWT token on your machine, alongside a refresh token.
When making API requests, uv will include the JWT token in the Authorization
header. If the JWT token is expired, uv will automatically refresh it using the
refresh token. When authenticating via PYX_API_KEY, uv will perform a similar
process, but without the need for a refresh token.
If necessary, you can use uv auth token pyx.dev to generate a JWT token for
use with the pyx API:
ruff with:
__token__ and the password to the JWT token, e.g.:
PYX_AUTH_TOKEN
environment variable:
Authenticating with Docker
In Docker builds, we recommend using Docker’s built-in support for build secrets. When invokingdocker buildx build, you can pass an API key as a build secret.
For example, assuming that your API key is stored in the PYX_API_KEY
environment variable, you can pass it as a build secret with:
pyx_api_key build secret as
follows:
uv auth token pyx.dev and pass
it to Docker as a build secret:
pyx_auth_token build secret as
follows:
Build secrets do not persist across builds, and do not invalidate layer
caches. As such, re-running a Docker build with a regenerated access token
will retain the cached layers from the previous build.
docker/build-push-action GitHub Action, you can pass the
API key as a build secret to the action directly:
Authenticating with Bazel
Bazel versions 7 and newer allow using a custom credential helper to inject credentials into remote file requests in a secure way without affecting caching. uv v0.9.16 and newer has built-in support for this protocol. Once uv is logged in to pyx, you can use the following.bazelrc to enable the credential helper for all pyx urls:
.bazelrc
bazel/uv-auth-helper is a script that invokes uv auth helper with the
right arguments:
bazel/uv-auth-helper
Authenticating with Dependabot
pyx can be configured as a private registry in GitHub’s Dependabot, allowing Dependabot to update dependencies from pyx. To configure Dependabot to use pyx, add the following to your.github/dependabot.yml:
acme/main with the appropriate pyx index for your organization (e.g.,
public/pypi, astral-sh/cu126, or your organization’s private index).
Both the
pyx and files registries must be included. The pyx registry
serves the package index, while the files registry serves the package files
from the CDN.PYX_API_KEY in your
GitHub repository settings under Settings > Secrets and variables > Actions.
Authenticating with Artifactory
pyx can be configured as an upstream (remote) repository in JFrog Artifactory, allowing Artifactory to proxy requests to pyx. To configure pyx as a remote repository in Artifactory, first create a read-only API key in the pyx dashboard (pyx-sk-...), then create
a PyPI-compatible remote repository with the following settings.
In the Basic tab:
| Setting | Value |
|---|---|
| URL | https://files.astralhosted.com |
| User Name | __token__ |
| Password / Access Token | pyx-sk-... |
| Enable Token Authentication | ✅ |
| Registry URL | https://api.pyx.dev |
| Registry Index Location Suffix | simple/acme/main |
api.pyx.dev) and the CDN
(files.astralhosted.com), set the following options in the Advanced tab:
| Setting | Value |
|---|---|
| Lenient Host Authentication | ✅ |
| Bypass HEAD Requests | ✅ |
If you’re configuring a pyx View as an upstream, set the URL to
https://views.astralhosted.com instead of https://files.astralhosted.com.
When using static IPs, use https://api-static.pyx.dev,
https://files-static.astralhosted.com, or
https://views-static.astralhosted.com accordingly.Migrating off the uv alpha
Prior to v0.8.15, pyx support shipped in a separate, pyx-enabled alpha build of uv. If you’re migrating off the uv alpha (e.g., v0.8.12-alpha.3), note the following changes to the authentication interface:uv auth loginis nowuv auth login pyx.devuv auth logoutis nowuv auth logout pyx.devuv auth tokenis nowuv auth token pyx.devUV_API_KEYis nowPYX_API_KEY(UV_API_KEYwill continue to be supported temporarily for backwards-compatibility)UV_AUTH_TOKENis nowPYX_AUTH_TOKEN(UV_AUTH_TOKENwill continue to be supported temporarily for backwards-compatibility)