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
33 changes: 32 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ pixi_manifest = { path = "crates/pixi_manifest" }
pixi_progress = { path = "crates/pixi_progress" }
pixi_pypi_spec = { path = "crates/pixi_pypi_spec" }
pixi_record = { path = "crates/pixi_record" }
pixi_reporters = { path = "crates/pixi_reporters" }
pixi_spec = { path = "crates/pixi_spec" }
pixi_spec_containers = { path = "crates/pixi_spec_containers" }
pixi_test_utils = { path = "crates/pixi_test_utils" }
Expand Down Expand Up @@ -267,7 +268,6 @@ itertools = { workspace = true }
miette = { workspace = true, features = ["fancy-no-backtrace"] }
minijinja = { workspace = true, features = ["builtins"] }
once_cell = { workspace = true }
parking_lot = { workspace = true }
pathdiff = { workspace = true }
rstest = { workspace = true }
uv-build-frontend = { workspace = true }
Expand Down Expand Up @@ -312,6 +312,7 @@ pixi_manifest = { workspace = true, features = ["rattler_lock"] }
pixi_progress = { workspace = true }
pixi_pypi_spec = { workspace = true }
pixi_record = { workspace = true }
pixi_reporters = { workspace = true }
pixi_spec = { workspace = true }
pixi_spec_containers = { workspace = true }
pixi_toml = { workspace = true }
Expand Down
51 changes: 51 additions & 0 deletions crates/pixi_reporters/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[package]
authors.workspace = true
description = "Progress reporting infrastructure for pixi"
edition.workspace = true
homepage.workspace = true
license.workspace = true
name = "pixi_reporters"
readme.workspace = true
repository.workspace = true
version = "0.1.0"

[dependencies]
# Standard library
futures = { workspace = true }
indexmap = { workspace = true }
itertools = { workspace = true }
parking_lot = { workspace = true }
tokio = { workspace = true }
url = { workspace = true }

# Progress and UI
console = { workspace = true }
indicatif = { workspace = true }

# Utilities
human_bytes = { workspace = true }
regex = { workspace = true }
tracing = { workspace = true }

# Pixi ecosystem
pixi_command_dispatcher = { workspace = true }
pixi_git = { workspace = true }
pixi_progress = { workspace = true }
pixi_spec = { workspace = true }

# Rattler ecosystem
rattler = { workspace = true }
rattler_conda_types = { workspace = true }
rattler_repodata_gateway = { workspace = true }

# UV ecosystem
uv-configuration = { workspace = true }
uv-distribution = { workspace = true }
uv-distribution-types = { workspace = true }
uv-installer = { workspace = true }
uv-normalize = { workspace = true }
uv-redacted = { workspace = true }
uv-resolver = { workspace = true }
Comment on lines +13 to +48
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that you sorted dependencies that way. We should do that everywhere!


[dev-dependencies]
# Add test dependencies if needed
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rattler::install::Transaction;
use rattler_conda_types::{PrefixRecord, RepoDataRecord};
use tokio::sync::mpsc::UnboundedReceiver;

