Hardcode support for platform pyodide_wasm32 - #159
Conversation
|
You can test this patch with : (installs numpy stable, and pywavelets nightly) (installs numpy nightly) |
|
(I probably need to add a test, but feedback first would be welcome). |
Hmm, It must be a bug. |
ryanking13
left a comment
There was a problem hiding this comment.
Thanks, I left some comments. Could you also update the changelog?
| releases_compatible = { | ||
| version: cls._compatible_wheels(files, version, name=name) | ||
| releases_compatible_x = { | ||
| version: tuple(cls._compatible_wheels(files, version, name=name)) |
There was a problem hiding this comment.
I would like to keep the generator if possible, as checking compatibility of a long list of versions is redundant.
| if filename.endswith("wasm32.whl") and sys.platform == "emscripten": | ||
| return True |
There was a problem hiding this comment.
Maybe sys.platform check is redundant, as we never expect micropip to be used in the non-Emscripten environment.
There was a problem hiding this comment.
At least not for installation. For making lock files, it would make sense.
There was a problem hiding this comment.
For making lock files
Do you mean using it under pyodide venv environment? I think it would still have sys.platform == emscripten.
There was a problem hiding this comment.
Well; at least some test locally runs under sys.platform != emscripten, and are useful for fast iteration.
| new_tags = [] | ||
| for tag in sys_tags_orig(): | ||
| if "emscripten" in tag.platform: | ||
| new_tags.append(Tag(tag.interpreter, tag.abi, "pyodide_2024_0_wasm32")) |
There was a problem hiding this comment.
I think you can use
import sysconfig
abi_version = sysconfig.get_config_var("PYODIDE_ABI_VERSION")
tag = f"pyodide_{abi_version}_wasm32"
instead, as abi version is expected to be changed when Pyodide ABI changes.
I don't like it; this feels like a hack, but it works, and I would be happy to get more guidance. Also one weird thing, is if I installl pywavelets nightly, it installs numpy stable; while the index does have a numpy nightly; And with the same config, if I ask it to install numpy; it does install numpy nightly. So there is something wonkey in recursive dependency handling of indexes.
ryanking13
left a comment
There was a problem hiding this comment.
Thanks. Codewise looks good to me. But could you please add a testcase for the updated sys_tags function?
There is a test function test_check_compatible but it runs under the host environment, hence no PYODIDE_ABI_VERSION config var exists.
So I would recommend to make a new test function that runs inside the Pyodide.
@run_in_pyodide
def test_check_compatible_in_pyodide(selenium_standalone_micropip):
import micropip
# run test against check_compatible()|
I've added a single test that the pywavelet wheel that was not installing is marked as compatible when run in pyodide; is that sufficient ? |
Yes, I think it is sufficient for now. Probably we can update the testcase when we update the emscripten or Python version in Pyodide. |
Also cahnge some Generators to Tuple, as it is not the first time that while debugging I exaust the generator when printing logs; and this make micropip installing the package to fail.
I don't like it; this feels like a hack, but it works, and I woudl be happy to get more guidance.
Also one weird thing, is if I installl pywavelets nightly, it installs numpy stable; while the index does have a numpy nightly;
And with the same config, if I ask it to install numpy; it does install numpy nightly.
So there is something wonkey in recursive dependency handling of indexes.