swydd/tasks.py

30 lines
527 B
Python
Raw Normal View History

2024-03-05 13:52:37 -06:00
#!/usr/bin/env python3
2024-03-08 12:54:35 -06:00
__import__("sys").path.append("src") # noqa
2024-03-08 12:57:04 -06:00
import shutil
import sys
2024-03-05 13:52:37 -06:00
import swydd as s
2024-03-08 12:57:04 -06:00
@s.task
def bootstrap():
"""setup swydd dev environment"""
if not shutil.which("pdm"):
sys.exit("pdm necessary for swydd development")
s.sh("pdm install")
s.sh("pdm run pre-commit install")
2024-03-05 13:52:37 -06:00
@s.task
@s.option("types", "also run mypy")
2024-03-05 13:52:37 -06:00
def check(types: bool = False):
"""run pre-commit (and mypy)"""
s.sh("pre-commit run --all")
if types:
s.sh("mypy src/")
s.cli()