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

feat: add pixi clean command #1325

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ruben-arts
Copy link
Contributor

@ruben-arts ruben-arts commented May 5, 2024

Initial proposal
Includes

  • pixi clean cleans environments
  • pixi clean -e prod cleans a environment
  • pixi clean cache cleans cache dir
  • pixi clean cache --conda/--pypi cleans a specific package cache

fixes: #1321

@ruben-arts ruben-arts marked this pull request as draft May 5, 2024 20:17
@ruben-arts
Copy link
Contributor Author

ruben-arts commented May 5, 2024

I'm not happy with the cli yet. I want env to be the default and cache being a sub command.

Edit: fixed

/// Clean only the conda related cache.
#[arg(long)]
pub conda: bool,
// TODO: Would be amazing to have a --unused flag to clean only the unused cache.
Copy link
Contributor

Choose a reason for hiding this comment

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

just my 2 cents - we need to be sure that we can support windows with this. I think they don't have inode count

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's also why I didn't do it right now 😄

src/cli/clean.rs Outdated
));

// Ignore errors
let _ = tokio::fs::remove_dir_all(&folder).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to log the errors ? ( maybe with debug?)


if let Some(explicit_env) = explicit_environment {
remove_folder_with_progress(explicit_env.dir(), true).await?;
tracing::info!("Skipping removal of task cache and solve group environments for explicit environment '{:?}'", explicit_env.name());
Copy link
Contributor

Choose a reason for hiding this comment

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

let's add the same tracing:info for else branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not really skipping anything in that part so there everything would be logged by either the progress bar or other info's

@bollwyvl
Copy link
Contributor

bollwyvl commented May 6, 2024

pixi clean task <taskname> would also be very helpful.

In some systems (e.g. doit), clean can be optionally configured to remove:

  • remove all outputs
    • clean = true
  • some specific set of files
    • clean = ["*.tsbuildinfo", "lib"]
  • the clean of all depends-on
    • clean-depends-on = true
      • though maybe this would be better when a depends-on can be a more full task with
        • depends-on = [{task="build", environment="build", clean=true}]

@ruben-arts
Copy link
Contributor Author

@bollwyvl I like this idea!

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 ability to clean pixi cache
3 participants