FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add `zstandard` by agriyakhetarpal · Pull Request #4792 · pyodide/pyodide · GitHub

Add zstandard - #4792

Merged
hoodmane merged 12 commits into
pyodide:mainfrom
agriyakhetarpal:recipe/zstandard
May 26, 2024
Merged

Add zstandard#4792
hoodmane merged 12 commits into
pyodide:mainfrom
agriyakhetarpal:recipe/zstandard

Conversation

agriyakhetarpal commented May 24, 2024
edited
Loading

Copy link
Copy Markdown
Member

Description

This PR adds the zstandard Python package with the C and CFFI backends (the Rust backend is not compiled as of now, but can be a future improvement). zstandard is a required dependency in the upcoming version 3 release for Zarr.

Closes #4788

Checklists

  • Add a CHANGELOG entry
  • Add / update tests
  • Add new / update outdated documentation

Additional context

xref: zarr-developers/zarr-python#1903

Copy link
Copy Markdown
Member Author

Looks like the build timed out before it could build zstandard. @ryanking13 or @hoodmane, could you please re-trigger the relevant CircleCI runs? Thanks! zstandard builds in ~16 seconds locally, FYI.

Copy link
Copy Markdown
Member

context deadline exceeded means that too much time passed without anyone writing to stdout. We could add to pyodide build-recipes in CI a pulse that occasionally just writes a keepalive message so that this won't happen.

agriyakhetarpal commented May 25, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

I pushed fixes in 71c7e72 to resolve the two test failures, and all tests are now passing. Please let me know if I should add any more tests. Otherwise, I think this is ready for review/merging.

Copy link
Copy Markdown
Member

I sent you an email, did you receive it? (No reply needed, just want confirmation that I got the right email for you.)

Copy link
Copy Markdown
Member Author

Yes, received it, @hoodmane (I was going to reply later in the day today!).

hoodmane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @agriyakhetarpal. Tests look good. One comment.

Comment thread packages/zstandard/test_zstandard.py Outdated
Co-Authored-By: Hood Chatham <roberthoodchatham@gmail.com>

Copy link
Copy Markdown
Member Author

Thanks for the feedback! Addressed in a7487a8 by adding a pytest fixture and I additionally used autouse=True so that I do not need to apply it across all the functions.

Comment thread packages/zstandard/test_zstandard.py Outdated
Comment thread packages/zstandard/test_zstandard.py Outdated
Comment thread packages/zstandard/test_zstandard.py Outdated

Copy link
Copy Markdown
Member Author

In 8ce3314, I added zstd.backend so that we can avoid using the environment variable and instead set the backend programmatically. This should run the tests with both backends.

Copy link
Copy Markdown
Member Author

In c66aaaf, I succumbed to parameterising each function directly... this shouldn't fail on anything and I thought it would be okay since there are not a lot of tests.

agriyakhetarpal commented May 25, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

Builds with both cext and cffi are passing on CircleCI in the no-numpy-dependents jobs, @hoodmane. Please let me know if anything else is needed to be done. Ready for review/merging, again.

hoodmane merged commit 04e311f into pyodide:main May 26, 2024

Copy link
Copy Markdown
Member

Thanks @agriyakhetarpal!

agriyakhetarpal deleted the recipe/zstandard branch May 26, 2024 01:10

hoodmane May 26, 2024
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@agriyakhetarpal Yeah this commit definitely wasn't going to work. The request fixture is not pickleable. You'd still need the pair of functions so that you can access request.param in the host runtime and then pickle just that string.

hoodmane May 26, 2024
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh, but I see it was wrong before this commit too because you put @run_in_pyodide on the fixture. If you want to avoid manually parametrizing each test, the correct code is:

@run_in_pyodide(packages=["zstandard"])
def set_zstd_backend(selenium, zstd_backend):
    import zstandard as zstd

    zstd.backend = request.param


@pytest.fixture(params=["cext", "cffi"], autouse=True)
def zstd_backend(selenium, request):
    # Runs in host, request not pickleable so we can't send it to Pyodide.
    # Look up `request.param` which is a string hence pickleable and send that to Pyodide
    set_zstd_backend(selenium, request.param)

agriyakhetarpal May 26, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh, I didn't realise that – I thought the reason why it didn't work before was because I didn't add a yield statement for set_zstd_backend. Do we need to revert this PR? I can add the fix you suggested.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nah you can make a follow-up that does that. Label it nfc for nonfunctional change.

Thanks!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

zstandard

2 participants


Back | FazBrowse Home | New Git URL