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

Build pyodide wheels in CI #2433

Merged
merged 6 commits into from
Mar 6, 2023
Merged

Build pyodide wheels in CI #2433

merged 6 commits into from
Mar 6, 2023

Conversation

luizirber
Copy link
Member

@luizirber luizirber force-pushed the lirber/pyodide branch 3 times, most recently from 701bc4c to f464c3c Compare January 5, 2023 05:46
@codecov
Copy link

codecov bot commented Jan 5, 2023

Codecov Report

Merging #2433 (0248eff) into latest (16979e8) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           latest    #2433      +/-   ##
==========================================
- Coverage   84.81%   84.81%   -0.01%     
==========================================
  Files         133      133              
  Lines       14819    14820       +1     
  Branches     2513     2513              
==========================================
  Hits        12569    12569              
- Misses       1948     1949       +1     
  Partials      302      302              
Flag Coverage Δ
python 92.58% <ø> (ø)
rust 51.37% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/core/src/errors.rs 0.00% <ø> (ø)
src/core/src/lib.rs 50.00% <ø> (ø)
src/core/src/ffi/storage.rs 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@luizirber luizirber force-pushed the lirber/pyodide branch 9 times, most recently from 8f94057 to 28fde38 Compare January 8, 2023 07:34
release:
name: Publish wheels
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/v')
needs: build_wheels
needs: [build_wheels, build_wasm]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fast enough (3 minutes) to be in the default wheels to be built per PR.

Comment on lines 19 to 23
- uses: cachix/cachix-action@v10
with:
name: sourmash-bio
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set up a cache to avoid the long build times

- run: nix run .# -- --version

- run: nix-shell --command "tox -e py39"
- run: nix-shell --command "tox -e py310"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run with the same Python version for the nix package, so we don't need to download/build two Python versions

doc/conf.py Outdated
@@ -65,8 +65,8 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
from pkg_resources import get_distribution
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg_resources is from setuptools1, let's use something in the stdlib instead

Footnotes

  1. might be distutils, but better to avoid it anyway

@@ -78,19 +78,23 @@ harness = false

## Wasm section. Crates only used for WASM, as well as specific configurations

[target.'cfg(all(target_arch = "wasm32", target_vendor="unknown"))'.dependencies.wasm-bindgen]
[target.'cfg(all(target_arch = "wasm32", target_os="unknown"))'.dependencies.wasm-bindgen]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the pure wasm target is wasm32-unknown-unknown (used for the NPM package)
  • the pyodide wasm target is wasm32-unknown-emscripten
  • wasi is target wasm32-wasi

so setting os instead of vendor here matches wasm32-*-unknown instead of wasm32-unknown-* and avoid restricting POSIX/libc-like targets like emscripten and wasi

Comment on lines +89 to +91
[target.'cfg(all(target_arch = "wasm32"))'.dependencies.chrono]
version = "0.4.23"
features = ["wasmbind"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have a direct dependency on chrono, but setting this feature here solves problems in upstream deps

src/sourmash/cli/info.py Outdated Show resolved Hide resolved
luizirber added a commit to dib-lab/screed that referenced this pull request Jan 12, 2023
`pkg_resources` is part of `setuptools`, so removing it allows not having a runtime dep on `setuptools`. It is also discouraged since `importlib` has the necessary features.
https://setuptools.pypa.io/en/latest/pkg_resources.html

Declare `importlib_resources`  as a dependency for tests in 3.8 (since the `.files()` method was added in 3.9 stdlib)

Update Read the Docs config to avoid the default 3.7 version.

Relevant to sourmash-bio/sourmash#2433 and NixOS/nixpkgs#205878
@luizirber luizirber marked this pull request as ready for review March 5, 2023 22:45
@luizirber luizirber changed the title [EXP] Try out pyodide wheels Build pyodide wheels in CI Mar 5, 2023
@luizirber
Copy link
Member Author

I think this is enough to submit the package to pyodide and emscripten-forge, so going for a merge

Ready for review @sourmash-bio/devs

@luizirber luizirber requested a review from a team March 5, 2023 22:55
@luizirber luizirber requested a review from ctb March 5, 2023 22:55
@luizirber luizirber merged commit fecfc97 into latest Mar 6, 2023
@luizirber luizirber deleted the lirber/pyodide branch March 6, 2023 00:42
Copy link
Contributor

@ctb ctb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ;)

@ctb ctb mentioned this pull request Apr 6, 2023
1 task
hoodmane pushed a commit to pyodide/pyodide that referenced this pull request Apr 8, 2023
Add sourmash (Python + Rust extension, packaged with maturin) and missing pure-wheel deps (screed, bitstring, cachetools, deprecation).

After a couple of fixes in sourmash-bio/sourmash#2433 I managed to build it out-of-tree, would like to have it available here to make it easier to distribute (while PyPI doesn't support emscripten wheels).
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.

2 participants