resume / tasks /cleans.py
Médéric Hurier (Fmind)
refactoring
13a7d69
raw
history blame
778 Bytes
"""Clean tasks for the project."""
# %% IMPORTS
from invoke import task
from invoke.context import Context
# %% TASKS
@task
def install(ctx: Context) -> None:
"""Clean the install."""
ctx.run("rm -rf .venv/")
@task
def mypy(ctx: Context) -> None:
"""Clean the mypy cache."""
ctx.run("rm -rf .mypy_cache/")
@task
def ruff(ctx: Context) -> None:
"""Clean the ruff cache."""
ctx.run("rm -rf .ruff_cache/")
@task
def python(ctx: Context) -> None:
"""Clean python files and folders."""
ctx.run("find . -type d -name __pycache__ -delete")
@task(pre=[mypy, ruff, python], default=True)
def all(_: Context) -> None:
"""Run all clean tasks."""
@task(pre=[install, all])
def reset(_: Context) -> None:
"""Reset the project state."""