- With an authenticated client. This approach is recommended for teams that publish packages from development machines, or that are using CI/CD systems that do not (yet) support Trusted Publishing.
- With Trusted Publishing. This approach is recommended for teams that publish packages from GitHub Actions and other supported CI/CD systems.
Configure your publishing registry
Regardless of your publishing method, we recommend setting your registry’spublish-url in your pyproject.toml to avoid needing to specify URLs on the
command line.
For example, if your team is called acme, you can configure publishing to the
acme/main registry with:
pyproject.toml
main registry is created by default during onboarding, but you can always
create additional registries for your team.
Publishing with an authenticated client
Once authenticated, you can publish packages to your team’s dedicated private registry. For example, if you configured theacme/main registry as main (like above),
you can publish a package with:
--publish-url directly:
Use
uv publish --dry-run to validate your distribution prior to writing to
the registry.Trusted Publishing
Trusted Publishing is currently in preview. All organizations have access to
it, but you may encounter bugs or missing features. If you have feedback,
please get in touch.
- Usability: with Trusted Publishing, there’s no need to create and provision API tokens on your CI/CD system. The CI/CD system can authenticate directly to pyx.
- Security: Trusted Publishing uses short-lived credentials that are minimally scoped (down to the exact set of packages configured for publishing). These qualities reduce the blast radius of a compromised credential.
Supported Trusted Publishing providers
At the moment, pyx supports Trusted Publishing with the following CI/CD providers:- GitHub Actions
- BuildKite (in closed beta)
- GitLab CI/CD (in open beta)
At the moment, support for these providers is limited to their hosted
offerings (e.g.,
github.com). Support for self-hosted instances is not yet
available.Enrolling a Trusted Publisher
You can enroll a Trusted Publisher against one or more of your team’s packages (or packages that you’d like created) in the in the pyx dashboard under Team > Trusted Publishers.At the moment, only team administrators can enroll Trusted Publishers.
- GitHub Actions
- BuildKite
- GitLab CI/CD
A GitHub Actions Trusted Publisher has two mandatory components:
- The Repository is the
owner/reposlug on GitHub from which you’ll be publishing. - The Workflow is the filename of the GitHub Actions workflow
that will be publishing. This should be the base filename, e.g.,
publish.yml(not.github/workflows/publish.yml).
-
The Environment is an optional name of the
GitHub Actions environment
that will be used for publishing. This environment must be configured
in the GitHub repository settings and must be used in the workflow
via
environment: <name>. -
The Subject pattern is an optional
fnmatch
pattern that the
subclaim in the GitHub OIDC token must match. See GitHub’s example subject claims for details.
Publishing with a Trusted Publisher
Once you’ve enrolled a Trusted Publisher against one or more packages, you can publish to pyx with it. Trusted Publishing to pyx is built directly into uv as of v0.9.27. To use it, all you need to do is ensure that your CI/CD environment exposes the proper OIDC token.- GitHub Actions
- BuildKite
- GitLab CI/CD
- Manual integration
For versions of uv prior to v0.9.27, you can use
astral-sh/pyx-auth-action
to authenticate with pyx via Trusted Publishing. See the action’s
documentation for details.
publish.yml
Private classifiers
pyx supports private classifiers, which you can use to prevent packages from being accidentally published to PyPI (or another index) instead of pyx. Private classifiers come in two forms:Private :: pyxallows publishing anywhere on pyx (but only to pyx).Private :: pyx :: <team>restricts publishing to a specific team. For example,Private :: pyx :: acmeallows publishing only to theacmeteam’s registries.
pyproject.toml. For example:
Like PyPI, pyx will reject packages that use the
Private :: Do Not Upload
classifier. Additionally, like PyPI, pyx will reject any Private ::
classifiers not recognized by the rules above.Twine support
pyx supports publishing from non-uv clients, liketwine. To publish with twine,
point the twine client to the pyx index, and authenticate via
uv auth token pyx.dev: