Skip to content

Instantly share code, notes, and snippets.

@ogvalt
Created April 18, 2024 10:54
Show Gist options
  • Save ogvalt/932644a3394d44795bc86c4c48696a78 to your computer and use it in GitHub Desktop.
Save ogvalt/932644a3394d44795bc86c4c48696a78 to your computer and use it in GitHub Desktop.
This is my standard taskfile for my python projects. Pre-commit, poetry, mypy, pytest
version: '3'
dotenv: ['.env']
tasks:
setup:
desc: Setup development environment
cmds:
- poetry run pre-commit install
- poetry run pre-commit install --hook-type commit-msg
- poetry install
lint:
desc: Run pre-commit manually
cmds:
- poetry run pre-commit run --all-files
mypy:
desc: Run mypy
cmds:
- poetry run pre-commit run --all-files mypy
test:
desc: Run tests
cmds:
- poetry run pytest -v --show-capture=all
coverage:
desc: Run coverage
cmds:
- poetry run pytest -v --junitxml=report.xml --cov="inference_sdk" --cov-fail-under=$COVERAGE_THRESHOLD .
clean-cache:
desc: Clean python, pytest, ruff, mypy caches
cmds:
- find . ! -path "*/.venv/*" -name "__pycache__" -exec rm -rv {} +
- find . -name ".pytest_cache" -exec rm -rv {} +
- find . -name ".ruff_cache" -exec rm -rv {} +
- find . -name ".mypy_cache" -exec rm -rv {} +
- find . -name ".coverage" -exec rm -rv {} +
- find . -name "report.xml" -exec rm -rv {} +
clean:
desc: Clean all
deps: [clean-cache]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment