-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtasks.py
41 lines (31 loc) · 975 Bytes
/
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
from invoke import task
@task
def setup(c, version=None):
"""
Setup dev environment, requires conda
"""
version = version or '3.9'
suffix = '' if version == '3.9' else version.replace('.', '')
env_name = f'nbsnapshot{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 .[dev]')
print(f'Done! Activate your environment with:\nconda activate {env_name}')
@task(aliases=['d'])
def doc(c):
"""Build documentation
"""
c.run('jupyter-book build doc')
@task(aliases=['v'])
def version(c):
"""Release 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)