@@ -144,34 +144,40 @@ def main():
144144 parser = argparse .ArgumentParser (description = "Bump the version of the package." )
145145 parser .add_argument (
146146 "part" ,
147+ nargs = "?" ,
147148 choices = ["major" , "minor" , "patch" ],
148- help = "The part of the version to bump" ,
149+ help = "The part of the version to bump (optional) " ,
149150 )
150151 args = parser .parse_args ()
151152
152153 current_version = get_current_version ()
153- new_version = bump_version (current_version , args .part )
154-
155- print (f"Bumping version from { current_version } to { new_version } " )
156-
157- update_setup_py (new_version )
158- update_init_py (new_version )
159- update_docs_conf_py (new_version )
160- update_changelog (new_version )
154+ if args .part :
155+ new_version = bump_version (current_version , args .part )
156+ print (f"Bumping version from { current_version } to { new_version } " )
157+
158+ update_setup_py (new_version )
159+ update_init_py (new_version )
160+ update_docs_conf_py (new_version )
161+ update_changelog (new_version )
162+
163+ print (f"Version bumped to { new_version } " )
164+ print ("Don't forget to commit the changes and create a new tag:" )
165+ print (f"git commit -am 'Bump version to { new_version } '" )
166+ else :
167+ new_version = current_version
168+ print ("Commands to run to create a new tag:" )
161169
162- print (f"Version bumped to { new_version } " )
163- print ("Don't forget to commit the changes and create a new tag:" )
164- print (f"git commit -am 'Bump version to { new_version } '" )
165170 print (f"git tag -a v{ new_version } -m 'Version { new_version } '" )
166171 print ("git push && git push --tags" )
167172 print ("\n Do you want to run the git commands now? (y/n)" )
168173 response = input ().strip ().lower ()
169174
170175 if response == "y" or response == "yes" :
171176 print ("Running git commands..." )
172- subprocess .run (
173- ["git" , "commit" , "-am" , f"Bump version to { new_version } " ], check = True , shell = False
174- ) # nosec B603
177+ if args .part :
178+ subprocess .run (
179+ ["git" , "commit" , "-am" , f"Bump version to { new_version } " ], check = True , shell = False
180+ ) # nosec B603
175181 subprocess .run (
176182 ["git" , "tag" , "-a" , f"v{ new_version } " , "-m" , f"Version { new_version } " ], check = True , shell = False
177183 ) # nosec B603
0 commit comments