From 98883c4142380c7dc6e38022b99ce20ebd699676 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 14:55:36 +0200 Subject: [PATCH 01/14] adding version to __init__.py --- mesa_frames/__init__.py | 2 ++ pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mesa_frames/__init__.py b/mesa_frames/__init__.py index 9914980..07b86f9 100644 --- a/mesa_frames/__init__.py +++ b/mesa_frames/__init__.py @@ -57,3 +57,5 @@ def __init__(self, width, height): "GridPandas", "GridPolars", ] + +__version__ = "0.1.0alpha" diff --git a/pyproject.toml b/pyproject.toml index 5ff7a09..942fbba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "mesa_frames" -version = "0.1.0-alpha1" +version = "mesa-frames/__init__.py" description = "An extension to the Mesa framework which uses pandas/Polars DataFrames for enhanced performance" authors = [ { name = "Adam Amer" }, From 9ea64f7a6cb57d60378ee846d6d070001d8b5e99 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 14:56:05 +0200 Subject: [PATCH 02/14] add publishing GH Action --- .github/workflows/publish.yml | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..13e7341 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,88 @@ +name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts + +on: + release: + types: [created] + +jobs: + build-test-publish-upload: + runs-on: ubuntu-latest + environment: release + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install hatch + - name: Set release version + run: | + # Get the tag from the GitHub release + TAG=${GITHUB_REF#refs/tags/} + # Remove 'v' prefix if present + VERSION=${TAG#v} + hatch version $VERSION + - name: Build package + run: hatch build + - name: Run tests + run: hatch run test:pytest + - name: Retrieve and mint OIDC token + # (https://docs.pypi.org/trusted-publishers/using-a-publisher/) + run: | + # retrieve the ambient OIDC token + resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ + "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") + oidc_token=$(jq -r '.value' <<< "${resp}") + + # exchange the OIDC token for an API token + resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") + api_token=$(jq -r '.token' <<< "${resp}") + + # mask the newly minted API token, so that we don't accidentally leak it + echo "::add-mask::${api_token}" + + # see the next step in the workflow for an example of using this step output + echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" + - name: Publish to PyPI + env: + PYPI_API_TOKEN: ${{ steps.mint-token.outputs.api-token }} + run: | + hatch publish -u __token__ -a $PYPI_API_TOKEN + - name: Upload Release Asset + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + omitPrereleaseDuringUpdate: true + - name: Verify PyPI Release and Update to Next Version + run: | + # Verify PyPI release + PACKAGE_NAME="mesa_frames" + CURRENT_VERSION=$(hatch version) + pip install $PACKAGE_NAME==$CURRENT_VERSION + python -c "import mesa_frames; print(mesa_frames.__version__)" + + # Bump to next development version + hatch version patch + hatch version dev + + # Get the new version + NEW_VERSION=$(hatch version) + + # Commit and push the version bump + git config user.name github-actions + git config user.email github-actions@github.com + git add mesa-frames/__init__.py + git commit -m "Bump version to $NEW_VERSION [skip ci]" + git push \ No newline at end of file From 7957943ab013f96dc2af98c2bb87b56c593de69c Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:10:25 +0200 Subject: [PATCH 03/14] updating pyproject.toml --- pyproject.toml | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 942fbba..41228e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,18 +7,45 @@ name = "mesa_frames" version = "mesa-frames/__init__.py" description = "An extension to the Mesa framework which uses pandas/Polars DataFrames for enhanced performance" authors = [ - { name = "Adam Amer" }, + { name = "Adam Amer"}, ] license = { text = "MIT" } +readme = "README.md" +keywords = [ + "simulation", + "simulation-environment", + "gis", + "pandas", + "simulation-framework", + "agent-based-modeling", + "complex-systems", + "spatial-models", + "mesa", + "complexity-analysis", + "modeling-agents", + "agent-based-modelling" +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering::Artificial Life", +] dependencies = [ "numpy~=1.26", "typing-extensions>=4.9" #typing-extensions.Self added in 4.9 ] +requires-python = ">=3.8" + +[project.urls] +Documentation = "https://adamamer20.github.io/mesa-frames" +Repository = "https://github.com/adamamer20/mesa-frames.git" [project.optional-dependencies] pandas = [ - "pandas~=2.2", - "pyarrow", + "pandas>=2.2", + "pyarrow", #for conversion to pandas #"geopandas" (only after GeoGrid / ContinousSpace is implemented) ] polars = [ From 34689a02c515f919f328355df0a9812808589726 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:16:17 +0200 Subject: [PATCH 04/14] updating the GH Action --- .github/workflows/publish.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 13e7341..badd9e5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,7 @@ name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts - on: release: types: [created] - jobs: build-test-publish-upload: runs-on: ubuntu-latest @@ -40,22 +38,19 @@ jobs: # retrieve the ambient OIDC token resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") - oidc_token=$(jq -r '.value' <<< "${resp}") - + oidctoken=$(jq -r '.value' <<< "${resp}") # exchange the OIDC token for an API token - resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") + resp=$(curl -X POST https://pypi.org//oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") api_token=$(jq -r '.token' <<< "${resp}") - # mask the newly minted API token, so that we don't accidentally leak it echo "::add-mask::${api_token}" - # see the next step in the workflow for an example of using this step output echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" - name: Publish to PyPI env: PYPI_API_TOKEN: ${{ steps.mint-token.outputs.api-token }} run: | - hatch publish -u __token__ -a $PYPI_API_TOKEN + hatch publish -u token -a $PYPI_API_TOKEN - name: Upload Release Asset uses: ncipollo/release-action@v1 with: @@ -71,18 +66,15 @@ jobs: PACKAGE_NAME="mesa_frames" CURRENT_VERSION=$(hatch version) pip install $PACKAGE_NAME==$CURRENT_VERSION - python -c "import mesa_frames; print(mesa_frames.__version__)" - + python -c "import mesa_frames; print(mesa_frames.version)" # Bump to next development version hatch version patch hatch version dev - # Get the new version NEW_VERSION=$(hatch version) - # Commit and push the version bump git config user.name github-actions git config user.email github-actions@github.com - git add mesa-frames/__init__.py + git add mesa-frames/init.py git commit -m "Bump version to $NEW_VERSION [skip ci]" git push \ No newline at end of file From 5abfd7de1c075729dca1d3e4f599b49727412fe0 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:17:44 +0200 Subject: [PATCH 05/14] Revert "updating the GH Action" This reverts commit 34689a02c515f919f328355df0a9812808589726. --- .github/workflows/publish.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index badd9e5..13e7341 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,7 +1,9 @@ name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts + on: release: types: [created] + jobs: build-test-publish-upload: runs-on: ubuntu-latest @@ -38,19 +40,22 @@ jobs: # retrieve the ambient OIDC token resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") - oidctoken=$(jq -r '.value' <<< "${resp}") + oidc_token=$(jq -r '.value' <<< "${resp}") + # exchange the OIDC token for an API token - resp=$(curl -X POST https://pypi.org//oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") + resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") api_token=$(jq -r '.token' <<< "${resp}") + # mask the newly minted API token, so that we don't accidentally leak it echo "::add-mask::${api_token}" + # see the next step in the workflow for an example of using this step output echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" - name: Publish to PyPI env: PYPI_API_TOKEN: ${{ steps.mint-token.outputs.api-token }} run: | - hatch publish -u token -a $PYPI_API_TOKEN + hatch publish -u __token__ -a $PYPI_API_TOKEN - name: Upload Release Asset uses: ncipollo/release-action@v1 with: @@ -66,15 +71,18 @@ jobs: PACKAGE_NAME="mesa_frames" CURRENT_VERSION=$(hatch version) pip install $PACKAGE_NAME==$CURRENT_VERSION - python -c "import mesa_frames; print(mesa_frames.version)" + python -c "import mesa_frames; print(mesa_frames.__version__)" + # Bump to next development version hatch version patch hatch version dev + # Get the new version NEW_VERSION=$(hatch version) + # Commit and push the version bump git config user.name github-actions git config user.email github-actions@github.com - git add mesa-frames/init.py + git add mesa-frames/__init__.py git commit -m "Bump version to $NEW_VERSION [skip ci]" git push \ No newline at end of file From d5b57e85b16888bbd2c86c1ab1eea771c9dff5a4 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:30:47 +0200 Subject: [PATCH 06/14] updating dependencies --- pyproject.toml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 41228e7..9fc2ed0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,14 @@ classifiers = [ ] dependencies = [ "numpy~=1.26", - "typing-extensions>=4.9" #typing-extensions.Self added in 4.9 + "typing-extensions>=4.9", #typing-extensions.Self added in 4.9 + ## pandas + "pandas>=2.2", + "pyarrow", #for conversion to pandas + #"geopandas" (only after GeoGrid / ContinousSpace is implemented) + ## polars + "polars>=1.0.0", #polars._typing (see mesa_frames.types) added in 1.0.0 + #"geopolars" (currently in pre-alpha) ] requires-python = ">=3.8" @@ -43,15 +50,6 @@ Documentation = "https://adamamer20.github.io/mesa-frames" Repository = "https://github.com/adamamer20/mesa-frames.git" [project.optional-dependencies] -pandas = [ - "pandas>=2.2", - "pyarrow", #for conversion to pandas - #"geopandas" (only after GeoGrid / ContinousSpace is implemented) -] -polars = [ - "polars>=1.0.0", #polars._typing (see mesa_frames.types) added in 1.0.0 - #"geopolars" (currently in pre-alpha) -] mkdocs = [ "mkdocs-material", @@ -71,20 +69,26 @@ sphinx = [ ] docs = [ - "mesa_frames[pandas, polars, mkdocs, sphinx]", + "mesa_frames[mkdocs, sphinx]", # Readme Script "perfplot", "seaborn" ] -dev = [ - "mesa_frames[pandas, polars, docs]", +test = [ "pytest", "pytest-cov", "typeguard", +] + +dev = [ + "mesa_frames[test, docs]", "mesa", ] +[tool.hatch.envs.test] +features = ["test"] + [tool.hatch.envs.dev] #Allows installing dev as virtual env features = ["dev"] From 26f07476b7d6901021342f00209d540c40442d2f Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:32:25 +0200 Subject: [PATCH 07/14] updating dependencies on documentation --- README.md | 10 ++-------- docs/general/index.md | 4 +--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 562d7b4..24644e5 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,7 @@ conda activate myenv Then, to install mesa-frames itself: ```bash -# For pandas backend -pip install -e .[pandas] -# Alternatively, for Polars backend -pip install -e .[polars] +pip install -e . ``` ### Installing in a Python Virtual Environment @@ -69,10 +66,7 @@ source myenv/bin/activate # On Windows, use `myenv\Scripts\activate` Then, to install mesa-frames itself: ```bash -# For pandas backend -pip install -e .[pandas] -# Alternatively, for Polars backend -pip install -e .[polars] +pip install -e . ``` ## Usage diff --git a/docs/general/index.md b/docs/general/index.md index e7eed64..f3c4c72 100644 --- a/docs/general/index.md +++ b/docs/general/index.md @@ -24,9 +24,7 @@ Check out our performance graphs comparing mesa and mesa-frames for the [Boltzma ```bash git clone https://github.com/adamamer20/mesa_frames.git cd mesa_frames -pip install -e .[pandas] # For pandas backend -# or -pip install -e .[polars] # For Polars backend +pip install -e . ``` ### Basic Usage From 6e41f9498b08253f7c06144d2f91c3c2dac7b356 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 25 Aug 2024 13:40:14 +0000 Subject: [PATCH 08/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mesa_frames/concrete/pandas/mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesa_frames/concrete/pandas/mixin.py b/mesa_frames/concrete/pandas/mixin.py index c6eeeff..7ac9cc5 100644 --- a/mesa_frames/concrete/pandas/mixin.py +++ b/mesa_frames/concrete/pandas/mixin.py @@ -316,7 +316,7 @@ def _prepare_df(df: pd.DataFrame, on: str | list[str] | None) -> pd.DataFrame: # Reset index if it is not used as a key to keep it in the DataFrame if df.index.name is not None or df.index.names[0] is not None: df = df.reset_index() - df = df.set_index(on) + df = df.set_index(on) return df left_index = False From 99fab5856ebfd3d83e63de3aaa495fbce33da574 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:40:52 +0200 Subject: [PATCH 09/14] adding edited to yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 13e7341..545c6d2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts on: release: - types: [created] + types: [created, edited] jobs: build-test-publish-upload: From 1614f1f2dd4db8226b9e236e7e869010d6c8b856 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:27:22 +0200 Subject: [PATCH 10/14] pypa publishing action --- .github/workflows/publish.yml | 38 +++++------------------------------ 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 545c6d2..e56d474 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -34,45 +34,17 @@ jobs: run: hatch build - name: Run tests run: hatch run test:pytest - - name: Retrieve and mint OIDC token - # (https://docs.pypi.org/trusted-publishers/using-a-publisher/) - run: | - # retrieve the ambient OIDC token - resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ - "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") - oidc_token=$(jq -r '.value' <<< "${resp}") - - # exchange the OIDC token for an API token - resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") - api_token=$(jq -r '.token' <<< "${resp}") - - # mask the newly minted API token, so that we don't accidentally leak it - echo "::add-mask::${api_token}" - - # see the next step in the workflow for an example of using this step output - echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" - - name: Publish to PyPI - env: - PYPI_API_TOKEN: ${{ steps.mint-token.outputs.api-token }} - run: | - hatch publish -u __token__ -a $PYPI_API_TOKEN - - name: Upload Release Asset - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: "dist/*" - token: ${{ secrets.GITHUB_TOKEN }} - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - omitPrereleaseDuringUpdate: true - - name: Verify PyPI Release and Update to Next Version + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Verify PyPI Release run: | # Verify PyPI release PACKAGE_NAME="mesa_frames" CURRENT_VERSION=$(hatch version) pip install $PACKAGE_NAME==$CURRENT_VERSION python -c "import mesa_frames; print(mesa_frames.__version__)" - + - name: Update to Next Version + run: | # Bump to next development version hatch version patch hatch version dev From d85aaac3b08cadbc5eb346c462851f6fd4dc7b59 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:31:04 +0200 Subject: [PATCH 11/14] fix: mesa-frames version --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9fc2ed0..18d4d90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "hatchling.build" [project] name = "mesa_frames" -version = "mesa-frames/__init__.py" description = "An extension to the Mesa framework which uses pandas/Polars DataFrames for enhanced performance" authors = [ { name = "Adam Amer"}, @@ -95,6 +94,9 @@ features = ["dev"] [tool.hatch.build.targets.wheel] packages = ["mesa_frames"] +[tool.hatch.version] +path = "mesa_frames/__init__.py" + [tool.ruff.lint] select = ["D"] ignore = ["D101", "D102", "D105"] @@ -105,4 +107,5 @@ convention = "numpy" [tool.ruff.lint.per-file-ignores] "tests/*" = ["D"] "examples/*" = ["D"] -"docs/*" = ["D"] \ No newline at end of file +"docs/*" = ["D"] + From 4ed04fe700da4ce7e0fe98884a5fa524f5974ea4 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:34:07 +0200 Subject: [PATCH 12/14] fix: add version to dynamic --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 18d4d90..24057c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,13 +43,17 @@ dependencies = [ #"geopolars" (currently in pre-alpha) ] requires-python = ">=3.8" +dynamic = [ + "version" +] + + [project.urls] Documentation = "https://adamamer20.github.io/mesa-frames" Repository = "https://github.com/adamamer20/mesa-frames.git" [project.optional-dependencies] - mkdocs = [ "mkdocs-material", "mkdocs-jupyter", From 0f66196940160be0fe47b6e4b8a170a6b66dd52f Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:36:37 +0200 Subject: [PATCH 13/14] fix topic --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 24057c9..f769264 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering::Artificial Life", + "Topic :: Scientific/Engineering :: Artificial Life", ] dependencies = [ "numpy~=1.26", From 50495c66d2829a45950d88f27429c47e205f6713 Mon Sep 17 00:00:00 2001 From: Adam Amer <136176500+adamamer20@users.noreply.github.com> Date: Wed, 28 Aug 2024 08:26:38 +0200 Subject: [PATCH 14/14] adding creation of version branch --- .github/workflows/publish.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e56d474..ecde5f4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,6 +43,25 @@ jobs: CURRENT_VERSION=$(hatch version) pip install $PACKAGE_NAME==$CURRENT_VERSION python -c "import mesa_frames; print(mesa_frames.__version__)" + - name: Create or recreate version branch + - name: Create or recreate version branch + run: | + CURRENT_VERSION=$(hatch version) + BRANCH_NAME="v$CURRENT_VERSION" + + git config user.name github-actions + git config user.email github-actions@github.com + + # Delete the branch if it exists (both locally and remotely) + git branch -D $BRANCH_NAME || true + git push origin --delete $BRANCH_NAME || true + + # Create and push the new branch + git checkout -b $BRANCH_NAME + git push -u origin $BRANCH_NAME + + # Switch back to the main branch + git checkout main - name: Update to Next Version run: | # Bump to next development version