7
7
8
8
import click
9
9
10
- from jupyter_releaser import changelog
11
- from jupyter_releaser import lib
12
- from jupyter_releaser import npm
13
- from jupyter_releaser import python
14
- from jupyter_releaser import util
10
+ from jupyter_releaser import changelog , lib , npm , python , util
15
11
16
12
17
13
class ReleaseHelperGroup (click .Group ):
18
14
"""Click group tailored to jupyter-releaser"""
19
15
20
- _needs_checkout_dir = dict ()
16
+ _needs_checkout_dir = {}
21
17
22
18
def invoke (self , ctx ):
23
19
"""Handle jupyter-releaser config while invoking a command"""
24
20
# Get the command name and make sure it is valid
25
21
cmd_name = ctx .protected_args [0 ]
26
- if not cmd_name in self .commands :
22
+ if cmd_name not in self .commands :
27
23
super ().invoke (ctx )
28
24
29
25
if cmd_name == "list-envvars" :
30
- envvars = dict ()
26
+ envvars = {}
31
27
for cmd_name in self .commands :
32
28
for param in self .commands [cmd_name ].params :
33
29
if isinstance (param , click .Option ):
@@ -126,9 +122,7 @@ def list_commands(self, ctx):
126
122
127
123
128
124
@click .group (cls = ReleaseHelperGroup )
129
- @click .option (
130
- "--force" , default = False , help = "Force a command to run even when skipped by config"
131
- )
125
+ @click .option ("--force" , default = False , help = "Force a command to run even when skipped by config" )
132
126
def main (force ):
133
127
"""Jupyter Releaser scripts"""
134
128
pass
@@ -145,9 +139,7 @@ def main(force):
145
139
]
146
140
147
141
version_cmd_options = [
148
- click .option (
149
- "--version-cmd" , envvar = "RH_VERSION_COMMAND" , help = "The version command"
150
- )
142
+ click .option ("--version-cmd" , envvar = "RH_VERSION_COMMAND" , help = "The version command" )
151
143
]
152
144
153
145
@@ -161,9 +153,7 @@ def main(force):
161
153
click .option ("--auth" , envvar = "GITHUB_ACCESS_TOKEN" , help = "The GitHub auth token" ),
162
154
]
163
155
164
- username_options = [
165
- click .option ("--username" , envvar = "GITHUB_ACTOR" , help = "The git username" )
166
- ]
156
+ username_options = [click .option ("--username" , envvar = "GITHUB_ACTOR" , help = "The git username" )]
167
157
168
158
dist_dir_options = [
169
159
click .option (
@@ -195,15 +185,11 @@ def main(force):
195
185
]
196
186
197
187
dry_run_options = [
198
- click .option (
199
- "--dry-run" , is_flag = True , envvar = "RH_DRY_RUN" , help = "Run as a dry run"
200
- )
188
+ click .option ("--dry-run" , is_flag = True , envvar = "RH_DRY_RUN" , help = "Run as a dry run" )
201
189
]
202
190
203
191
204
- git_url_options = [
205
- click .option ("--git-url" , help = "A custom url for the git repository" )
206
- ]
192
+ git_url_options = [click .option ("--git-url" , help = "A custom url for the git repository" )]
207
193
208
194
209
195
changelog_path_options = [
@@ -370,9 +356,7 @@ def draft_changelog(
370
356
371
357
@main .command ()
372
358
@add_options (changelog_options )
373
- @click .option (
374
- "--output" , envvar = "RH_CHANGELOG_OUTPUT" , help = "The output file for changelog entry"
375
- )
359
+ @click .option ("--output" , envvar = "RH_CHANGELOG_OUTPUT" , help = "The output file for changelog entry" )
376
360
@use_checkout_dir ()
377
361
def check_changelog (
378
362
ref ,
@@ -414,9 +398,7 @@ def build_python(dist_dir, python_packages):
414
398
f"Skipping build-python in { python_package } since there are no python package files"
415
399
)
416
400
else :
417
- python .build_dist (
418
- Path (os .path .relpath ("." , python_package )) / dist_dir , clean = clean
419
- )
401
+ python .build_dist (Path (os .path .relpath ("." , python_package )) / dist_dir , clean = clean )
420
402
clean = False
421
403
os .chdir (prev_dir )
422
404
@@ -433,9 +415,7 @@ def check_python(dist_dir, check_imports, pydist_check_cmd):
433
415
util .log (f"Skipping non-python dist file { dist_file } " )
434
416
continue
435
417
436
- python .check_dist (
437
- dist_file , python_imports = check_imports , check_cmd = pydist_check_cmd
438
- )
418
+ python .check_dist (dist_file , python_imports = check_imports , check_cmd = pydist_check_cmd )
439
419
440
420
441
421
@main .command ()
@@ -528,13 +508,9 @@ def check_links(ignore_glob, ignore_links, cache_file, links_expire):
528
508
help = "Whether to skip tagging npm workspace packages" ,
529
509
)
530
510
@use_checkout_dir ()
531
- def tag_release (
532
- dist_dir , release_message , tag_format , tag_message , no_git_tag_workspace
533
- ):
511
+ def tag_release (dist_dir , release_message , tag_format , tag_message , no_git_tag_workspace ):
534
512
"""Create release commit and tag"""
535
- lib .tag_release (
536
- dist_dir , release_message , tag_format , tag_message , no_git_tag_workspace
537
- )
513
+ lib .tag_release (dist_dir , release_message , tag_format , tag_message , no_git_tag_workspace )
538
514
539
515
540
516
@main .command ()
@@ -698,9 +674,7 @@ def publish_release(auth, release_url):
698
674
@add_options (dry_run_options )
699
675
@click .argument ("release-url" )
700
676
@use_checkout_dir ()
701
- def forwardport_changelog (
702
- auth , ref , branch , repo , username , changelog_path , dry_run , release_url
703
- ):
677
+ def forwardport_changelog (auth , ref , branch , repo , username , changelog_path , dry_run , release_url ):
704
678
"""Forwardport Changelog Entries to the Default Branch"""
705
679
lib .forwardport_changelog (
706
680
auth , ref , branch , repo , username , changelog_path , dry_run , release_url
0 commit comments