-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.py
73 lines (54 loc) · 2.02 KB
/
Build.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
"""Build tasks for this python project."""
import sys
from pathlib import Path
import typer
from dbrownell_Common import PathEx
from dbrownell_DevTools.RepoBuildTools import Python as RepoBuildTools
from typer.core import TyperGroup
# ----------------------------------------------------------------------
class NaturalOrderGrouper(TyperGroup):
# pylint: disable=missing-class-docstring
# ----------------------------------------------------------------------
def list_commands(self, *args, **kwargs): # pylint: disable=unused-argument
return self.commands.keys()
# ----------------------------------------------------------------------
app = typer.Typer(
cls=NaturalOrderGrouper,
help=__doc__,
no_args_is_help=True,
pretty_exceptions_show_locals=False,
pretty_exceptions_enable=False,
)
# ----------------------------------------------------------------------
this_dir = PathEx.EnsureDir(Path(__file__).parent)
src_dir = PathEx.EnsureDir(this_dir / "src")
package_dir = PathEx.EnsureDir(src_dir / "dbrownell_Common")
# ----------------------------------------------------------------------
Black = RepoBuildTools.BlackFuncFactory(this_dir, app)
Pylint = RepoBuildTools.PylintFuncFactory(
package_dir,
app,
default_min_score=9.5,
)
Pytest = RepoBuildTools.PytestFuncFactory(
this_dir,
package_dir.name,
app,
default_min_coverage=80.0, # TODO: Increase coverage to 90%
)
UpdateVersion = RepoBuildTools.UpdateVersionFuncFactory(
src_dir,
PathEx.EnsureFile(package_dir / "__init__.py"),
app,
)
Package = RepoBuildTools.PackageFuncFactory(this_dir, app)
Publish = RepoBuildTools.PublishFuncFactory(this_dir, app)
CreateDockerImage = RepoBuildTools.CreateDockerImageFuncFactory(
this_dir,
app,
)
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
if __name__ == "__main__":
sys.exit(app())