@@ -15,11 +15,15 @@ def check_code_style(context: Context) -> None:
1515 PROJECT_PATH = 'twitter_video_tools'
1616 init_colorama ()
1717
18+ print (f'{ Fore .MAGENTA } ==========Check Code Styles with `isort`=========={ Fore .GREEN } ' )
19+ context .run (f'isort { PROJECT_PATH } --check --diff' , pty = True )
20+ print (f'{ Fore .GREEN } isort: Success{ Fore .RESET } ' )
21+
1822 print (f'{ Fore .MAGENTA } ==========Check Code Styles with `yapf`=========={ Fore .RESET } ' )
1923 context .run (f'yapf --diff --recursive --parallel { PROJECT_PATH } ' , pty = True )
20- print (f'{ Fore .GREEN } Yapf : Success{ Fore .RESET } ' )
24+ print (f'{ Fore .GREEN } yapf : Success{ Fore .RESET } ' )
2125
22- print (f'\n { Fore .MAGENTA } ==========Check Code Styles with `pylint`=========={ Fore .GREEN } ' )
26+ print (f'{ Fore .MAGENTA } ==========Check Code Styles with `pylint`=========={ Fore .GREEN } ' )
2327 context .run (f'pylint { PROJECT_PATH } ' , pty = True )
2428
2529
@@ -42,6 +46,32 @@ def test(context: Context) -> None:
4246 context .run ('pytest . --cov=. --cov-report=xml' , pty = True )
4347
4448
49+ @task
50+ def format_code (context : Context ) -> None :
51+ """Format code."""
52+ PROJECT_PATH = 'twitter_video_tools'
53+ init_colorama ()
54+
55+ print (f'{ Fore .MAGENTA } ==========Format code with `isort`=========={ Fore .RESET } ' )
56+ context .run (f'isort { PROJECT_PATH } ' , pty = True )
57+
58+ print (f'\n { Fore .MAGENTA } ==========Format code with `yapf`=========={ Fore .RESET } ' )
59+ context .run (f'yapf --in-place --recursive --parallel { PROJECT_PATH } ' , pty = True )
60+
61+
62+ @task
63+ def generate_type_hints (context : Context ) -> None :
64+
65+ def _monkeytype_run () -> None :
66+ init_colorama ()
67+ context .run ('monkeytype --disable-type-rewriting run -m pytest' )
68+
69+ _monkeytype_run ()
70+ context .run ('monkeytype list-modules | xargs -n1 -I{} sh -c \' monkeytype apply {}\' ' )
71+
72+ format_code (context )
73+
74+
4575@task
4676def release (context : Context , version : str ) -> None :
4777 """Build & Publish to PyPI."""
0 commit comments