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

ENH: Improve importing optional packages and modules #194

Closed

Conversation

jhlegarreta
Copy link
Contributor

Improve importing optional packages and modules:

  • Add helper classes and utils to take care of trying to import optional packages, and to provide meaningful information when such packages cannot be imported.
  • Add the corresponding tests.

Prefer using all lowercases for the flags that contain the package/module import success value.

@jhlegarreta
Copy link
Contributor Author

jhlegarreta commented Oct 21, 2023

matplotlib is in reality a required package: https://github.com/SlicerDMRI/whitematteranalysis/blob/master/requirements.txt#L2, so these conditional imports may be made non-optional.

Maybe this was done for cases where there is no display system, but this can be achieved otherwise.

Anyways, maybe we can keep the logic in this PR and remove the optional package import attempt and make it non-optional in a future PR as other aspects get improved.

@jhlegarreta jhlegarreta force-pushed the ImproveImportingOptPackages branch 2 times, most recently from dd11ef0 to 3673dbd Compare October 21, 2023 21:46
Improve importing optional packages and modules:
- Add helper classes and utils to take care of trying to import optional
  packages, and to provide meaningful information when such packages
  cannot be imported.
- Add the corresponding tests.

Prefer using all lowercases for the flags that contain the
package/module import success value.

Move the `whitematteranalysis/utils.py` module to the
`whitematteranalysis/utils/utils.py` module to avoid package name
clashes.
@jhlegarreta jhlegarreta force-pushed the ImproveImportingOptPackages branch from 3673dbd to 91fde8d Compare October 21, 2023 21:52
@jhlegarreta jhlegarreta deleted the ImproveImportingOptPackages branch October 21, 2023 22:08
@jhlegarreta jhlegarreta restored the ImproveImportingOptPackages branch October 21, 2023 22:08
@jhlegarreta
Copy link
Contributor Author

Closed inadvertently. Opened PR #195.

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.

1 participant