swiffer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
swiffer-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: swiffer
3
+ Version: 0.1.0
4
+ Summary: Clean Python project junk
5
+ Author: Griffin McManus
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+
9
+ # swiffer 🧹
10
+
11
+ Clean Python project junk instantly.
12
+
13
+ `swiffer` is a lightweight CLI tool that removes common Python build and
14
+ cache files from a project directory.
15
+
16
+ ## Install
17
+
18
+ ``` bash
19
+ pip install swiffer
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Clean the current directory:
25
+
26
+ ``` bash
27
+ swiffer
28
+ ```
29
+
30
+ Clean a specific directory:
31
+
32
+ ``` bash
33
+ swiffer path/to/project
34
+ ```
35
+
36
+ Preview what would be removed:
37
+
38
+ ``` bash
39
+ swiffer --dry
40
+ ```
41
+
42
+ ## What it removes
43
+
44
+ - `__pycache__/`
45
+ - `.pytest_cache/`
46
+ - `.mypy_cache/`
47
+ - `.ruff_cache/`
48
+ - `dist/`
49
+ - `build/`
50
+ - `*.egg-info/`
51
+ - `*.pyc`
52
+ - `.coverage`
53
+
54
+ ## Example
55
+
56
+ ``` bash
57
+ $ swiffer
58
+
59
+ ./build
60
+ ./dist
61
+ ./swiffer.egg-info
62
+ ./tests/__pycache__
63
+
64
+ 🧹 Removed 4 items.
65
+ ```
@@ -0,0 +1,57 @@
1
+ # swiffer 🧹
2
+
3
+ Clean Python project junk instantly.
4
+
5
+ `swiffer` is a lightweight CLI tool that removes common Python build and
6
+ cache files from a project directory.
7
+
8
+ ## Install
9
+
10
+ ``` bash
11
+ pip install swiffer
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ Clean the current directory:
17
+
18
+ ``` bash
19
+ swiffer
20
+ ```
21
+
22
+ Clean a specific directory:
23
+
24
+ ``` bash
25
+ swiffer path/to/project
26
+ ```
27
+
28
+ Preview what would be removed:
29
+
30
+ ``` bash
31
+ swiffer --dry
32
+ ```
33
+
34
+ ## What it removes
35
+
36
+ - `__pycache__/`
37
+ - `.pytest_cache/`
38
+ - `.mypy_cache/`
39
+ - `.ruff_cache/`
40
+ - `dist/`
41
+ - `build/`
42
+ - `*.egg-info/`
43
+ - `*.pyc`
44
+ - `.coverage`
45
+
46
+ ## Example
47
+
48
+ ``` bash
49
+ $ swiffer
50
+
51
+ ./build
52
+ ./dist
53
+ ./swiffer.egg-info
54
+ ./tests/__pycache__
55
+
56
+ 🧹 Removed 4 items.
57
+ ```
@@ -0,0 +1,14 @@
1
+ [project]
2
+ name = "swiffer"
3
+ version = "0.1.0"
4
+ description = "Clean Python project junk"
5
+ readme = "README.md"
6
+ authors = [{name="Griffin McManus"}]
7
+ requires-python = ">=3.9"
8
+
9
+ [project.scripts]
10
+ swiffer = "swiffer.cli:main"
11
+
12
+ [build-system]
13
+ requires = ["setuptools", "wheel"]
14
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,42 @@
1
+ from pathlib import Path
2
+ import shutil
3
+
4
+ DIR_PATTERNS = {
5
+ "__pycache__",
6
+ ".pytest_cache",
7
+ "dist",
8
+ "build",
9
+ ".mypy_cache",
10
+ ".ruff_cache",
11
+ "htmlcov",
12
+ }
13
+
14
+ FILE_PATTERNS = (
15
+ "*.pyc",
16
+ "*.pyo",
17
+ ".coverage",
18
+ )
19
+
20
+
21
+ def clean(path: Path, dry_run: bool = False):
22
+ removed = []
23
+
24
+ for p in path.rglob("*"):
25
+
26
+ if p.is_dir() and (p.name in DIR_PATTERNS or p.name.endswith(".egg-info")):
27
+ removed.append(p)
28
+
29
+ if not dry_run:
30
+ shutil.rmtree(p, ignore_errors=True)
31
+
32
+ elif p.is_file():
33
+ for pattern in FILE_PATTERNS:
34
+ if p.match(pattern):
35
+ removed.append(p)
36
+
37
+ if not dry_run:
38
+ p.unlink(missing_ok=True)
39
+
40
+ break
41
+
42
+ return removed
@@ -0,0 +1,32 @@
1
+ import sys
2
+ from pathlib import Path
3
+ from .cleaner import clean
4
+
5
+
6
+ def main():
7
+ args = sys.argv[1:]
8
+
9
+ path = "."
10
+ dry_run = False
11
+
12
+ for arg in args:
13
+ if arg == "--dry":
14
+ dry_run = True
15
+ else:
16
+ path = arg
17
+
18
+ target = Path(path).resolve()
19
+
20
+ removed = clean(target, dry_run=dry_run)
21
+
22
+ if not removed:
23
+ print("✨ Nothing to clean.")
24
+ return
25
+
26
+ for item in removed:
27
+ print(item)
28
+
29
+ if dry_run:
30
+ print(f"\n{len(removed)} items would be removed.")
31
+ else:
32
+ print(f"\n🧹 Removed {len(removed)} items.")
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: swiffer
3
+ Version: 0.1.0
4
+ Summary: Clean Python project junk
5
+ Author: Griffin McManus
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+
9
+ # swiffer 🧹
10
+
11
+ Clean Python project junk instantly.
12
+
13
+ `swiffer` is a lightweight CLI tool that removes common Python build and
14
+ cache files from a project directory.
15
+
16
+ ## Install
17
+
18
+ ``` bash
19
+ pip install swiffer
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Clean the current directory:
25
+
26
+ ``` bash
27
+ swiffer
28
+ ```
29
+
30
+ Clean a specific directory:
31
+
32
+ ``` bash
33
+ swiffer path/to/project
34
+ ```
35
+
36
+ Preview what would be removed:
37
+
38
+ ``` bash
39
+ swiffer --dry
40
+ ```
41
+
42
+ ## What it removes
43
+
44
+ - `__pycache__/`
45
+ - `.pytest_cache/`
46
+ - `.mypy_cache/`
47
+ - `.ruff_cache/`
48
+ - `dist/`
49
+ - `build/`
50
+ - `*.egg-info/`
51
+ - `*.pyc`
52
+ - `.coverage`
53
+
54
+ ## Example
55
+
56
+ ``` bash
57
+ $ swiffer
58
+
59
+ ./build
60
+ ./dist
61
+ ./swiffer.egg-info
62
+ ./tests/__pycache__
63
+
64
+ 🧹 Removed 4 items.
65
+ ```
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ swiffer/__init__.py
4
+ swiffer/cleaner.py
5
+ swiffer/cli.py
6
+ swiffer.egg-info/PKG-INFO
7
+ swiffer.egg-info/SOURCES.txt
8
+ swiffer.egg-info/dependency_links.txt
9
+ swiffer.egg-info/entry_points.txt
10
+ swiffer.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ swiffer = swiffer.cli:main
@@ -0,0 +1 @@
1
+ swiffer