@@ -31,11 +31,19 @@ def find_packages() -> List[Path]:
3131 return sorted (packages )
3232
3333
34- def dry_run_version_bump (package_path : Path , bump_type : str ) -> str :
35- """Run a dry-run version bump to see what the new version would be."""
34+ def dry_run_version_bump (package_path : Path , bump_types : List [str ]) -> str :
35+ """Run a dry-run version bump to see what the new version would be.
36+
37+ Accepts one or more bump types and passes multiple --bump flags to `uv`.
38+ """
3639 try :
40+ cmd = ["uv" , "version" ]
41+ for bt in bump_types :
42+ cmd .extend (["--bump" , bt ])
43+ cmd .append ("--dry-run" )
44+
3745 result = subprocess .run (
38- [ "uv" , "version" , "--bump" , bump_type , "--dry-run" ] ,
46+ cmd ,
3947 cwd = package_path ,
4048 capture_output = True ,
4149 text = True ,
@@ -60,13 +68,20 @@ def dry_run_version_bump(package_path: Path, bump_type: str) -> str:
6068 sys .exit (1 )
6169
6270
63- def bump_package_version (package_path : Path , bump_type : str , verbose : bool = False ) -> str :
64- """Bump the version of a package and return the new version."""
65- print (f"Bumping { package_path .name } version ({ bump_type } )..." )
71+ def bump_package_version (package_path : Path , bump_types : List [str ], verbose : bool = False ) -> str :
72+ """Bump the version of a package and return the new version.
73+
74+ Accepts one or more bump types and passes multiple --bump flags to `uv`.
75+ """
76+ print (f"Bumping { package_path .name } version ({ ', ' .join (bump_types )} )..." )
6677
6778 try :
79+ cmd = ["uv" , "version" ]
80+ for bt in bump_types :
81+ cmd .extend (["--bump" , bt ])
82+
6883 result = subprocess .run (
69- [ "uv" , "version" , "--bump" , bump_type ] ,
84+ cmd ,
7085 cwd = package_path ,
7186 capture_output = not verbose ,
7287 text = True ,
@@ -134,9 +149,13 @@ def main() -> None:
134149 )
135150
136151 parser .add_argument (
137- "bump_type" ,
152+ "bump_types" ,
153+ nargs = "+" ,
138154 choices = ["major" , "minor" , "patch" , "stable" , "alpha" , "beta" , "rc" , "post" , "dev" ],
139- help = "Type of version bump to perform" ,
155+ help = (
156+ "One or two bump types to perform (e.g. 'major' or 'major alpha'). "
157+ "If two are provided, the second will be passed as an additional --bump to uv."
158+ ),
140159 )
141160 parser .add_argument (
142161 "-v" ,
@@ -147,6 +166,11 @@ def main() -> None:
147166
148167 args = parser .parse_args ()
149168
169+ # Validate that at most two bump types were provided
170+ if len (args .bump_types ) > 2 :
171+ print ("Error: Provide at most two bump types (e.g. 'major' or 'major alpha')." )
172+ sys .exit (1 )
173+
150174 # Find all packages
151175 packages = find_packages ()
152176 if not packages :
@@ -162,7 +186,7 @@ def main() -> None:
162186 print ("Running dry-run to check version consistency..." )
163187 dry_run_versions : Dict [str , str ] = {}
164188 for package in packages :
165- new_version = dry_run_version_bump (package , args .bump_type )
189+ new_version = dry_run_version_bump (package , args .bump_types )
166190 dry_run_versions [package .name ] = new_version
167191 print (f" { package .name } : { get_package_version (package )} -> { new_version } " )
168192
@@ -182,7 +206,7 @@ def main() -> None:
182206 # Now do the actual version bump
183207 versions : Dict [str , str ] = {}
184208 for package in packages :
185- new_version = bump_package_version (package , args .bump_type , args .verbose )
209+ new_version = bump_package_version (package , args .bump_types , args .verbose )
186210 versions [package .name ] = new_version
187211
188212 # Verify all packages have the same version (should always pass now)
0 commit comments