This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
carboncopy/tasks.py

42 lines
699 B
Python
Raw Normal View History

from invoke import Collection, task
TMP_PATH = "/tmp/carboncopy_pytest/"
@task
def format_all(ctx):
ctx.run("black src *.py")
@task
def typecheck(ctx):
ctx.run("mypy src")
@task
def package(ctx):
ctx.run("rm -rf dist && python setup.py sdist bdist_wheel")
@task(optional=["test"])
def publish(ctx, test=False):
if test:
ctx.run(
"twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*"
)
else:
ctx.run("twine upload dist/*")
@task
def test(ctx):
ctx.run("pytest")
ns = Collection()
ns.add_task(format_all, name="format")
ns.add_task(typecheck)
ns.add_task(package)
ns.add_task(publish)
ns.add_task(test)