-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add missing package error and unit tests for molecule interfaces #150
Merged
Conversation
This file contains 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
dormrod
changed the title
Add unit tests for molecule interfaces
Add missing package error and unit tests for molecule interfaces
Sep 19, 2024
dormrod
force-pushed
the
DavidOrmrodMorley/mol_interfaces
branch
5 times, most recently
from
September 20, 2024 07:52
891b12b
to
0b6d7a4
Compare
dormrod
force-pushed
the
DavidOrmrodMorley/mol_interfaces
branch
from
September 24, 2024 09:58
709c297
to
10e344a
Compare
robertrueger
approved these changes
Sep 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea with the custom exception for missing optional packages. Much superior to what we had before.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The functional changes in this PR focus on the behaviour of PLAMS with optional packages / behaviour.
Outside of the required packages, some of the results management in PLAMS require optional packages like ASE/RDKit etc. which need to be installed separately.
Previously there were a few ways this was handled:
ImportError
when the function is called. Not particularly elegant.__all__
if it the package could not be found (rdkit). This to me is confusing as the user would just getImportError: cannot import name 'from_smiles' from 'scm.plams'
which is confusing as this method is documented.The solution proposed here is to raise a new error
MissingOptionalPackageError
when one of the results methods is called. This is added to a method through the@requires_optional_package
decorator. This message is more informative.In addition, add/refactor a bunch of unit tests for:
N.B. can also add this in for UCS support