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

C extensions like numpy and tenserflow in Brython using WebASM #1817

Closed
TheRook opened this issue Nov 11, 2021 · 6 comments
Closed

C extensions like numpy and tenserflow in Brython using WebASM #1817

TheRook opened this issue Nov 11, 2021 · 6 comments

Comments

@TheRook
Copy link

TheRook commented Nov 11, 2021

WebASM could provide the internals for a binary interface that allows for python C extensions to run inside of brython. There isn't even a shadow of a doubt that this is the right answer, but the question is has this been explored?

This is how https://github.com/becavalier/eufa works.

Here is a tutorial on how to build these kinds of linked libraries:
https://developer.mozilla.org/en-US/docs/WebAssembly/existing_C_to_wasm

There would likely need to be a brython distutils that does the setup.py build for a WebASM target.

@TheRook
Copy link
Author

TheRook commented Nov 12, 2021

Also, pyodide/pyodide#1911 might help build the extensions that then work with your translation process. pyodide could help you build C extensions.

@PierreQuentel
Copy link
Contributor

@TheRook
Thanks for the suggestion. I am convinced that compiling C modules to WASM would be the correct solution, instead of rewriting everything in Javascript, but for the moment all those who have suggested it have not been able to actually do it.

As far as I am concerned, I don't know C and have no idea how to build modules with dependencies - the tutorial on MSN is not enough for a complete ignorant at C like me.

If you can give it a try it would be very, very helpful !

@TheRook
Copy link
Author

TheRook commented Nov 15, 2021

@PierreQuentel pyodide will have it ready in less than 6mo. You might be able to adopt it from them or collab with that project in some way.

@PierreQuentel
Copy link
Contributor

I would surely do it if it was as simple as copying a module (eg _sre) already compiled to WASM from pyodide to Brython, but it's apparently much more complicated.

@coproc
Copy link
Contributor

coproc commented Nov 23, 2021

pyodide will have it ready in less than 6mo. You might be able to adopt it from them or collab with that project in some way.

@TheRook What will be ready in 6mo? The current version 0.18.1 of pyodide contains already more than 75 packages, including matplotlib, numpy, pandas, scipy, etc. that can be run in the browser.

@PierreQuentel
Copy link
Contributor

I am closing the issue, being 100% ok with the suggestion, but having no other solution than hoping that someone, someday can implement it.

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

No branches or pull requests

3 participants