Automate python publishing on version bumps - #72
Conversation
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.RELEASE_TAG_PAT }} |
There was a problem hiding this comment.
@Sollimann I need this from you. Steps:
- Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens → "Generate new token".
- Token name:
bonsai-release-tag(or anything memorable). - Repository access: only
sollimann/bonsai. - Repository permissions:
Contents: Read and write(to push tags).Actions: Read(to confirm workflow state, harmless if omitted).
- Expiration: on your discretion. The auto-tag flow will break silently when token expires. Ideally one year?
- Click "Generate token", copy the value immediately (you can't view it again).
- In the repo: Settings → Secrets and variables → Actions → "New repository secret":
- Name:
RELEASE_TAG_PAT - Value: paste the token.
- Name:
| - name: Extract version from Cargo.toml | ||
| id: version | ||
| run: | | ||
| version=$(grep -m1 '^version' bonsai-py/Cargo.toml | sed -E 's/.*"([^"]+)".*/\1/') | ||
| if [ -z "$version" ]; then | ||
| echo "::error::Could not parse version from bonsai-py/Cargo.toml" | ||
| exit 1 | ||
| fi | ||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
| echo "Detected version: $version" |
There was a problem hiding this comment.
so ideally we want the versions between Rust and Python match, but this model could break if we have e.g bug fixes/refactoring that only affects one or the other but that requires a new release version go get distributed. I haven't checked, but I'm pretty sure releases a immutable i.e you cannot update an existing version
There was a problem hiding this comment.
We could operate on a model where we have version parity, and then only break them up if it becomes an actual problem. wdyt?
There was a problem hiding this comment.
Yes, version numbers are immutable. I would recommend keeping version numbers as XX.YY.ZZ, such that as long as XX.YY is the same, users are guaranteed to have same functionality. ZZ would only be reserved for the bugfixes you mentioned. When bumping ZZ, we must ensure that functionality-wise both are still the same. I don't think there's a clean way to automate this honestly. Version semantics are hard :/
|
Please add a hyperlink and banner in the root README.md pointing to the package: https://pypi.org/project/bonsai-bt/ Can be a separate PR or just updating this one is fine too |
|
@Sollimann update README to add banner for pypi. Also bumped the version number patch so pypi gets updated. Its also worth doing so we can validated that yes changing version number actually updates the python bindings automatically. |

Automate the Python release pipeline so a
bonsai-py/Cargo.tomlversion bump on mainauto-tags + triggers publish.
bonsai-py/Cargo.toml, pushes py-v$versionon change. Uses a PAT (RELEASE_TAG_PAT) because GITHUB_TOKEN-pushed
tags don't fire downstream workflows.