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

skip relinking checks for webassembly #741

Merged
merged 5 commits into from Mar 28, 2024
Merged

Conversation

DerThorsten
Copy link
Contributor

@DerThorsten DerThorsten commented Mar 28, 2024

When building a shared library / a python package with c extension for emscripten-wasm32 one is facing this

 × error Error building package: unknown platform for relinking
Error:   × unknown platform for relinking

Atm this PR:

  • skip relinking for wasm
  • skip linking checks for wasm

This is not done very elegant atm and might even be wrong, but I believe for the boa/conda-build based workflow, we also just skip anything which involves parsing the *.so files.

With that, the build of the regex python package builds successful. Still working on integrating the testing.

@DerThorsten DerThorsten changed the title emscripten support - [work-in-progress] emscripten-wasm32 skip relinking - [work-in-progress] Mar 28, 2024
@DerThorsten
Copy link
Contributor Author

DerThorsten commented Mar 28, 2024

This works! I can run the pyjs_code_runner in the tests to test the package wasm package!

The test section is somewhat complicated for emscripten-wasm32, but it works!

tests:
  - script: python -m pip install playwright && playwright install && pyjs_code_runner run script browser-worker --conda-env $PREFIX --mount  $(pwd):/tests --script /tests/test_regex.py  --headless
    requirements:
      build:
        - pyjs_code_runner
        - pip
      run:
       - pyjs
       - pytest
      
    files:
      recipe:
        - test_regex.py

caviat: for macos I have to install playwright via pip as it is not available for conda-forge on mac

@wolfv
Copy link
Member

wolfv commented Mar 28, 2024

Nice! I think multi line scripts should work fine, too, btw

@DerThorsten
Copy link
Contributor Author

Nice! I think multi line scripts should work fine, too, btw

indeed. Looks better

tests:
  - script: python -m pip install playwright && 
            playwright install && 
            pyjs_code_runner run script browser-main 
              --conda-env $PREFIX 
              --mount  $(pwd):/tests 
              --script /tests/test_regex.py  
              --headless
      
    requirements:
      build:
        - pyjs_code_runner
        - pip
      run:
       - pyjs
       - pytest
      
    files:
      recipe:
        - test_regex.py

Also the output looks very nice =)

 │ │ │ Package        ┆ Version   ┆ Build             ┆ Channel          ┆ Size       │
 │ │ ╞════════════════╪═══════════╪═══════════════════╪══════════════════╪════════════╡
 │ │ │ regex          ┆ 2022.1.18 ┆ h62bfc69_9        ┆ .tmpWzhTfe       ┆ 364.29 KiB │
 │ │ │ pytest         ┆ 8.1.1     ┆ had7285e_0        ┆ emscripten-forge ┆ 713.23 KiB │
 │ │ │ six            ┆ 1.16.0    ┆ pyh6c4a22f_0      ┆ conda-forge      ┆ 13.92 KiB  │
 │ │ │ atomicwrites   ┆ 1.4.1     ┆ pyhd8ed1ab_0      ┆ conda-forge      ┆ 11.59 KiB  │
 │ │ │ iniconfig      ┆ 2.0.0     ┆ pyhd8ed1ab_0      ┆ conda-forge      ┆ 10.84 KiB  │
 │ │ │ python         ┆ 3.11.3    ┆ h_hash_24_cpython ┆ emscripten-forge ┆ 12.63 MiB  │
 │ │ │ emscripten-abi ┆ 3.1.45    ┆ h4616a5c_16       ┆ output           ┆ 4.38 KiB   │
 │ │ │ pyjs           ┆ 2.0.0     ┆ hbc1b1e0_0        ┆ emscripten-forge ┆ 3.78 MiB   │
 │ │ │ py             ┆ 1.11.0    ┆ pyh6c4a22f_0      ┆ conda-forge      ┆ 74.26 KiB  │
 │ │ │ pluggy         ┆ 1.4.0     ┆ pyhd8ed1ab_0      ┆ conda-forge      ┆ 22.84 KiB  │
 │ │ │ attrs          ┆ 23.2.0    ┆ pyh71513ae_0      ┆ conda-forge      ┆ 53.30 KiB  │
 │ │ │ more-itertools ┆ 10.2.0    ┆ pyhd8ed1ab_0      ┆ conda-forge      ┆ 53.19 KiB  │
 │ │ ╰────────────────┴───────────┴───────────────────┴──────────────────┴────────────╯
 │ │ ✔ Successfully updated the environment
 │ │ Testing commands:
 │ │ + python -m pip install playwright
 │ │ Collecting playwright
 │ │   Using cached playwright-1.42.0-py3-none-macosx_11_0_arm64.whl.metadata (3.5 kB)
 │ │ Collecting greenlet==3.0.3 (from playwright)
 │ │   Using cached greenlet-3.0.3-cp312-cp312-macosx_11_0_universal2.whl.metadata (3.8 kB)
 │ │ Collecting pyee==11.0.1 (from playwright)
 │ │   Using cached pyee-11.0.1-py3-none-any.whl.metadata (2.7 kB)
 │ │ Requirement already satisfied: typing-extensions in $BUILD_PREFIX/lib/python3.12/site-packages (from pyee==11.0.1->playwright) (4.10.0)
 │ │ Using cached playwright-1.42.0-py3-none-macosx_11_0_arm64.whl (32.6 MB)
 │ │ Using cached greenlet-3.0.3-cp312-cp312-macosx_11_0_universal2.whl (273 kB)
 │ │ Using cached pyee-11.0.1-py3-none-any.whl (15 kB)
 │ │ Installing collected packages: pyee, greenlet, playwright
 │ │ Successfully installed greenlet-3.0.3 playwright-1.42.0 pyee-11.0.1
 │ │ + playwright install
 │ │ ++ pwd
 │ │ + pyjs_code_runner run script browser-main --conda-env $PREFIX --mount /private/var/folders/yw/hcd009rd56zdy1_t6tbx4hzc0000gn/T/.tmpXgx7Og:/tests --script /tests/test_regex.py --headless
 │ │ running pytest
 │ │ ============================= test session starts ==============================
 │ │ platform emscripten -- Python 3.11.3, pytest-8.1.1, pluggy-1.4.0
 │ │ rootdir: /tests
 │ │ collecting ...
collected 3 items
 │ │ ../../tests/test_regex.py
 │ │ .
 │ │ .
 │ │ .
 │ │                                             [100%]
 │ │ ============================== 3 passed in 0.05s ===============================
 │ │ ✔ test passed!
 │ │ ✔ all tests passed!
 │ │
 │ ╰─────────────────── (took 14 seconds)
 │
 ╰─────────────────── (took 26 seconds)

@wolfv
Copy link
Member

wolfv commented Mar 28, 2024

You can also use : | for the YAML block syntax or you can use a list of commands (as a YAML list) :)

@wolfv
Copy link
Member

wolfv commented Mar 28, 2024

Then you shouldn't need the &&

@wolfv wolfv marked this pull request as ready for review March 28, 2024 18:27
@wolfv wolfv changed the title emscripten-wasm32 skip relinking - [work-in-progress] skip relinking checks for webassembly Mar 28, 2024
@wolfv wolfv merged commit 712b735 into prefix-dev:main Mar 28, 2024
13 checks passed
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.

None yet

2 participants