Skip to content

Commit 0590438

Browse files
committed
refactor: Improve .gitignore and clean duty
Issue-5: pawamoy/copier-uv#5
1 parent 2dcda18 commit 0590438

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

project/.gitignore

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
# editors
12
.idea/
23
.vscode/
3-
__pycache__/
4-
*.py[cod]
5-
dist/
4+
5+
# python
66
*.egg-info/
7-
build/
8-
htmlcov/
7+
*.py[cod]
8+
.venv/
9+
.venvs/
10+
/build/
11+
/dist/
12+
13+
# tools
914
.coverage*
10-
pip-wheel-metadata/
15+
/.pdm-build/
16+
/htmlcov/
17+
/site/
18+
19+
# cache
20+
.cache/
1121
.pytest_cache/
1222
.mypy_cache/
1323
.ruff_cache/
14-
site/
15-
.venv/
16-
.venvs/
17-
.cache/
24+
__pycache__/

project/duties.py.jinja

+10-11
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,16 @@ def clean(ctx: Context) -> None:
156156
Parameters:
157157
ctx: The context instance (passed automatically).
158158
"""
159-
ctx.run("rm -rf .coverage*")
160-
ctx.run("rm -rf .mypy_cache")
161-
ctx.run("rm -rf .pytest_cache")
162-
ctx.run("rm -rf tests/.pytest_cache")
163-
ctx.run("rm -rf build")
164-
ctx.run("rm -rf dist")
165-
ctx.run("rm -rf htmlcov")
166-
ctx.run("rm -rf pip-wheel-metadata")
167-
ctx.run("rm -rf site")
168-
ctx.run("find . -type d -name __pycache__ | xargs rm -rf")
169-
ctx.run("find . -name '*.rej' -delete")
159+
def _rm(*targets: str) -> None:
160+
for target in targets:
161+
ctx.run(f"rm -rf {target}")
162+
163+
def _find_rm(*targets: str) -> None:
164+
for target in targets:
165+
ctx.run(f"find . -type d -name '{target}' | xargs rm -rf")
166+
167+
_rm("build", "dist", ".coverage*", "htmlcov", "site", ".pdm-build")
168+
_find_rm(".cache", ".pytest_cache", ".mypy_cache", ".ruff_cache", "__pycache__")
170169

171170

172171
@duty

0 commit comments

Comments
 (0)