Skip to content

RF: Use optional_package to allow code to assume pyzstd is present #1

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

Merged
merged 4 commits into from
Jun 4, 2021

Conversation

effigies
Copy link

Where possible, we try to code as if optional dependencies are present. optional_package provides three things:

  1. The requested module, or a fake module that raises an error when you try to access its namespace. If we can use only this, things are cleaner.
  2. A boolean indicating whether the module could be loaded. In cases where you really need to know, you can use this.
  3. A setup_module function that will instruct test runners to skip an entire test file if it could not be loaded. Mainly useful for things like minc2 which can't be opened at all without h5py.

So this is a PR to your PR that tries to use that approach, as well as adds pyzstd to the optional dependencies we test on.

@effigies
Copy link
Author

effigies commented May 30, 2021

Probably a good idea to just cherry-pick a1b1172 for now. Getting failures here: https://github.com/effigies/nibabel/actions/runs/890416068

Fixed.

@vanandrew vanandrew merged commit 258d0cd into vanandrew:zstd_support Jun 4, 2021
@effigies effigies deleted the zstd_support branch June 4, 2021 19:57
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