Skip to content

Consider making uv cache clean prompt for directories with non-cache contents #16260

@charliermarsh

Description

@charliermarsh

If you accidentally set UV_CACHE_DIR to some working directory, uv cache clean will blow it away, since it's effectively an rm -rf. This matches the behavior of other tools (e.g., cargo), but we may want to consider guarding against these outcomes. It's not totally trivial, because uv cache clean is intended to clear out contents from previous uv versions -- in other words, uv cache clean doesn't have a clear enumeration of "all contents that are part of the uv cache", since there might be other directories or files that were introduced and removed in prior uv versions. However, we could...

  1. Always prompt (with the directory name) prior to removal.
  2. Prompt if we see directories of files that don't end in -v\d+ (i.e., a version suffix).
  3. Prompt if we don't see a CACHEDIR.TAG (since we've always had this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionUndecided if this should be done

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions