Files
Limitex-ComfyUI-Diffusers/Taskfile.yml
2025-11-09 01:28:26 +09:00

176 lines
4.5 KiB
YAML

version: '3'
vars:
PYTHON_SRC: "src"
PYTHON_TESTS: "tests"
LINT_TARGETS: "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 {{.LINT_TARGETS}}
format:check:
desc: "Check code formatting without making changes"
cmds:
- poetry run ruff format {{.LINT_TARGETS}} --check
lint:
desc: "Run linting with ruff"
cmds:
- poetry run ruff check {{.LINT_TARGETS}}
lint:fix:
desc: "Run linting with auto-fix"
cmds:
- poetry run ruff check {{.LINT_TARGETS}} --fix
type:
desc: "Run static type checking using mypy"
cmds:
- poetry run mypy {{.PYTHON_SRC}}
fix:
desc: "Auto-fix all formatting and linting issues"
cmds:
- task: format
- task: lint:fix
check:
desc: "Run all checks (format check, lint, type check, and tests)"
cmds:
- task: format:check
- task: lint
- task: type
- task: test
test:
desc: "Run tests using pytest"
cmds:
- poetry run pytest {{.PYTHON_TESTS}}
test:verbose:
desc: "Run tests with verbose output"
cmds:
- poetry run pytest -v {{.PYTHON_TESTS}}
test:cov:
desc: "Run tests with coverage report"
cmds:
- poetry run pytest --cov={{.PYTHON_SRC}} {{.PYTHON_TESTS}} --cov-report=html --cov-report=term
build:
desc: "Build sdist and wheel"
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
export:all:
desc: "Export both prod and dev requirements"
cmds:
- task: export
- task: export:dev
lookup:
desc: "Check available versions of a package on PyPI (usage: task lookup -- requests)"
cmds:
- poetry run pip index versions {{.CLI_ARGS}}
preconditions:
- sh: "[ -n '{{.CLI_ARGS}}' ]"
msg: "CLI_ARGS must be set (e.g., task lookup -- requests)"
tree:
desc: "Show dependency tree of a package (usage: task tree -- requests)"
cmds:
- poetry show {{.CLI_ARGS}} --tree
preconditions:
- sh: "[ -n '{{.CLI_ARGS}}' ]"
msg: "CLI_ARGS must be set (e.g., task tree -- requests)"
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