From b146cb1d069a067ff6c42dbdca7a3652b08898dc Mon Sep 17 00:00:00 2001 From: MilesCranmerBot Date: Sat, 18 Apr 2026 20:26:26 +0000 Subject: [PATCH 1/2] fix: keep prerelease manifest unchanged Co-authored-by: Miles Cranmer --- .github/workflows/update_backend.yml | 3 +-- .github/workflows/update_backend_version.py | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/update_backend.yml b/.github/workflows/update_backend.yml index ea9c051e4..96da6fd3b 100644 --- a/.github/workflows/update_backend.yml +++ b/.github/workflows/update_backend.yml @@ -40,7 +40,7 @@ jobs: run: | if git diff --quiet pysr/juliapkg.json; then echo "No changes to pysr/juliapkg.json. Restoring changes." - git restore pyproject.toml .release-please-manifest.json + git restore pyproject.toml fi - name: "Create PR if necessary" @@ -56,7 +56,6 @@ jobs: delete-branch: true commit-message: "chore: update backend to v${{ steps.get-latest.outputs.version }}" add-paths: | - .release-please-manifest.json pyproject.toml pysr/juliapkg.json diff --git a/.github/workflows/update_backend_version.py b/.github/workflows/update_backend_version.py index dd6c79123..8bcbb78f6 100644 --- a/.github/workflows/update_backend_version.py +++ b/.github/workflows/update_backend_version.py @@ -12,17 +12,12 @@ repo_root = Path(__file__).parent / ".." / ".." pyproject_toml = repo_root / "pyproject.toml" juliapkg_json = repo_root / "pysr" / "juliapkg.json" -release_please_manifest = repo_root / ".release-please-manifest.json" - with open(pyproject_toml) as toml_file: pyproject_data = tomlkit.parse(toml_file.read()) with open(juliapkg_json) as f: juliapkg_data = json.load(f) -with open(release_please_manifest) as f: - release_please_manifest_data = json.load(f) - current_version = pyproject_data["project"]["version"] parts = current_version.split(".") @@ -57,8 +52,6 @@ new_version = f"{major}.{minor}.{new_patch}{new_suffix}{extra_parts}" pyproject_data["project"]["version"] = new_version -release_please_manifest_data["."] = new_version - # Update backend - maintain current format (either "rev" or "version") backend_pkg = juliapkg_data["packages"]["SymbolicRegression"] if "rev" in backend_pkg: @@ -76,7 +69,3 @@ with open(juliapkg_json, "w") as f: json.dump(juliapkg_data, f, indent=4) f.write("\n") - -with open(release_please_manifest, "w") as f: - json.dump(release_please_manifest_data, f, indent=2) - f.write("\n") From 68de225705463c9e0ae4d1ef1914a8386bbe4a18 Mon Sep 17 00:00:00 2001 From: MilesCranmerBot Date: Sat, 18 Apr 2026 21:16:14 +0000 Subject: [PATCH 2/2] fix: keep release-please state release-managed Co-authored-by: Miles Cranmer --- .github/workflows/update_backend.yml | 12 +----- .github/workflows/update_backend_version.py | 46 +-------------------- .release-please-manifest.json | 2 +- 3 files changed, 3 insertions(+), 57 deletions(-) diff --git a/.github/workflows/update_backend.yml b/.github/workflows/update_backend.yml index 96da6fd3b..a94aeb462 100644 --- a/.github/workflows/update_backend.yml +++ b/.github/workflows/update_backend.yml @@ -20,9 +20,7 @@ jobs: cache: pip - name: "Install dependencies" - run: | - python -m pip install --upgrade pip - pip install tomlkit + run: python -m pip install --upgrade pip - name: "Get SymbolicRegression.jl latest version" id: get-latest @@ -36,13 +34,6 @@ jobs: run: | python .github/workflows/update_backend_version.py ${{ steps.get-latest.outputs.version }} - - name: "Restore changes if no diff to `pysr/juliapkg.json`" - run: | - if git diff --quiet pysr/juliapkg.json; then - echo "No changes to pysr/juliapkg.json. Restoring changes." - git restore pyproject.toml - fi - - name: "Create PR if necessary" id: cpr uses: peter-evans/create-pull-request@v8 @@ -56,7 +47,6 @@ jobs: delete-branch: true commit-message: "chore: update backend to v${{ steps.get-latest.outputs.version }}" add-paths: | - pyproject.toml pysr/juliapkg.json - name: "Trigger CI workflows (backend update PR)" diff --git a/.github/workflows/update_backend_version.py b/.github/workflows/update_backend_version.py index 8bcbb78f6..754cf5389 100644 --- a/.github/workflows/update_backend_version.py +++ b/.github/workflows/update_backend_version.py @@ -1,58 +1,17 @@ import json -import re import sys from pathlib import Path -import tomlkit - new_backend_version = sys.argv[1] assert not new_backend_version.startswith("v"), "Version should not start with 'v'" repo_root = Path(__file__).parent / ".." / ".." -pyproject_toml = repo_root / "pyproject.toml" juliapkg_json = repo_root / "pysr" / "juliapkg.json" -with open(pyproject_toml) as toml_file: - pyproject_data = tomlkit.parse(toml_file.read()) - with open(juliapkg_json) as f: juliapkg_data = json.load(f) -current_version = pyproject_data["project"]["version"] -parts = current_version.split(".") - -if len(parts) < 3: - raise ValueError( - f"Invalid version format: {current_version}. Expected at least 3 components (major.minor.patch)" - ) - -major, minor = parts[0], parts[1] - -patch_match = re.match(r"^(\d+)(.*)$", parts[2]) -if not patch_match: - raise ValueError( - f"Could not parse patch version from '{parts[2]}' in version {current_version}. " - f"Expected patch to start with a number (e.g., '0', '1a1', '2rc3')" - ) - -patch_num_str, patch_suffix = patch_match.groups() -patch_num = int(patch_num_str) - -pre_release_match = re.fullmatch(r"(a|b|rc)(\d+)", patch_suffix) -if pre_release_match: - pre_tag, pre_num = pre_release_match.groups() - new_patch = patch_num - new_suffix = f"{pre_tag}{int(pre_num) + 1}" -else: - new_patch = patch_num + 1 - new_suffix = patch_suffix - -# Add back any additional version components (e.g., "2.0.0.dev1" -> ".dev1") -extra_parts = "." + ".".join(parts[3:]) if len(parts) > 3 else "" -new_version = f"{major}.{minor}.{new_patch}{new_suffix}{extra_parts}" - -pyproject_data["project"]["version"] = new_version -# Update backend - maintain current format (either "rev" or "version") +# Update backend, maintain current format (either "rev" or "version") backend_pkg = juliapkg_data["packages"]["SymbolicRegression"] if "rev" in backend_pkg: backend_pkg["rev"] = f"v{new_backend_version}" @@ -63,9 +22,6 @@ "SymbolicRegression package must have either 'rev' or 'version' field" ) -with open(pyproject_toml, "w") as toml_file: - toml_file.write(tomlkit.dumps(pyproject_data)) - with open(juliapkg_json, "w") as f: json.dump(juliapkg_data, f, indent=4) f.write("\n") diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3f5ba0b24..3d392f0fe 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0a2" + ".": "2.0.0a1" }