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

Lazy load zstandard #827

Closed
wants to merge 1 commit into from

Conversation

mattwthompson
Copy link
Contributor

Description

This PR defers import zstandard until it's needed. Some weird packaging issues cause a conflict that prevents any QCPortal import. I'm not sure when these compression/caching modules are used, i.e. by common user operations or only by admins. If they're ever not needed, this avoids an unnecessary crash.

Changelog description

Lazy load zstandard

Status

  • Code base linted
  • Ready to go

@bennybp
Copy link
Contributor

bennybp commented May 1, 2024

Playing around with the zstd stuff, I see they have an environment variable for how the backend gets loaded. It seems to help in my case. https://python-zstandard.readthedocs.io/en/latest/api_usage.html

$ PYTHON_ZSTANDARD_IMPORT_POLICY='cffi_fallback' python3 -c 'from openeye import oechem; import zstandard;print("ok")'
ok

So openeye bundles a zstd dynamic library with it? I see a ./libs/python3-linux-x64-g++10.x/libzstd.so.1 in the openeye package. I think using cffi would then make zstandard imports use the installed library that's part of the zstd package, but I'm not positive and no idea if that would cause problems.

@mattwthompson
Copy link
Contributor Author

I wish I found that a while back - that's exactly what I need!

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