-
Notifications
You must be signed in to change notification settings - Fork 29
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
NPE1Adapter Part 3 - caching of adapter manifests #126
Conversation
Codecov Report
@@ Coverage Diff @@
## main #126 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 1650 1719 +69
=========================================
+ Hits 1650 1719 +69
Continue to review full report at Codecov.
|
Testing this out I ran into something I don't understand. This is on a py39 env with napari main, this pr and napari_animation (which is npe1) installed. If I run python and import napari_animation I get:
which seems strange? I'm out of time tonight, but I'll try to reproduce in the morning with a clean env. On the success side, I can see e.g. napari-ndtiffs get cached. I really like that there's cli support. |
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.
I ran into an issue and got confused. Will pick this up in the am.
I'll take a look soon. I'll remind you that napari tools menu is not really a plugin, but rather a monkey patch that doesn't have hook implementations, so all bets are off for that one . |
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.
Looks good. There was one spot where you hardcode the length of SHIM_NAME_PREFIX and I left a couple of questions.
One question I had was how to document some of the inferences that get made when converting plugins (like categorizing a theme as dark/light mode based on luma). Or extracting glob patterns for readers. I feel like that's a future discussion though.
npe2/manifest/utils.py
Outdated
""" | ||
|
||
assert shim_name.startswith(SHIM_NAME_PREFIX), f"Invalid shim name: {shim_name}" | ||
python_name, idx = shim_name[13:].rsplit("_", maxsplit=1) # TODO, make a function |
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.
I'm not quite sure what the TODO is referring to. I'm not sure I would factor anything out of this function as is. Should probably avoid the 13
- replace with len(SHIM_NAME_PREFIX)
etc.
wasn't able to repeat in a clean environment with napari, npe2, and napari-animation... but if I |
yeah, this circular import is because napari-tools-menu imports the private |
merging! This by no means implies that we can't iterate / refactor / cleanup moving forward. but it will make it a bit easier to get this in and play with it a bit |
Breaking up #86 into three steps. This is part 3 (but it contains #124 and #125 which can be reviewed first)
This PR adds local caching of adapter manifests after contributions have been imported and indexed. This is the thing that will really make napari much faster on load time.
npe2 cache
command provides additional ways to query/modify the cachenpe2 cache --clear
.NPE2_NOCACHE=1