feat(ci): add Python binding release workflow#391
Merged
thibault-martinez merged 124 commits intodevelopfrom Nov 19, 2025
Merged
feat(ci): add Python binding release workflow#391thibault-martinez merged 124 commits intodevelopfrom
thibault-martinez merged 124 commits intodevelopfrom
Conversation
Contributor
|
Since we're building maturin from source anyway, could we instead fork it and make some tweaks to suit our purposes? |
Contributor
Author
|
Changed significantly since your approval
Thoralf-M
reviewed
Nov 19, 2025
Co-authored-by: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com>
Thoralf-M
approved these changes
Nov 19, 2025
thibault-martinez
approved these changes
Nov 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #243
This PR is not as straight-forward as it may seem, because of the following difficulties:
maturinorsetuptools-rustto create the platform specific Python packages, i.e. the wheels (.whl); both have downsides and I pickedmaturin+ a small hack (more on that later) over the other, which is the way more complex approach.maturinsupportsuniffiout-of-the-box, so it places the generatediota-sdk-ffi.pyand thelibiota-sdk-ffi.{LIB_EXT}the way it's expected byuniffi. That means however that withmaturinwe can't use ourmakebuild script, because it is designed to do everything from start (building) to finish (packaging,uploading)maturinto produce a validiota-sdk-ffi.pywe need to install the exact same version of theuniffi-bindgenCLI which currently is at0.29in theiota-sdk-fficrate deps.maturinlooks for a binary nameduniffi-bindgenin thePATHenv var, so luckily we can control which binary it should use. We can't use apipx install uniffi-bindgenin the CI because the latest version installable throughpipis0.28.3(which tests showed is incompatible), which is why we need to build andcargo installthat binary in the CI from the repo, which will always make sure that the versions correctly match. I had to rename the binary touniffi-bindgenin theiota-sdk-fficrate to make that work.UPDATE: There was a naming incompatibility issue that was fixed upstream (with
maturin1.10), so the initially requiredrepair_whl.shscript is no longer needed! 🥳 FYI here's where they fixed it: https://github.com/PyO3/maturin/pull/2840/files#diff-ef3401ac6425fac36616570d22b89962c2c4c9b5033f849ce8e0b6ab904c9fe9L1186. That means that we must set the minimum maturin version to1.10in thepyproject.toml.Other than that this PR can be tested locally easily with the following commands:
pipx install maturin(cargo install maturin fails to compile unless you install their latest main)cargo install --path crates/iota-sdk-ffi --bin uniffi-bindgencd bindings/python/srcmaturin build --release(you'll find the generated.whlin target/wheels)pip install target/wheels/iota_sdk-0.1.0-<PLATFORM_SPECIFIC>.whlThe published Python bindings can be found on TestPyPi: https://test.pypi.org/project/iota-sdk/3.0.0a1.dev16/
Version like
3.0.0-alpha.1are converted to3.0.0a1according to PEP-440 standard: https://peps.python.org/pep-0440/#public-version-identifiers