-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build wheels for emscripten target #110
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,6 +153,53 @@ jobs: | |
|
||
- run: make rust-benchmark | ||
|
||
build_wasm_emscripten: | ||
name: build wasm emscripten | ||
# only run on push to main and on release | ||
if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')" | ||
needs: [test, lint] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: rust-src | ||
target: wasm32-unknown-emscripten | ||
override: true | ||
|
||
- uses: mymindstorm/setup-emsdk@v11 | ||
with: | ||
version: 3.1.13 | ||
actions-cache-folder: emsdk-cache | ||
|
||
- name: set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: set package version | ||
run: python .github/set_version.py | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
|
||
- name: Sync Cargo.lock | ||
run: cargo update -p pydantic-core | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
|
||
- run: pip install -U --pre maturin | ||
|
||
- name: build wheels | ||
run: maturin build --release --target wasm32-unknown-emscripten --out dist -i 3.10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @messense It might be sensible to disable ABI3 for Emscripten wheels for now, because at least if we are using them with Pyodide we can only target one Python version at a time. There isn't (guaranteed to be) ABI compatibility between different Emscripten versions: Other Python distributions are unlikely to use exactly the same Emscripten version as us, and we update Emscripten more often than we update Python. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think that should be done in pyo3 if desirable. cc @davidhewitt And pydantic-core doesn't support ABI3 so it's not a problem in here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that disabling ABI3 at the PyO3 level probably is overkill? As far as PyO3 is concerned, building with ABI3 will just restrict the symbols that are available for use. Seems like it would be reasonable for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of course it's harmless to generate abi3 wheels as long as the cost isn't very high. |
||
|
||
- run: ls -lh dist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: wasm_wheels | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since PyPI does not allow uploading wasm32 wheels right now, I choose to not putting them in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have been discussing making a Pyodide wheel warehouse for people making out of tree builds, but there hasn't been a strong motivation so far because very few people are making out of tree builds yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hoodmane do you have a link for this? if I'd love to try using this package in web-assembly, but I'm not sure where to start. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR added the ability to install binary wheels: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Easiest way to run tests is in node with |
||
path: dist | ||
|
||
build: | ||
name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) | ||
# only run on push to main and on release | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pyodide should probably make a github action so that it is easier for people to keep the version in sync. You should be able to specify a target Pyodide version and get the relevant dependencies. In order to do that, we should probably start storing this information maybe in a file like
version_info.json
@ryanking13 @rth