MCPcopy Create free account
hub / github.com/Bytez-com/docs / update_version_in_file

Function update_version_in_file

sdk/python/deploy.py:13–24  ·  view source on GitHub ↗

Update the version in the setup.py file

(file_path, new_version)

Source from the content-addressed store, hash-verified

11
12
13def update_version_in_file(file_path, new_version):
14 """Update the version in the setup.py file"""
15 with open(file_path, "r") as file:
16 content = file.read()
17
18 # This assumes `version='x.y.z'` format; adjust regex as needed
19 new_content = re.sub(
20 r"(version=['\"])(\d+\.\d+\.\d+)([&#x27;\"])", f"\\g<1>{new_version}\\g<3>", content
21 )
22
23 with open(file_path, "w") as file:
24 file.write(new_content)
25
26
27def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected