()
| 25 | |
| 26 | |
| 27 | def main(): |
| 28 | # Step 1: Delete /dist/* contents |
| 29 | shutil.rmtree("dist", ignore_errors=True) |
| 30 | |
| 31 | # Step 2: Increment version in setup.py |
| 32 | setup_path = "setup.py" |
| 33 | |
| 34 | with open(setup_path, "r") as file: |
| 35 | content = file.read() |
| 36 | current_version = re.search( |
| 37 | r"version=['\"](\d+\.\d+\.\d+)['\"]", content |
| 38 | ).group(1) |
| 39 | |
| 40 | new_version = increment_version(current_version) |
| 41 | update_version_in_file(setup_path, new_version) |
| 42 | |
| 43 | # Step 3: Run sdist and bdist_wheel |
| 44 | subprocess.run(["python", "setup.py", "sdist", "bdist_wheel"], check=True) |
| 45 | |
| 46 | # ensure your creds are in ~/.pypirc |
| 47 | # Step 4: Upload with twine |
| 48 | subprocess.run( |
| 49 | [ |
| 50 | "python3", |
| 51 | "-m", |
| 52 | "twine", |
| 53 | "upload", |
| 54 | "dist/*", |
| 55 | ], |
| 56 | check=True, |
| 57 | ) |
| 58 | |
| 59 | |
| 60 | if __name__ == "__main__": |
no test coverage detected