-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(importer): add custom sys meta path finder #2953
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
Codecov Report
@@ Coverage Diff @@
## master #2953 +/- ##
==========================================
- Coverage 90.03% 89.96% -0.08%
==========================================
Files 138 138
Lines 9513 9545 +32
==========================================
+ Hits 8565 8587 +22
- Misses 948 958 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
jina/importer.py
Outdated
_loader = ModuleLoader() | ||
|
||
|
||
class PathFinder: |
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.
may be better to rename this to JinaExecPathFinder, according to https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_meta_path_finders.html there is a PathFinder class involved and could become confusing?
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 your suggestions. I have renamed it as ExtensionPathFinder
4d02e07
to
0c13339
Compare
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.
LGTM! Just a quick question for my understanding.
load_path = module.__spec__.origin | ||
init_file = '__init__.py' | ||
if load_path.endswith(init_file): | ||
module.__path__ = [load_path[: -len(init_file) - 1]] |
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.
For my understanding, what's the use case for setting the module.__path__
variable?
This PR aims at fixing the (internal) extra dependency issues in our hub .
For instance, base on the executor from https://github.com/jina-ai/executor-audio-VGGishEncoder/tree/fix-module-not-found , i found some weird observations.
All of the use cases above work perfectly. However, if we want to use
jina executor/pod/pea
cli to load executor, we will get errors: