Skip to content
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

Upload wasm wheels to github release #128

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

messense
Copy link
Contributor

Since pypi won't at present accept wasm wheels, could we add those files (and indeed all wheels) to the release in github? Then it looks from micropip's docs like we could install pydantic-core from the github URL?

Originally posted by @samuelcolvin in #106 (comment)

@codecov
Copy link

codecov bot commented Jun 27, 2022

Codecov Report

Merging #128 (a9e7589) into main (0e32399) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #128   +/-   ##
=======================================
  Coverage   97.30%   97.30%           
=======================================
  Files          40       40           
  Lines        3900     3900           
  Branches       29       29           
=======================================
  Hits         3795     3795           
  Misses        105      105           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e32399...a9e7589. Read the comment docs.

@messense
Copy link
Contributor Author

messense commented Jun 27, 2022

Although wheels distributed on GitHub release are not installable because of CORS in web browser.

image

Edit: made it work with Allow CORS: Access-Control-Allow-Origin Chrome extension.

https://pyodide.org/en/latest/console.html

import asyncio
import pyodide_js

loop = asyncio.get_event_loop()
pyodide_js.loadPackage('micropip')
pip = pyodide_js.pyimport('micropip')
task = loop.run_until_complete(pip.install('https://github.com/messense/pydantic-core/releases/download/v0.0.0/pydantic_core-0.0.1-cp310-cp310-emscripten_3_1_14_wasm32.whl'))

pip.list()

from pydantic_core import SchemaValidator, ValidationError
SchemaValidator({'type': 'str'}).validate_json('"foobar"')

image

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although wheels distributed on GitHub release are not installable because of CORS in web browser.

Should be easy enough to fix with a cloudflare work which just proxies the request and changes the headers, I'll work on that when I get the time.

Comment on lines +363 to +368
- name: upload to github release
uses: softprops/action-gh-release@v1
with:
files: |
wasm/*.whl
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to creates a new release, we want to add the file to the existing (just created) release.

Looks like this action should do what we want.

Copy link
Contributor Author

@messense messense Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That action also create new release if there is no pre-existing one: https://github.com/svenstaro/upload-release-action/blob/fb1eb39e74209484069862c0ad703e495f307650/src/main.ts#L27-L39

I think they behave pretty much the same, but svenstaro/upload-release-action doesn't handle network errors quite well which leads to upload failure sometimes.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humm are you sure softprops/action-gh-release will add the files to an existing release if it's triggered from that release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I guess we'll find out...

@samuelcolvin samuelcolvin merged commit 771c928 into pydantic:main Jun 29, 2022
@samuelcolvin
Copy link
Member

thanks so much.

I think we'll do an initial release soon.

@messense messense deleted the wasm-github-release branch June 29, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants