Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication error to Google Artifactory with custom index and env variables #8324

Closed
harteros opened this issue Oct 18, 2024 · 8 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@harteros
Copy link

Hi team, thanks for all your hard work, uv is amazing!

We are currently trying to migrate to uv from poetry. We awaited the update to uv version 0.4.24 for the environmental variables and custom indexes but we have issues with the authentication to our private Google Artifactory.

The problem is as follows:

We have setup uv with keyring for Google Artifactory as follows:

uv tool install keyring --with keyrings.google-artifactregistry-auth

We have our custom index defined as follows in our pyproject.toml

[tool.uv]
keyring-provider = "subprocess"

[[tool.uv.index]]
name = "internal"
url = "https://<internal url>/<internal artifacts>/pypi-virtual/simple"
explicit = true

[tool.uv.sources]
internal-utils = { index = "internal" }

We have also set our env variable (discussed here for Google Artifactory auth)

UV_INDEX_INTERNAL_USERNAME=oauth2accesstoken

Running uv sync --verbose in this way returns

DEBUG Skipping keyring lookup for https:///<internal url>/<internal artifacts>/pypi-virtual/simple/internal-utils/ with no username
...
DEBUG No compatible version found for: custom-project
  × No solution found when resolving dependencies:
╰─▶ Because only the following versions of ... are available:
       ...
      and your project depends on ... we can conclude that your project's requirements are unsatisfiable.

On the other hard when we change our pyproject.toml to include the username in the url uv successfully pulls the credentials from the artifactory and installs the dependencies

[tool.uv]
keyring-provider = "subprocess"

[[tool.uv.index]]
name = "internal"
url = "https://oauth2accesstoken@<internal url>/<internal artifacts>/pypi-virtual/simple"
explicit = true

[tool.uv.sources]
internal-utils = { index = "internal" }

From my tests it seems that the env variable is either not read or appended to the URL causing the artifactory to not work.
Could you please take a look at it, as it seems to me as a possible bug.

Thanks a lot!

uv version: uv 0.4.24 (b9cd54913 2024-10-17)
system platform Apple Silicon macOS

@charliermarsh
Copy link
Member

Can you try providing both the username and password via the env vars, rather than one in the URL and one in the env var?

@harteros
Copy link
Author

Yeah i have tried that, but it does not work. I get the error with skipping the keyring

@charliermarsh
Copy link
Member

Oh sorry, I misread the issue. This may be a bug -- we'll take a look.

@charliermarsh charliermarsh added the bug Something isn't working label Oct 18, 2024
@ticosax
Copy link
Contributor

ticosax commented Oct 18, 2024

I'm observing the same behavior with AWS CodeArtifact.
the workaround to specify the username in the url allows the keyring backend to go through, and successfully install the package.

@zanieb
Copy link
Member

zanieb commented Oct 18, 2024

Sounds like we're missing something in the credential attachment here. Thanks!

@Aditya-PS-05
Copy link
Contributor

Aditya-PS-05 commented Oct 18, 2024

Working on it and It's strange but I guess from_env from credentials to set the credentials is not used.

@charliermarsh
Copy link
Member

I believe this is closed by #8345.

@harteros
Copy link
Author

Thanks a lot for the quick response and fix!
I would like to test it out when you release the next version of uv including the fix and close the issue then if thats ok with you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants