-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ENH Add Pyodide support #7803
base: master
Are you sure you want to change the base?
ENH Add Pyodide support #7803
Conversation
Do you think we could encapsulate that logic into a custom Connector in some way, so _request() can work with minimal changes? |
I think so. At the very least we'll need if sys.platform == "emscripten":
connector = PyodideConnector(connector)
request_class = PyodideRequestClass(request_class) in |
Yes, I think specifically, connector defaults to |
Currently, for this issue, I compiled a wheel for multidict v4.7.6 (needs to be v5.0.0 <= and v4.5.0); and I try to install it inside jupyterlite and get the following issue: Code for recreation: import micropip
await micropip.install('https://raw.githubusercontent.com/psymbio/tiktoken_rust_wasm/main/packages/multidict/multidict-4.7.6-py3-none-any.whl', keep_going=True)
await micropip.install("aiohttp", verbose=True)
import aiohttp Error:```python
aiohttp is trying to access asyncio.coroutines._DEBUG - which doesn't exist. |
Except, that's not our code. No idea what is happening with your traceback there, but that code doesn't exist in master, 3.8 or 3.9: |
Sorry, I forgot to mention the fact that this was done in JupyterLite, so according to this comment (pyodide/pyodide#4070 (comment)) the version installed was 3.6.2 (currently I'm not sure but after just glancing through the releases I can see v3.6.2 is probably the last release with a pure python wheel) so this issue exists there. I think I'll try building a pure Python wheel for v3.8.6 and update the issue here. Also, can building the pure Python wheel be added to the process? |
If you create a PR, then probably. See #7632 too. |
This doesn't actually work without an additional patch but it's possible to get it to work by monkey patching a method. See discussion about adding support for Pyodide to aiohttp: aio-libs/aiohttp#7253 aio-libs/aiohttp#7803
e760dfe
to
2cb18a7
Compare
4a83bd2
to
ac0c8c3
Compare
@Dreamsorcerer could you approve the CI to run? Ad hoc local tests run but I'd like to get a basic test running in CI. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #7803 +/- ##
==========================================
- Coverage 97.36% 97.25% -0.11%
==========================================
Files 107 107
Lines 32346 32440 +94
Branches 3748 3758 +10
==========================================
+ Hits 31494 31551 +57
- Misses 647 688 +41
+ Partials 205 201 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@Dreamsorcerer I guess the workflows need to be separately approved for each commit? |
|
||
class JsArrayBuffer(Protocol): | ||
def to_bytes(self) -> bytes: | ||
... |
Check notice
Code scanning / CodeQL
Statement has no effect Note
headers: List[Tuple[str, str]] | ||
|
||
def arrayBuffer(self) -> asyncio.Future[JsArrayBuffer]: | ||
... |
Check notice
Code scanning / CodeQL
Statement has no effect Note
@Dreamsorcerer please trigger CI when you get a chance |
I'm around most of tomorrow (and the next few hours) if you need me to keep approving. |
Thanks for your work! Has there been any progress on this? |
What do these changes do?
Adds support for Pyodide. Intended for discussion. Probably not an implementation we'd want to merge. It seems to be good enough for several downstream projects I've tested out.
I will try to get some simple CI working on this branch soon.
Related issue number
#7253
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.