use crate::reporters::{
use crate::{
download_verify_reporter::BuildDownloadVerifyReporter,
main_progress_bar::{MainProgressBar, Tracker},
};
Expand Down
13 changes: 8 additions & 5 deletions src/reporters/mod.rs → crates/pixi_reporters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod install_reporter;
mod main_progress_bar;
mod release_notes;
mod repodata_reporter;
pub mod uv_reporter;

use std::sync::LazyLock;

Expand All @@ -20,15 +21,17 @@ use rattler_repodata_gateway::Reporter;
pub use release_notes::format_release_notes;
use uv_configuration::RAYON_INITIALIZE;

use crate::reporters::{
install_reporter::SyncReporter, main_progress_bar::MainProgressBar,
repodata_reporter::RepodataReporter,
};
use install_reporter::SyncReporter;
use main_progress_bar::MainProgressBar;
use repodata_reporter::RepodataReporter;

// Re-export the uv_reporter types for external use
pub use uv_reporter::{UvReporter, UvReporterOptions};

/// A top-level reporter that combines the different reporters into one. This
/// directly implements the [`pixi_command_dispatcher::Reporter`] trait.
/// And subsequently, offloads the work to its sub progress reporters.
pub(crate) struct TopLevelProgress {
pub struct TopLevelProgress {
source_checkout_reporter: GitCheckoutProgress,
conda_solve_reporter: MainProgressBar<String>,
repodata_reporter: RepodataReporter,
Expand Down
28 changes: 17 additions & 11 deletions src/uv_reporter.rs → crates/pixi_reporters/src/uv_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct UvReporterOptions {
}

impl UvReporterOptions {
pub(crate) fn new() -> Self {
pub fn new() -> Self {
Self {
length: None,
top_level_message: "",
Expand All @@ -34,27 +34,33 @@ impl UvReporterOptions {
}
}

pub(crate) fn with_length(mut self, length: u64) -> Self {
pub fn with_length(mut self, length: u64) -> Self {
self.length = Some(length);
self
}

pub(crate) fn with_top_level_message(mut self, message: &'static str) -> Self {
pub fn with_top_level_message(mut self, message: &'static str) -> Self {
self.top_level_message = message;
self
}

pub(crate) fn with_existing(mut self, progress_bar: ProgressBar) -> Self {
pub fn with_existing(mut self, progress_bar: ProgressBar) -> Self {
self.progress_bar = Some(progress_bar);
self
}

pub(crate) fn with_starting_tasks(mut self, tasks: impl Iterator<Item = String>) -> Self {
pub fn with_starting_tasks(mut self, tasks: impl Iterator<Item = String>) -> Self {
self.starting_tasks = tasks.collect_vec();
self
}
}

impl Default for UvReporterOptions {
fn default() -> Self {
Self::new()
}
}

/// Reports on download progress.
pub struct UvReporter {
pb: ProgressBar,
Expand All @@ -68,7 +74,7 @@ pub struct UvReporter {
impl UvReporter {
/// Create a new instance that will report on the progress the given uv reporter
/// This uses a set size and message
pub(crate) fn new(options: UvReporterOptions) -> Self {
pub fn new(options: UvReporterOptions) -> Self {
// Use a new progress bar if none was provided.
let pb = if let Some(pb) = options.progress_bar {
pixi_progress::global_multi_progress().add(pb)
Expand Down Expand Up @@ -100,22 +106,22 @@ impl UvReporter {
}
}

pub(crate) fn new_arc(options: UvReporterOptions) -> Arc<Self> {
pub fn new_arc(options: UvReporterOptions) -> Arc<Self> {
Arc::new(Self::new(options))
}

fn lock(&self) -> std::sync::MutexGuard<Vec<Option<ScopedTask>>> {
self.scoped_tasks.lock().expect("progress lock poison")
}

pub(crate) fn start(&self, message: String) -> usize {
pub fn start(&self, message: String) -> usize {
let task = self.fmt.start(message);
let mut lock = self.lock();
lock.push(Some(task));
lock.len() - 1
}

pub(crate) fn finish(&self, id: usize) {
pub fn finish(&self, id: usize) {
let mut lock = self.lock();
let len = lock.len();
let task = lock
Expand All @@ -127,11 +133,11 @@ impl UvReporter {
}
}

pub(crate) fn finish_all(&self) {
pub fn finish_all(&self) {
self.pb.finish_and_clear()
}

pub(crate) fn increment_progress(&self) {
pub fn increment_progress(&self) {
self.pb.inc(1);
}

Expand Down
3 changes: 2 additions & 1 deletion src/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use pixi_progress::global_multi_progress;
use pixi_record::{PinnedPathSpec, PinnedSourceSpec};
use rattler_conda_types::{GenericVirtualPackage, Platform};

use crate::{WorkspaceLocator, cli::cli_config::WorkspaceConfig, reporters::TopLevelProgress};
use crate::{WorkspaceLocator, cli::cli_config::WorkspaceConfig};
use pixi_reporters::TopLevelProgress;

#[derive(Parser, Debug)]
#[clap(verbatim_doc_comment)]
Expand Down
2 changes: 1 addition & 1 deletion src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use rattler_conda_types::Version;
use std::str::FromStr;

use crate::cli::GlobalOptions;
use crate::reporters::format_release_notes;
use pixi_reporters::format_release_notes;

/// Update pixi to the latest version or a specific version.
#[derive(Debug, clap::Parser)]
Expand Down
2 changes: 1 addition & 1 deletion src/global/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use pixi_config::{Config, RunPostLinkScripts, default_channel_config, pixi_home}
use pixi_consts::consts::{self};
use pixi_manifest::PrioritizedChannel;
use pixi_progress::global_multi_progress;
use pixi_reporters::TopLevelProgress;
use pixi_spec_containers::DependencyMap;
use pixi_utils::{executable_from_path, reqwest::build_reqwest_clients};
use rattler_conda_types::{
Expand Down Expand Up @@ -62,7 +63,6 @@ use crate::{
},
prefix::{Executable, Prefix},
repodata::Repodata,
reporters::TopLevelProgress,
rlimit::try_increase_rlimit_to_sensible,
};

Expand Down
2 changes: 1 addition & 1 deletion src/install_pypi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ use crate::{
install_pypi::plan::{CachedWheels, RequiredDists},
lock_file::UvResolutionContext,
prefix::Prefix,
uv_reporter::{UvReporter, UvReporterOptions},
};
use pixi_reporters::{UvReporter, UvReporterOptions};

pub(crate) mod conda_pypi_clobber;
pub(crate) mod conversions;
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ pub(crate) mod repodata;
pub mod task;
pub mod workspace;

mod reporters;

mod rlimit;
mod signals;
mod uv_reporter;
pub mod variants;

pub use lock_file::UpdateLockFileOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/lock_file/resolve/pypi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use pixi_consts::consts;
use pixi_manifest::{EnvironmentName, SystemRequirements, pypi::pypi_options::PypiOptions};
use pixi_pypi_spec::PixiPypiSpec;
use pixi_record::PixiRecord;
use pixi_reporters::{UvReporter, UvReporterOptions};
use pixi_uv_conversions::{
ConversionError, as_uv_req, convert_uv_requirements_to_pep508, into_pinned_git_spec,
pypi_options_to_build_options, pypi_options_to_index_locations, to_exclude_newer,
Expand Down Expand Up @@ -63,7 +64,6 @@ use crate::{
resolver_provider::CondaResolverProvider,
},
},
uv_reporter::{UvReporter, UvReporterOptions},
workspace::{Environment, EnvironmentVars},
};

Expand Down
4 changes: 2 additions & 2 deletions src/lock_file/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Workspace {
let anchor_pb = multi_progress.add(ProgressBar::hidden());
let command_dispatcher = self
.command_dispatcher_builder()?
.with_reporter(crate::reporters::TopLevelProgress::new(
.with_reporter(pixi_reporters::TopLevelProgress::new(
global_multi_progress(),
anchor_pb,
))
Expand Down Expand Up @@ -1144,7 +1144,7 @@ impl<'p> UpdateContextBuilder<'p> {
None => self
.project
.command_dispatcher_builder()?
.with_reporter(crate::reporters::TopLevelProgress::new(
.with_reporter(pixi_reporters::TopLevelProgress::new(
global_multi_progress(),
anchor_pb.clone(),
))
Expand Down
Loading