-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
82 lines (61 loc) · 1.6 KB
/
fabfile.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from fabric.api import (
local,
task,
)
pypy = 'https://pypi.org'
test_pypy = 'https://test.pypi.org'
base_dir = 'flake8_hangover'
package_name = 'flake8-hangover'
# Code formatting
# ========================================================================
@task
def isort():
"""Fix imports formatting."""
local(f'isort {base_dir}')
@task
def pep8(path=base_dir):
"""Check PEP8 errors."""
return local(f'flake8 {path}')
# Pipenv
# ========================================================================
@task
def lock():
"""Lock dependencies."""
return local('pipenv lock')
@task
def install():
"""Install packages for local development."""
print('\npython3 -m pip install --user --upgrade twine') # noqa
return local('pipenv install --dev')
# Build & upload
# ========================================================================
@task
def clean():
"""Clean unused files before build."""
files = (
'build',
'dist',
'__pycache__',
'.DS_Store',
'.coverage_html',
'.mypy_cache',
f'{base_dir}.egg-info',
f'{base_dir}/__pycache__',
f'{base_dir}/.DS_Store',
)
local('rm -rf ' + ' '.join(files))
@task
def build():
"""Build package for pypy."""
clean()
local('python3 setup.py sdist bdist_wheel')
@task
def upload_to_dev():
"""Upload package to dev pypy."""
build()
local(f'python3 -m twine upload --repository-url {test_pypy}/legacy/ dist/*')
@task
def upload_to_prod():
"""Upload package to real pypy."""
build()
local('python3 -m twine upload dist/*')