[SYNPY-1744] Redo how curator extension checks imports#1307
[SYNPY-1744] Redo how curator extension checks imports#1307andrewelamb merged 3 commits intodevelopfrom
Conversation
BryanFauble
left a comment
There was a problem hiding this comment.
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.
Why did this move? Does curator not need this package anymore?
There was a problem hiding this comment.
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.
To discuss: Should this be in core.utils?
There was a problem hiding this comment.
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.
🔥 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.