1
+ # mypy: disallow-untyped-defs
1
2
"""Invoke development tasks."""
2
3
import argparse
3
4
import os
10
11
from colorama import init
11
12
12
13
13
- def announce (version , template_name , doc_version ) :
14
+ def announce (version : str , template_name : str , doc_version : str ) -> None :
14
15
"""Generates a new release announcement entry in the docs."""
15
16
# Get our list of authors
16
- stdout = check_output (["git" , "describe" , "--abbrev=0" , "--tags" ])
17
- stdout = stdout .decode ("utf-8" )
17
+ stdout = check_output (["git" , "describe" , "--abbrev=0" , "--tags" ], encoding = "UTF-8" )
18
18
last_version = stdout .strip ()
19
19
20
- stdout = check_output (["git" , "log" , f"{ last_version } ..HEAD" , "--format=%aN" ])
21
- stdout = stdout .decode ("utf-8" )
20
+ stdout = check_output (
21
+ ["git" , "log" , f"{ last_version } ..HEAD" , "--format=%aN" ], encoding = "UTF-8"
22
+ )
22
23
23
24
contributors = {
24
25
name
@@ -61,7 +62,7 @@ def announce(version, template_name, doc_version):
61
62
check_call (["git" , "add" , str (target )])
62
63
63
64
64
- def regen (version ) :
65
+ def regen (version : str ) -> None :
65
66
"""Call regendoc tool to update examples and pytest output in the docs."""
66
67
print (f"{ Fore .CYAN } [generate.regen] { Fore .RESET } Updating docs" )
67
68
check_call (
@@ -70,21 +71,23 @@ def regen(version):
70
71
)
71
72
72
73
73
- def fix_formatting ():
74
+ def fix_formatting () -> None :
74
75
"""Runs pre-commit in all files to ensure they are formatted correctly"""
75
76
print (
76
77
f"{ Fore .CYAN } [generate.fix linting] { Fore .RESET } Fixing formatting using pre-commit"
77
78
)
78
79
call (["pre-commit" , "run" , "--all-files" ])
79
80
80
81
81
- def check_links ():
82
+ def check_links () -> None :
82
83
"""Runs sphinx-build to check links"""
83
84
print (f"{ Fore .CYAN } [generate.check_links] { Fore .RESET } Checking links" )
84
85
check_call (["tox" , "-e" , "docs-checklinks" ])
85
86
86
87
87
- def pre_release (version , template_name , doc_version , * , skip_check_links ):
88
+ def pre_release (
89
+ version : str , template_name : str , doc_version : str , * , skip_check_links : bool
90
+ ) -> None :
88
91
"""Generates new docs, release announcements and creates a local tag."""
89
92
announce (version , template_name , doc_version )
90
93
regen (version )
@@ -102,12 +105,12 @@ def pre_release(version, template_name, doc_version, *, skip_check_links):
102
105
print ("Please push your branch and open a PR." )
103
106
104
107
105
- def changelog (version , write_out = False ):
108
+ def changelog (version : str , write_out : bool = False ) -> None :
106
109
addopts = [] if write_out else ["--draft" ]
107
110
check_call (["towncrier" , "--yes" , "--version" , version ] + addopts )
108
111
109
112
110
- def main ():
113
+ def main () -> None :
111
114
init (autoreset = True )
112
115
parser = argparse .ArgumentParser ()
113
116
parser .add_argument ("version" , help = "Release version" )
0 commit comments