77PACKAGE_FILE = pathlib .Path ("socketsecurity/__init__.py" )
88VERSION_PATTERN = re .compile (r"__version__\s*=\s*['\"]([^'\"]+)['\"]" )
99
10- def get_hatch_version (full = False ):
11- raw = subprocess .check_output (["hatch" , "version" ], text = True ).strip ()
12- if full :
13- return raw
14- return raw . split ( ".dev" )[ 0 ]. split ( "+" )[ 0 ] # Just base version
10+ def get_hatch_version (full = False , strip_local = False ):
11+ version = subprocess .check_output (["hatch" , "version" ], text = True ).strip ()
12+ if not full or strip_local :
13+ version = version . split ( "+" )[ 0 ] # strip local metadata
14+ return version
1515
1616def get_current_version ():
1717 content = PACKAGE_FILE .read_text ()
@@ -25,7 +25,7 @@ def update_version(new_version):
2525
2626def main ():
2727 full_mode = "--dev" in sys .argv
28- hatch_version = get_hatch_version (full = full_mode )
28+ hatch_version = get_hatch_version (full = full_mode , strip_local = full_mode )
2929 current_version = get_current_version ()
3030
3131 if not current_version :
@@ -35,8 +35,6 @@ def main():
3535 if hatch_version != current_version :
3636 print (f"🔁 Updating version: { current_version } → { hatch_version } " )
3737 update_version (hatch_version )
38-
39- # In --dev mode, we don't fail — we expect this to update it
4038 return 0 if full_mode else 1
4139
4240 print (f"✅ Version is in sync: { hatch_version } " )
0 commit comments