mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Migrate to tokio
(#27)
Closes https://github.com/astral-sh/puffin/issues/26.
This commit is contained in:
parent
ca6aa207ff
commit
dd26cfa0cc
7 changed files with 12 additions and 15 deletions
|
@ -12,7 +12,6 @@ puffin-package = { path = "../puffin-package" }
|
|||
puffin-resolver = { path = "../puffin-resolver" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
async-std = { workspace = true }
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
colored = { workspace = true }
|
||||
directories = { workspace = true }
|
||||
|
@ -25,3 +24,4 @@ tracing-tree = { workspace = true }
|
|||
tracing-subscriber = { workspace = true }
|
||||
url = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
|
|
@ -9,8 +9,7 @@ pub(crate) fn setup_logging() -> Result<()> {
|
|||
let targets = Targets::new()
|
||||
.with_target("hyper", LevelFilter::WARN)
|
||||
.with_target("reqwest", LevelFilter::WARN)
|
||||
.with_target("async_io", LevelFilter::WARN)
|
||||
.with_target("async_std", LevelFilter::WARN)
|
||||
.with_target("tokio", LevelFilter::WARN)
|
||||
.with_target("blocking", LevelFilter::OFF)
|
||||
.with_default(LevelFilter::TRACE);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ struct SyncArgs {
|
|||
no_cache: bool,
|
||||
}
|
||||
|
||||
#[async_std::main]
|
||||
#[tokio::main]
|
||||
async fn main() -> ExitCode {
|
||||
let cli = Cli::parse();
|
||||
|
||||
|
|
|
@ -14,8 +14,9 @@ puffin-client = { path = "../puffin-client" }
|
|||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
async-std = { workspace = true }
|
||||
install-wheel-rs = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
url = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-util = { workspace = true }
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::str::FromStr;
|
|||
|
||||
use anyhow::Result;
|
||||
use install_wheel_rs::{install_wheel, InstallLocation};
|
||||
use tokio_util::compat::FuturesAsyncReadCompatExt;
|
||||
use url::Url;
|
||||
|
||||
use puffin_client::{File, PypiClient};
|
||||
|
@ -24,9 +25,8 @@ pub async fn install(
|
|||
let reader = client.stream_external(&url).await?;
|
||||
|
||||
// TODO(charlie): Stream the unzip.
|
||||
let mut writer =
|
||||
async_std::fs::File::create(tmp_dir.path().join(&wheel.hashes.sha256)).await?;
|
||||
async_std::io::copy(reader, &mut writer).await?;
|
||||
let mut writer = tokio::fs::File::create(tmp_dir.path().join(&wheel.hashes.sha256)).await?;
|
||||
tokio::io::copy(&mut reader.compat(), &mut writer).await?;
|
||||
}
|
||||
|
||||
// Install each wheel.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue