-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev.py
More file actions
executable file
·105 lines (76 loc) · 1.9 KB
/
Copy pathdev.py
File metadata and controls
executable file
·105 lines (76 loc) · 1.9 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env -S poetry run python
import glob
import os
import shutil
import click
import sh
def python_source_files():
include_paths = (
glob.glob("*.py")
+ glob.glob("lacecore/*.py")
+ glob.glob("lacecore/**/*.py")
+ ["doc/"]
)
exclude_paths = []
return [x for x in include_paths if x not in exclude_paths]
@click.group()
def cli():
pass
@cli.command()
def install():
sh.poetry(
"install",
"--sync",
"--extras",
"doc",
"--extras",
"lint",
"--extras",
"format",
"--extras",
"test",
"--extras",
"cli",
"--extras",
"obj",
_fg=True,
)
@cli.command()
def test():
sh.pytest(_fg=True)
@cli.command()
def coverage():
sh.pytest("--cov=lacecore", _fg=True)
@cli.command()
def coverage_report():
sh.coverage("html", "--fail-under=0", _fg=True)
sh.open("htmlcov/index.html", _fg=True)
@cli.command()
def lint():
sh.flake8(*python_source_files(), _fg=True)
@cli.command()
def black():
sh.black(*python_source_files(), _fg=True)
@cli.command()
def black_check():
sh.black("--check", *python_source_files(), _fg=True)
@cli.command()
def doc():
sh.rm("-rf", "build/", "doc/build/", "doc/api/", _fg=True)
sh.Command("sphinx-build")("-W", "-b", "singlehtml", "doc", "doc/build", _fg=True)
@cli.command()
def doc_open():
sh.open("doc/build/index.html", _fg=True)
@cli.command()
def clean():
sh.find(".", "-name", "*.pyc", "-delete", _fg=True)
sh.find(".", "-name", "__pycache__", "-delete", _fg=True)
@cli.command()
def publish():
shutil.rmtree("dist", ignore_errors=True)
shutil.rmtree("build", ignore_errors=True)
sh.poetry("build", _fg=True)
sh.twine("upload", *glob.glob("dist/*"), _fg=True)
if __name__ == "__main__":
os.chdir(os.path.abspath(os.path.dirname(__file__)))
cli()