Skip to main content

Merge pull request #13 from alexwlchan/ipynb-checkpoints

ID
f9b696a
date
2024-08-16 22:43:11+00:00
author
Alex Chan <alex@alexwlchan.net>
parents
7daaf05, aa233a1
message
Merge pull request #13 from alexwlchan/ipynb-checkpoints

Delete empty folders which only contain an `.ipynb_checkpoints` folder
changed files
5 files, 16 additions, 3 deletions

Changed files

CHANGELOG.md (298) → CHANGELOG.md (390)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff35f35..69f1557 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,12 @@
 # Changelog
 
+## v1.1.2 - 2024-08-16
+
+Delete empty folders which only contain an `.ipynb_checkpoints` folder.
+
 ## v1.1.1 - 2024-07-27
 
-Also delete empty folders which only contain a `desktop.ini` file.
+Delete empty folders which only contain a `desktop.ini` file.
 
 ## v1.1.0 - 2024-07-27
 

Cargo.lock (13005) → Cargo.lock (13005)

diff --git a/Cargo.lock b/Cargo.lock
index c192320..9c349b2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -115,7 +115,7 @@ dependencies = [
 
 [[package]]
 name = "emptydir"
-version = "1.1.1"
+version = "1.1.2"
 dependencies = [
  "clap",
  "colored",

Cargo.toml (203) → Cargo.toml (203)

diff --git a/Cargo.toml b/Cargo.toml
index 27976dc..d0073d0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "emptydir"
-version = "1.1.1"
+version = "1.1.2"
 edition = "2021"
 
 [dependencies]

src/can_be_deleted.rs (4330) → src/can_be_deleted.rs (4504)

diff --git a/src/can_be_deleted.rs b/src/can_be_deleted.rs
index 3415d86..84108ec 100644
--- a/src/can_be_deleted.rs
+++ b/src/can_be_deleted.rs
@@ -34,6 +34,8 @@ pub fn can_be_deleted(path: &Path) -> bool {
     //
     // *  .DS_Store stores some folder attributes used for showing the folder
     //    in the Finder, which I don't need to keep
+    // *  `.ipynb_checkpoints` is a folder used by Jupyter Notebooks, but not
+    //    important if I've deleted the notebooks
     // *  `.venv` is the name I use for virtual environments, which I can
     //    easily regenerate if necessary
     // *  `__pycache__` is the bytecode cache in Python projects, which is
@@ -45,6 +47,7 @@ pub fn can_be_deleted(path: &Path) -> bool {
     //
     let deletable_names = HashSet::from([
         OsString::from(".ds_store"),
+        OsString::from(".ipynb_checkpoints"),
         OsString::from(".venv"),
         OsString::from("__pycache__"),
         OsString::from("desktop.ini"),

src/emptydir.rs (4326) → src/emptydir.rs (4571)

diff --git a/src/emptydir.rs b/src/emptydir.rs
index 8ffcbe1..e333c87 100644
--- a/src/emptydir.rs
+++ b/src/emptydir.rs
@@ -94,6 +94,9 @@ mod test_emptydir {
         let dir = test_dir();
 
         //    .
+        //    ├─ .ipynb_checkpoints/
+        //    │   └─ analysis-checkpoint.ipynb
+        //    │
         //    ├─ .venv/
         //    │   └─ bin/
         //    │       └─ mypython.py
@@ -108,6 +111,9 @@ mod test_emptydir {
         create_dir(&dir.join(".venv"));
         create_file(dir.join(".venv/bin/mypython.py"));
 
+        create_dir(&dir.join(".ipynb_checkpoints"));
+        create_file(dir.join(".ipynb_checkpoints/analysis-checkpoint.ipynb"));
+
         create_dir(&dir.join("__pycache__"));
         create_file(dir.join("__pycache__/myfile.pyc"));