-
Notifications
You must be signed in to change notification settings - Fork 2k
Check authorized imports in LocalPythonInterpreter constructor #265
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
Check authorized imports in LocalPythonInterpreter constructor #265
Conversation
Removed TODO from comment
@@ -1529,7 +1530,12 @@ def __init__( | |||
**tools, | |||
**BASE_PYTHON_TOOLS.copy(), | |||
} | |||
# TODO: assert self.authorized imports are all installed locally | |||
# assert self.authorized imports are all installed locally | |||
missing_modules = [imp for imp in self.authorized_imports if find_spec(imp) is None] |
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.
There's an issue here if additional_authorized_imports
includes "*"
. A check should be added to ensure "*"
is working properly.
@AngeloKiriakoulis good catch on the wildcard import. I added a test case for the wildcard import and fixed the implementation. Ran make style on changed files. |
any chance of getting this merged? Alternatively, I would just close and delete this MR. |
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!
I fixed it to support partial star-pattern introduced by:
Also, I extracted the code to a dedicated method, refactored the test, and fixed the conflicts with the main branch.
Checking if authorized_imports exist was marked as TODO in the comment.
This MR implements this functionality and adds tests.
Also adds a test option to the makefile to skip the tests of DocStrings, which require API keys.