swydd/tasks.py

30 lines
533 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
2024-03-13 11:09:41 -05:00
@s.option("no-mypy", "skip mypy")
def check(no_mypy: bool = False):
2024-03-05 13:52:37 -06:00
"""run pre-commit (and mypy)"""
s.sh("pre-commit run --all")
2024-03-13 11:09:41 -05:00
if not no_mypy:
2024-03-05 13:52:37 -06:00
s.sh("mypy src/")
s.cli()