You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like we might be able to drop requests-wasm-polyfill, since they now seem to be supporting emscripten (not just Pyodide) as an environment, and requests depends on urllib3.
cc @DerThorsten who may also have some insights on this.
├─ urllib3 [1.24.3|1.26.16|...|2.2.0] would require│ └─ pysocks >=1.5.6,<2.0,!=1.5.7 but there are no viable options│ ├─ pysocks 1.7.1 would require│ │ └─ __win, which is missing on the system;│ └─ pysocks 1.7.1 would require│ └─ __unix, which is missing on the system;
It seems also some versions of urllib3 are pulling brotlipy, it's unclear to me what's the difference with brotli-python, we may want to package that too at some point
I believe we should either get rid of this trick or provide our own recipe. I'll go with with a custom recipe for now and open an issue on the upstream feedstock.
I believe we should either get rid of this trick or provide our own recipe. I'll go with with a custom recipe for now and open an issue on the upstream feedstock.
Yeah that sounds like the simplest approach for now 👍
It looks like we might be able to drop requests-wasm-polyfill, since they now seem to be supporting emscripten (not just Pyodide) as an environment, and requests depends on urllib3.
cc @DerThorsten who may also have some insights on this.
we could reimplement that part of the pyodide API with pyjs I believe
I have mixed feelings about this.
It could be nice to converge a bit, instead of putting pyodide in core places we could put lower level libraries. Like having those JsArray, JsException,JsProxy,to_js, APIs in a common place for pyodide and emscripten-forge, then use this in urllib3.
we could reimplement that part of the pyodide API with pyjs I believe
I have mixed feelings about this.
It could be nice to converge a bit, instead of putting pyodide in core places we could put lower level libraries. Like having those JsArray, JsException,JsProxy,to_js, APIs in a common place for pyodide and emscripten-forge, then use this in urllib3.
I think this way round this does not work. JsArray, JsException,JsProxy,to_js are implemented with pyodide / pyjs so you cannot just put them somewhere and let pyodide / pyjs consume them.
There should be some absolute minimal API (ie not the full pyodide API, maybe just a subset) which can be implemented by pyodide / pyjs, and some way to use your custom implementation instead of pyodide.
Anyhow, most things used in urlib exist in pyjs in a very similar fashion.
Activity
jtpio commentedon Jan 31, 2024
Trying this locally quickly, maybe this would first require to package
brotli?Using this test
environment.yml:jtpio commentedon Jan 31, 2024
So we seem to have
brotlipackaged here already: https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/brotlimartinRenou commentedon Jan 31, 2024
The name is brotli https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/brotli/recipe.yaml#L5 not brotli-python, I guess that's the reason?
martinRenou commentedon Feb 2, 2024
Now
pysocksis causing issues:I'll look into it
martinRenou commentedon Feb 2, 2024
It seems also some versions of urllib3 are pulling
brotlipy, it's unclear to me what's the difference withbrotli-python, we may want to package that too at some pointjtpio commentedon Feb 2, 2024
So
pysocksis defined as an optional inurllib3here: https://github.com/urllib3/urllib3/blob/23f2287eb526d9384dddeedb6f6345e263bb9b86/pyproject.toml#L49-L51But not in the feedstock it seems: https://github.com/conda-forge/urllib3-feedstock/blob/0bf0b37a36ce8513397f81457e316a1e1e206001/recipe/meta.yaml#L26
Maybe that's the issue?
martinRenou commentedon Feb 2, 2024
There is no way to make it optional.
The issue with the pysocks feedstock is that it's implementing a trick to prevent using selectors allowing the package to be
noarch.I believe we should either get rid of this trick or provide our own recipe. I'll go with with a custom recipe for now and open an issue on the upstream feedstock.
jtpio commentedon Feb 2, 2024
Yeah that sounds like the simplest approach for now 👍
DerThorsten commentedon Feb 2, 2024
but this still means pyodide? https://github.com/urllib3/urllib3/blob/23f2287eb526d9384dddeedb6f6345e263bb9b86/src/urllib3/contrib/emscripten/fetch.py#L35 or am I missing something?
DerThorsten commentedon Feb 2, 2024
we could reimplement that part of the pyodide API with pyjs I believe
martinRenou commentedon Feb 2, 2024
I have mixed feelings about this.
It could be nice to converge a bit, instead of putting pyodide in core places we could put lower level libraries. Like having those
JsArray, JsException,JsProxy,to_js,APIs in a common place for pyodide and emscripten-forge, then use this in urllib3.DerThorsten commentedon Feb 2, 2024
I think this way round this does not work.
JsArray, JsException,JsProxy,to_jsare implemented withpyodide/pyjsso you cannot just put them somewhere and let pyodide / pyjs consume them.There should be some absolute minimal API (ie not the full pyodide API, maybe just a subset) which can be implemented by pyodide / pyjs, and some way to use your custom implementation instead of pyodide.
Anyhow, most things used in urlib exist in pyjs in a very similar fashion.
martinRenou commentedon Feb 2, 2024
We can switch from an
requests-wasm-polyfillto apyodide-polyfillfor now then.martinRenou commentedon Feb 2, 2024
Now getting this when installing requests in an emscripten-forge environment and trying to import it:
So we're on the right track I guess. Just need
jsandpyodide-polyfill.DerThorsten commentedon Feb 2, 2024
jsis the module of pyodide wrapping the global scope of JavaScript (ieglobalThis/window) fyimartinRenou commentedon Feb 2, 2024
Ok. I'll see if I can work something out.
DerThorsten commentedon Feb 2, 2024
pyjs.jsis more or less the sameDerThorsten commentedon Feb 2, 2024
most of the pyjs api is "documented" here https://github.com/emscripten-forge/pyjs/blob/main/tests/tests/test_pyjs.py
jtpio commentedon Feb 2, 2024
Yeah this was the motivation for opening pyodide/pyodide#3793.
martinRenou commentedon Feb 6, 2024
Some progress made:
jsandpyodidepolyfills Expose a "js" module and a small pyodide polyfill pyjs#54 (released ✅)Once those are complete, we can safely remove the
requests-wasm-polyfilland close thisjtpio commentedon Feb 6, 2024
Nice progress, thanks!