1414 "shadcn" : ROOT / "src" / "dashkit_shadcn" / "pyproject.toml" ,
1515}
1616
17- VERSION_RE = re .compile (r'^(\s*version\s*=\s*")(?P<ver>\d+\.\d+\.\d+)("\s*)$' , re .MULTILINE )
17+ VERSION_RE = re .compile (
18+ r'^(\s*version\s*=\s*")(?P<ver>\d+\.\d+\.\d+)("\s*)$' , re .MULTILINE
19+ )
1820PKG_CONSTRAINTS = {
1921 "table" : "dashkit_table" ,
2022 "kiboui" : "dashkit_kiboui" ,
@@ -41,12 +43,24 @@ def parse_args():
4143 help = "Prompt to select repos and bump type (default when no args)" ,
4244 )
4345 # Release/VC options
44- p .add_argument ("--commit" , action = "store_true" , help = "Create a Git commit with the changes" )
46+ p .add_argument (
47+ "--commit" , action = "store_true" , help = "Create a Git commit with the changes"
48+ )
4549 p .add_argument ("--tag" , action = "store_true" , help = "Create a Git tag after commit" )
46- p .add_argument ("--tag-name" , default = None , help = "Explicit tag name to create (overrides prefix+version)" )
47- p .add_argument ("--tag-prefix" , default = "v" , help = "Prefix for tag when --tag-name not provided (default: v)" )
50+ p .add_argument (
51+ "--tag-name" ,
52+ default = None ,
53+ help = "Explicit tag name to create (overrides prefix+version)" ,
54+ )
55+ p .add_argument (
56+ "--tag-prefix" ,
57+ default = "v" ,
58+ help = "Prefix for tag when --tag-name not provided (default: v)" ,
59+ )
4860 p .add_argument ("--push" , action = "store_true" , help = "Push commit and tag to remote" )
49- p .add_argument ("--remote" , default = "origin" , help = "Remote name for push (default: origin)" )
61+ p .add_argument (
62+ "--remote" , default = "origin" , help = "Remote name for push (default: origin)"
63+ )
5064 return p .parse_args ()
5165
5266
@@ -100,7 +114,7 @@ def update_root_constraints(root_path: Path, new_versions: dict[str, str]) -> bo
100114 pattern = re .compile (rf'("{ re .escape (pkg )} >=)(\d+\.\d+\.\d+)(")' )
101115
102116 def repl (mm : re .Match ) -> str :
103- return f"{ mm .group (1 )} { new_ver } { mm .group (3 )} "
117+ return f"{ mm .group (1 )} { new_ver } { mm .group (3 )} " # noqa: B023
104118
105119 new_content , n = pattern .subn (repl , content )
106120 if n :
@@ -113,8 +127,14 @@ def repl(mm: re.Match) -> str:
113127
114128# ---------------- Git helpers -----------------
115129
130+
116131def _run_git (* args : str ) -> subprocess .CompletedProcess :
117- return subprocess .run (["git" , * args ], cwd = str (ROOT ), stdout = subprocess .PIPE , stderr = subprocess .PIPE , text = True )
132+ return subprocess .run (
133+ ["git" , * args ],
134+ cwd = str (ROOT ),
135+ capture_output = True ,
136+ text = True ,
137+ )
118138
119139
120140def _ensure_git_repo () -> bool :
@@ -145,9 +165,12 @@ def _git_push(remote: str, push_tags: bool) -> None:
145165
146166# ---------------- Interactive helpers -----------------
147167
168+
148169def _prompt_select_repos () -> list [str ]:
149170 keys = list (REPOS .keys ())
150- print ("Select repos to bump (comma-separated numbers or names; 'all' for all; blank to cancel):" )
171+ print (
172+ "Select repos to bump (comma-separated numbers or names; 'all' for all; blank to cancel):"
173+ )
151174 for i , k in enumerate (keys , 1 ):
152175 print (f" { i } ) { k } " )
153176 sel = input ("> " ).strip ()
@@ -175,7 +198,14 @@ def _prompt_select_repos() -> list[str]:
175198def _prompt_bump_type () -> str :
176199 print ("Select bump type [1] patch [2] minor [3] major (default: 1):" )
177200 sel = input ("> " ).strip ()
178- mapping = {"1" : "patch" , "2" : "minor" , "3" : "major" , "patch" : "patch" , "minor" : "minor" , "major" : "major" }
201+ mapping = {
202+ "1" : "patch" ,
203+ "2" : "minor" ,
204+ "3" : "major" ,
205+ "patch" : "patch" ,
206+ "minor" : "minor" ,
207+ "major" : "major" ,
208+ }
179209 if not sel :
180210 return "patch"
181211 kind = mapping .get (sel .lower ())
@@ -232,7 +262,9 @@ def main():
232262 bump_type = args .type
233263 unknown = [r for r in targets if r not in REPOS ]
234264 if unknown :
235- raise SystemExit (f"Unknown repos: { ', ' .join (unknown )} . Valid: { ', ' .join (REPOS )} " )
265+ raise SystemExit (
266+ f"Unknown repos: { ', ' .join (unknown )} . Valid: { ', ' .join (REPOS )} "
267+ )
236268
237269 bumped : dict [str , str ] = {}
238270 changed_paths : list [Path ] = []
@@ -257,7 +289,9 @@ def main():
257289 # Optionally commit, tag, and push
258290 if commit_flag or tag_flag or push_flag :
259291 if not _ensure_git_repo ():
260- raise SystemExit ("Not a Git repo (or Git not available); cannot commit/tag/push." )
292+ raise SystemExit (
293+ "Not a Git repo (or Git not available); cannot commit/tag/push."
294+ )
261295 if changed_paths :
262296 _git_add (changed_paths )
263297 commit_msg_parts = [f"{ name } { ver } " for name , ver in bumped .items ()]
@@ -279,13 +313,15 @@ def main():
279313 tags_to_create : list [tuple [str , str ]] = [] # (tag_name, message)
280314 if tag_name and len (bumped ) == 1 :
281315 # Single repo: respect explicit tag name
282- only_repo = next (iter (bumped .keys ()))
316+ next (iter (bumped .keys ()))
283317 tn = tag_name
284318 msg = f"Release { tn } ({ '; ' .join (commit_msg_parts )} )"
285319 tags_to_create .append ((tn , msg ))
286320 else :
287321 if tag_name and len (bumped ) > 1 :
288- print ("Note: --tag-name ignored when tagging multiple repos; using per-repo conventions." )
322+ print (
323+ "Note: --tag-name ignored when tagging multiple repos; using per-repo conventions."
324+ )
289325 for repo_key , ver in bumped .items ():
290326 prefix = TAG_PREFIXES .get (repo_key , tag_prefix )
291327 tn = f"{ prefix } { ver } "
0 commit comments