-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
[four-point-oh?] Unload packages that depend on a plugin that is updated #1628
Comments
First of all, PC does concern itself with inter-dependecnies across packages at all currently. Packages can only depend on libraries (new term, previously "dependencies"). You touched on that in your post, but I wanted to make it clear. If we assume that PC knew about a package's dependency packages, it would also need to have deep knowledge about the modules contained in that dependency because in order to properly unload them, PC would need to remove them all from Now, PC could do something similar to what some modular packages already do when being reloaded and just unload any module that starts with the package name as the prefix (example, but that still won't clear up any already existing references to these modules or an attribute (or class instance) from these modules. It would have to rely on other packages correctly declaring their dependencies (and also unloading all of them). Then we would end up with the following situation:
and the following procedure:
That sounds like it should work but can definitely be fragile (e.g. if something registers modules outside of their prefixed namespace by modifying |
Does PC any of this already? I thought it just just disables/enables the package, but doesn't touch e.g. Just to be clear what the starting point is. |
No, PC doesn't do anything of that atm, even not in four-point-oh branch.
|
Maybe this can be done dynamically without explicitly specifying the dependencies. I experimented a bit with import sys
from importlib.abc import MetaPathFinder
PACKAGE_DEPENDENCIES = {}
class Python33DependencyDetector(MetaPathFinder):
def find_module(self, fullname, path):
# Detect which package does import 'fullname' and add to PACKAGE_DEPENDENCIES
return None
current_finder = Python33DependencyDetector()
# Insert at index 0 to intecept loading procedure
sys.meta_path.insert(0, current_finder)
print(sys.meta_path)
def plugin_unloaded():
global current_finder
assert current_finder
sys.meta_path.remove(current_finder)
current_finder = None the packages that depend on other packages can be detected by walking the call stack. |
When updating a dependency (e.g. LSP) all plugins (e.g. LSP-* helpers) that depend on LSP break.
Preferred solution:
This should fix the issue that ST needs to be restarted after an update. Bonus: LSP does not need explicitly to be installed because Package Control knows about the dependency.
The text was updated successfully, but these errors were encountered: