-
Notifications
You must be signed in to change notification settings - Fork 73
[SYNPY-1744] Redo how curator extension checks imports #1307
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
Conversation
BryanFauble
left a comment
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.
Thanks for updating this to make this clearer what the users should be doing! I tested this out and can verify I got the ImportError:
ImportError: One or more packages needed for the Curator extension are not installed.Please install using 'pip install --upgrade 'synapseclient[curator]'
| func-timeout~=4.3 | ||
| pytest-cov~=4.1.0 | ||
| pandas>=1.5,<3.0 | ||
| jsonschema>=4.23.0 |
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.
Why did this move? Does curator not need this package anymore?
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.
So it was never in the Curator extension code. It is part of the tests for Curator extension.
|
|
||
|
|
||
| def check_curator_imports() -> None: | ||
| """Attempts to import all necessary packages for the Curator extension. |
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.
To discuss: Should this be in core.utils?
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.
It could be. It is only used here in this file though, and I doubt it will be used elswhere.
thomasyu888
left a comment
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.
🔥 thanks for the quick work and review!
SYNPY-1744
Problem:
When the Curator Extension functions are called, but the specific packages haven't been installed, the error messaging was more or less useful depending on the package. For example, if only the
inflectionpackage is missing the camelize function wouldn't be available, and things would break with a very unhelpful exception to users.Solution:
A function was added that checks that all Curator Extension packages are importable. This is called by
generate_json_schemaandgenerate_jsonld. If this function can't import all packages, a helpful message is part of anImportExceptionthat is raised, telling the user how to install the Curator packages.In addition, the
jsonschemapackage is only used for testing, so it was moved from the curator section to the tests section in setup.cfg.