forked from ploomber/sklearn-evaluation
/
tasks.py
47 lines (35 loc) · 1.17 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Setup tasks (requires invoke: pip install invoke)
"""
from invoke import task
@task
def setup(c, version=None):
"""
Setup dev environment, requires conda
"""
version = version or "3.10"
suffix = "" if version == "3.10" else version.replace(".", "")
env_name = f"sk-eval{suffix}"
c.run(f"conda create --name {env_name} python={version} --yes")
c.run(
'eval "$(conda shell.bash hook)" '
f"&& conda activate {env_name} "
"&& pip install --editable .[all] "
"&& pip install invoke lxml"
) # lxml needed for NotebookCollection.py example
print(f"Done! Activate your environment with:\nconda activate {env_name}")
@task(aliases=["d"])
def doc(c, strict=False):
"""Build docs"""
flags = "--warningiserror --keep-going" if strict else ""
c.run(f"jupyter-book build docs/ {flags}")
@task(aliases=["v"])
def version(c):
"""Create a new version"""
from pkgmt import versioneer
versioneer.version(project_root=".", tag=True)
@task(aliases=["r"])
def release(c, tag, production=True):
"""Upload to PyPI"""
from pkgmt import versioneer
versioneer.upload(tag, production=production)