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

Add keyring support for uv #1016

Merged
merged 4 commits into from
May 6, 2024

Conversation

emarsden-iso
Copy link
Contributor

@emarsden-iso emarsden-iso commented Apr 13, 2024

uv has support for keyrings, as long as the option is --keyring-provider=subprocess. But this isn't exposed in the rye CLI.

Some things I haven't addressed, happy to discuss:

  1. I haven't implemented it for piptools. I expect it's possible, in fact more features could be implemented using pip-compile's --pip-args argument, but I think the plan is to move to uv as the default going forward, so I don't know how much desire there is to extend the piptools backend. But if it's needed, I can do it, either in this PR or as followup work.

  2. In practice, I'd expect that people would want to always pass this --keyring-provider value for all calls, and it does pollute the code a bit, passing round the CLI options. I think another way to go could be to put it in the global config and/or the project TOML, and just read it from there. (I'd actually prefer this interface for my own uses.) But I wanted to stay close to the existing CLI of uv and pip, so stuck with that interface. Again, happy to iterate.

Test

From a rye init project:

❯ ../rye/target/debug/rye lock
Generating production lockfile: /home/emarsden/src/rye-proj/test-proj/requirements.lock
error: Failed to build editables
  Caused by: Failed to build editable: /home/emarsden/src/rye-proj/test-proj
  Caused by: Failed to install requirements from build-system.requires (resolve)
  Caused by: No solution found when resolving: hatchling
  Caused by: HTTP status client error (401 Unauthorized) for url (https://[snip]/hatchling/)
error: could not write production lockfile for project

Caused by:
    Failed to run uv compile /tmp/.tmplGQmy9/requirements.txt. uv exited with status: exit status: 2

❯ ../rye/target/debug/rye lock --keyring-provider=subprocess
Generating production lockfile: /home/emarsden/src/rye-proj/test-proj/requirements.lock
Generating dev lockfile: /home/emarsden/src/rye-proj/test-proj/requirements-dev.lock
Done!

@charliermarsh charliermarsh self-assigned this Apr 24, 2024
@charliermarsh charliermarsh self-requested a review April 24, 2024 15:21
@charliermarsh charliermarsh added the enhancement New feature or request label Apr 27, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) April 27, 2024 02:17
auto-merge was automatically disabled May 6, 2024 12:11

Head branch was pushed to by a user without write access

@emarsden-iso
Copy link
Contributor Author

@charliermarsh thanks for taking a look and fixing things up, looks good to merge now?

@charliermarsh charliermarsh merged commit 45b7bd3 into astral-sh:main May 6, 2024
8 checks passed
@charliermarsh
Copy link
Member

Thanks for the nudge, I honestly though it had merged.

@emarsden-iso emarsden-iso deleted the emarsden-uv-keyring branch May 7, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants