Skip to content

Secure authentication method needed #8810

@stoney95

Description

@stoney95

I would like to use uv to install dependencies from a private artifactory repository. Authentication for the private repository works with username and password. I would also like to store the index-url in the pyproject.toml. This simplifies the usage of uv for every team-member. The current minimal config looks like the following:

version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = []

[tool.uv]
index-url = "https://artifactory.company.com/pypi/simple"
native-tls = true
keyring-provider = "subprocess"

The documentation for authentication lists these options:

  • The URL, e.g., https://<user>:<password>@<hostname>/...
  • A .netrc configuration file
  • A keyring provider (requires opt-in)

The first option is not possible, as the credentials would be shared via git. Using .netrc is only partially possible as it poses a security risk by storing credentials in plain text. I tried this option nonetheless and it worked. But I would like to avoid it due to the plain-text password.
The thrid option does not work. I will describe in detail, what I tried and where it failed.

  1. pip install keyring
  2. keyring set artifactory.company.com my_username and entering the credentials as prompted
  3. running uv add <any-package> with the configuration from above failed with
hint: An index URL (https://artifactory.company.com/pypi/simple) could not be queried due to a lack
      of valid authentication credentials (401 Unauthorized).

I changed the configuration value for index-url to https://[email protected]/pypi/simple. By this uv reads the credentials from keyring. As this stores the username in the pyproject.toml the approach does not work. Every team-member uses their own credentials to authenticate with the private artifactory.

  • uv version: uv 0.4.25 (97eb6ab4a 2024-10-21)
  • uv platform: Windows 11

If uv should work with the plain index-url (no username) and keyring, I would like to report this as a bug. In case it doesn't, I would like to request a secure methode for storing credentials while preserving a transferable uv configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for clarification or support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions