Update the version in the setup.py file
(file_path, new_version)
| 11 | |
| 12 | |
| 13 | def 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+)(['\"])", 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 | |
| 27 | def main(): |