Skip to content

Add basic uv sync and uv lock commands #3436

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

Merged
merged 3 commits into from
May 8, 2024
Merged

Add basic uv sync and uv lock commands #3436

merged 3 commits into from
May 8, 2024

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented May 7, 2024

Summary

These aren't intended for production use; instead, I'm just trying to frame out the overall data flows and code-sharing for these commands. We now have uv sync (sync the environment to match the lockfile, without refreshing or resolving) and uv lock (generate the lockfile). Both require a virtual environment to exist (something we should change). uv sync, uv run, and uv lock all share code for the underlying subroutines (resolution and installation), so the commands themselves are relatively small (~100 lines) and mostly consist of reading arguments and such.

uv lock and uv sync don't actually really work yet, because we have no way to include the project itself in the lockfile (that's a TODO in the lockfile implementation).

Closes #3432.

let link_mode = LinkMode::default();
let no_binary = NoBinary::default();
let no_build = NoBuild::default();
let setup_py = SetupPyStrategy::default();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could DRY this up but not sure if it's worth it.


/// Run a command.
#[allow(clippy::unnecessary_wraps, clippy::too_many_arguments)]
pub(crate) async fn run(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the existing run.rs, but moved into the workspace module, and the resolve and install commands were pulled into standalone methods.

@charliermarsh charliermarsh force-pushed the charlie/sync branch 6 times, most recently from 7a73411 to 5da8977 Compare May 8, 2024 01:50
@charliermarsh charliermarsh enabled auto-merge (squash) May 8, 2024 14:42
@charliermarsh charliermarsh merged commit 76a3ceb into main May 8, 2024
43 checks passed
@charliermarsh charliermarsh deleted the charlie/sync branch May 8, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a basic uv sync command
3 participants