Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions crates/uv/src/commands/build_frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub(crate) async fn build_frontend(
python_downloads: PythonDownloads,
concurrency: Concurrency,
cache: &Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
preview: Preview,
) -> Result<ExitStatus> {
Expand Down Expand Up @@ -150,6 +151,7 @@ pub(crate) async fn build_frontend(
python_downloads,
&concurrency,
cache,
workspace_cache,
printer,
preview,
)
Expand Down Expand Up @@ -197,6 +199,7 @@ async fn build_impl(
python_downloads: PythonDownloads,
concurrency: &Concurrency,
cache: &Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
preview: Preview,
) -> Result<BuildResult> {
Expand Down Expand Up @@ -245,11 +248,10 @@ async fn build_impl(
};

// Attempt to discover the workspace; on failure, save the error for later.
let workspace_cache = WorkspaceCache::default();
let workspace = Workspace::discover(
src.directory(),
&DiscoveryOptions::default(),
&workspace_cache,
workspace_cache,
)
.await;

Expand Down Expand Up @@ -346,6 +348,7 @@ async fn build_impl(
python_preference,
python_downloads,
cache,
workspace_cache,
printer,
index_locations,
client_builder.clone(),
Expand Down Expand Up @@ -455,6 +458,7 @@ async fn build_package(
python_preference: PythonPreference,
python_downloads: PythonDownloads,
cache: &Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
index_locations: &IndexLocations,
client_builder: BaseClientBuilder<'_>,
Expand Down Expand Up @@ -604,7 +608,6 @@ async fn build_package(

// Initialize any shared state.
let state = SharedState::default();
let workspace_cache = WorkspaceCache::default();

let extra_build_requires =
LoweredExtraBuildDependencies::from_non_lowered(extra_build_dependencies.clone())
Expand All @@ -631,7 +634,7 @@ async fn build_package(
&hasher,
exclude_newer,
sources.clone(),
workspace_cache,
workspace_cache.clone(),
concurrency.clone(),
preview,
);
Expand Down
3 changes: 2 additions & 1 deletion crates/uv/src/commands/pip/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub(crate) async fn pip_compile(
concurrency: Concurrency,
quiet: bool,
cache: Cache,
workspace_cache: WorkspaceCache,
printer: Printer,
preview: Preview,
) -> Result<ExitStatus> {
Expand Down Expand Up @@ -539,7 +540,7 @@ pub(crate) async fn pip_compile(
&build_hashes,
exclude_newer.clone(),
sources,
WorkspaceCache::default(),
workspace_cache,
concurrency.clone(),
preview,
);
Expand Down
5 changes: 3 additions & 2 deletions crates/uv/src/commands/pip/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub(crate) async fn pip_install(
python_preference: PythonPreference,
concurrency: Concurrency,
cache: Cache,
workspace_cache: WorkspaceCache,
dry_run: DryRun,
printer: Printer,
preview: Preview,
Expand Down Expand Up @@ -485,7 +486,7 @@ pub(crate) async fn pip_install(
&build_hasher,
exclude_newer.clone(),
sources.clone(),
WorkspaceCache::default(),
workspace_cache.clone(),
concurrency.clone(),
preview,
);
Expand Down Expand Up @@ -639,7 +640,7 @@ pub(crate) async fn pip_install(
&build_hasher,
exclude_newer.clone(),
sources,
WorkspaceCache::default(),
workspace_cache,
concurrency.clone(),
preview,
);
Expand Down
5 changes: 3 additions & 2 deletions crates/uv/src/commands/pip/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub(crate) async fn pip_sync(
python_preference: PythonPreference,
concurrency: Concurrency,
cache: Cache,
workspace_cache: WorkspaceCache,
dry_run: DryRun,
printer: Printer,
preview: Preview,
Expand Down Expand Up @@ -392,7 +393,7 @@ pub(crate) async fn pip_sync(
&build_hasher,
exclude_newer.clone(),
sources.clone(),
WorkspaceCache::default(),
workspace_cache.clone(),
concurrency.clone(),
preview,
);
Expand Down Expand Up @@ -530,7 +531,7 @@ pub(crate) async fn pip_sync(
&build_hasher,
exclude_newer.clone(),
sources,
WorkspaceCache::default(),
workspace_cache,
concurrency.clone(),
preview,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/src/commands/project/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ async fn lock_and_sync(
installer_metadata,
concurrency,
cache,
WorkspaceCache::default(),
&WorkspaceCache::default(),
DryRun::Disabled,
printer,
preview,
Expand Down
3 changes: 3 additions & 0 deletions crates/uv/src/commands/project/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use uv_distribution_types::{Name, Resolution};
use uv_fs::PythonExt;
use uv_preview::Preview;
use uv_python::{Interpreter, PythonEnvironment, canonicalize_executable};
use uv_workspace::WorkspaceCache;

/// An ephemeral [`PythonEnvironment`] for running an individual command.
#[derive(Debug)]
Expand Down Expand Up @@ -121,6 +122,7 @@ impl CachedEnvironment {
installer_metadata: bool,
concurrency: &Concurrency,
cache: &Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
preview: Preview,
) -> Result<Self, ProjectError> {
Expand All @@ -139,6 +141,7 @@ impl CachedEnvironment {
resolve,
concurrency,
cache,
workspace_cache,
printer,
preview,
)
Expand Down
7 changes: 3 additions & 4 deletions crates/uv/src/commands/project/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub(crate) async fn lock(
concurrency: Concurrency,
no_config: bool,
cache: &Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
preview: Preview,
) -> anyhow::Result<ExitStatus> {
Expand Down Expand Up @@ -122,14 +123,12 @@ pub(crate) async fn lock(
};

// Find the project requirements.
let workspace_cache = WorkspaceCache::default();
let workspace;
let target = if let Some(script) = script.as_ref() {
LockTarget::Script(script)
} else {
workspace =
Workspace::discover(project_dir, &DiscoveryOptions::default(), &workspace_cache)
.await?;
Workspace::discover(project_dir, &DiscoveryOptions::default(), workspace_cache).await?;
LockTarget::Workspace(&workspace)
};

Expand Down Expand Up @@ -198,7 +197,7 @@ pub(crate) async fn lock(
Box::new(DefaultResolveLogger),
&concurrency,
cache,
&workspace_cache,
workspace_cache,
printer,
preview,
)
Expand Down
9 changes: 4 additions & 5 deletions crates/uv/src/commands/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,7 @@ pub(crate) async fn resolve_environment(
logger: Box<dyn ResolveLogger>,
concurrency: &Concurrency,
cache: &Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
preview: Preview,
) -> Result<ResolverOutput, ProjectError> {
Expand Down Expand Up @@ -2141,8 +2142,6 @@ pub(crate) async fn resolve_environment(
FlatIndex::from_entries(entries, Some(&tags), &hasher, build_options)
};

let workspace_cache = WorkspaceCache::default();

// Lower the extra build dependencies, if any.
let extra_build_requires =
LoweredExtraBuildDependencies::from_non_lowered(extra_build_dependencies.clone())
Expand All @@ -2169,7 +2168,7 @@ pub(crate) async fn resolve_environment(
&build_hasher,
exclude_newer.clone(),
sources.clone(),
workspace_cache,
workspace_cache.clone(),
concurrency.clone(),
preview,
);
Expand Down Expand Up @@ -2377,7 +2376,7 @@ pub(crate) async fn update_environment(
installer_metadata: bool,
concurrency: &Concurrency,
cache: &Cache,
workspace_cache: WorkspaceCache,
workspace_cache: &WorkspaceCache,
dry_run: DryRun,
printer: Printer,
preview: Preview,
Expand Down Expand Up @@ -2564,7 +2563,7 @@ pub(crate) async fn update_environment(
&build_hasher,
exclude_newer.clone(),
sources.clone(),
workspace_cache,
workspace_cache.clone(),
concurrency.clone(),
preview,
);
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/src/commands/project/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub(crate) async fn remove(
installer_metadata,
&concurrency,
cache,
WorkspaceCache::default(),
&WorkspaceCache::default(),
DryRun::Disabled,
printer,
preview,
Expand Down
17 changes: 9 additions & 8 deletions crates/uv/src/commands/project/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pub(crate) async fn run(
installer_metadata: bool,
concurrency: Concurrency,
cache: Cache,
workspace_cache: &WorkspaceCache,
printer: Printer,
env_file: EnvFile,
preview: Preview,
Expand Down Expand Up @@ -161,7 +162,6 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
// Initialize any shared state.
let lock_state = UniversalState::default();
let sync_state = lock_state.fork();
let workspace_cache = WorkspaceCache::default();

// Read from the `.env` file, if necessary.
for env_file_path in env_file.iter().rev().map(PathBuf::as_path) {
Expand Down Expand Up @@ -284,7 +284,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
},
&concurrency,
&cache,
&workspace_cache,
workspace_cache,
printer,
preview,
)
Expand Down Expand Up @@ -332,7 +332,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
installer_metadata,
&concurrency,
&cache,
workspace_cache.clone(),
workspace_cache,
DryRun::Disabled,
printer,
preview,
Expand Down Expand Up @@ -449,7 +449,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
installer_metadata,
&concurrency,
&cache,
workspace_cache.clone(),
workspace_cache,
DryRun::Disabled,
printer,
preview,
Expand Down Expand Up @@ -565,7 +565,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
Workspace::discover(
&discovery_dir,
&DiscoveryOptions::default(),
&workspace_cache,
workspace_cache,
)
.await?
.with_current_project(package.clone())
Expand All @@ -575,7 +575,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
match VirtualProject::discover(
&discovery_dir,
&DiscoveryOptions::default(),
&workspace_cache,
workspace_cache,
)
.await
{
Expand Down Expand Up @@ -786,7 +786,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
},
&concurrency,
&cache,
&workspace_cache,
workspace_cache,
printer,
preview,
)
Expand Down Expand Up @@ -875,7 +875,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
installer_metadata,
&concurrency,
&cache,
workspace_cache.clone(),
workspace_cache,
DryRun::Disabled,
printer,
preview,
Expand Down Expand Up @@ -1030,6 +1030,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
installer_metadata,
&concurrency,
&cache,
workspace_cache,
printer,
preview,
)
Expand Down
Loading
Loading