Files
Limitex-ComfyUI-Diffusers/Taskfile.yml
T
2025-11-09 00:42:08 +09:00

153 lines
3.9 KiB
YAML

version: '3'
vars:
PYTHON_DIRS: "src tests"
tasks:
default:
desc: "List all available tasks"
cmds:
- task --list
install:
desc: "Install all dependencies (including dev) based on poetry.lock"
cmds:
- poetry install
- task: export
install:prod:
desc: "Install only production dependencies"
cmds:
- poetry install --without dev
- task: export
update:
desc: "Update dependencies based on pyproject.toml and regenerate poetry.lock"
cmds:
- poetry update
- task: export
add:
desc: "Add a new production dependency (usage: task add -- requests)"
cmds:
- poetry add {{.CLI_ARGS}}
- task: export
preconditions:
- sh: "[ -n '{{.CLI_ARGS}}' ]"
msg: "CLI_ARGS must be set (e.g., task add -- requests)"
add:dev:
desc: "Add a new development dependency (usage: task add:dev -- pytest)"
cmds:
- poetry add {{.CLI_ARGS}} --group dev
- task: export
preconditions:
- sh: "[ -n '{{.CLI_ARGS}}' ]"
msg: "CLI_ARGS must be set (e.g., task add:dev -- pytest)"
remove:
desc: "Remove a dependency (usage: task remove -- requests)"
cmds:
- poetry remove {{.CLI_ARGS}}
- task: export
preconditions:
- sh: "[ -n '{{.CLI_ARGS}}' ]"
msg: "CLI_ARGS must be set (e.g., task remove -- requests)"
shell:
desc: "Activate the virtual environment shell managed by Poetry"
cmds:
- poetry shell
run:
desc: "Run a command within the virtual environment (usage: task run -- python main.py)"
cmds:
- poetry run {{.CLI_ARGS}}
preconditions:
- sh: "[ -n '{{.CLI_ARGS}}' ]"
msg: "CLI_ARGS must be set (e.g., task run -- python main.py)"
format:
desc: "Automatically format code using Ruff"
cmds:
- poetry run ruff format {{.PYTHON_DIRS}} __init__.py
- poetry run ruff check {{.PYTHON_DIRS}} __init__.py --fix
format:check:
desc: "Check code formatting without making changes"
cmds:
- poetry run ruff format {{.PYTHON_DIRS}} __init__.py --check
lint:
desc: "Run linting with ruff"
cmds:
- poetry run ruff check {{.PYTHON_DIRS}} __init__.py
lint:fix:
desc: "Run linting with auto-fix"
cmds:
- poetry run ruff check {{.PYTHON_DIRS}} __init__.py --fix
type:
desc: "Run static type checking using mypy"
cmds:
- poetry run mypy {{.PYTHON_DIRS}} __init__.py
test:
desc: "Run tests using pytest"
cmds:
- poetry run pytest
test:verbose:
desc: "Run tests with verbose output"
cmds:
- poetry run pytest -v
test:cov:
desc: "Run tests with coverage report"
cmds:
- poetry run pytest --cov={{.PYTHON_DIRS}} --cov-report=html --cov-report=term
check:
desc: "Run all checks (format check, lint, type check, and tests)"
cmds:
- task: format:check
- task: lint
- task: type
- task: test
fix:
desc: "Auto-fix all formatting and linting issues"
cmds:
- task: format
- task: lint:fix
build:
desc: "Build sdist (source distribution) and wheel (built distribution)"
cmds:
- poetry build
export:
desc: "Export production dependencies to requirements.txt"
cmds:
- poetry export -f requirements.txt --output requirements.txt --without-hashes
export:dev:
desc: "Export all dependencies (including dev) to requirements-dev.txt"
cmds:
- poetry export -f requirements.txt --output requirements-dev.txt --without-hashes --with dev
clean:
desc: "Clean up cache and temporary files"
cmds:
- rm -rf .pytest_cache
- rm -rf .mypy_cache
- rm -rf .ruff_cache
- rm -rf htmlcov
- rm -rf .coverage
- rm -rf dist
- rm -rf build
- find . -type d -name __pycache__ -exec rm -rf {} +
- find . -type d -name "*.egg-info" -exec rm -rf {} +
- find . -type f -name "*.pyc" -delete