refactor: use pip uninstall instead of folder deletion on plugin reload#370
Open
wu-vincent wants to merge 2 commits intomainfrom
Open
refactor: use pip uninstall instead of folder deletion on plugin reload#370wu-vincent wants to merge 2 commits intomainfrom
wu-vincent wants to merge 2 commits intomainfrom
Conversation
c4a3429 to
a65a961
Compare
When the plugin loader is destroyed (on server reload) or created (on startup after a crash), pip uninstall all endstone_* distributions instead of deleting the prefix folder. This avoids file-lock errors on Windows, preserves shared dependencies across reloads for faster loading, and handles crash recovery since _uninstall_plugins discovers distributions dynamically rather than relying on tracked state.
a65a961 to
af0344b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shutil.rmtreeofendstone_*directories withpip uninstallinPythonPluginLoader.__del__LD_PRELOADenv stripping (already handled inmain.cpp)Motivation
On server reload, the old approach deleted the entire
.localprefix folder contents. This caused:Now
pip uninstallcleanly removes only the plugin packages when the loader is destroyed, leaving shared dependencies intact for the next load cycle.Test plan
/reloadcommand cleanly uninstalls plugins and reloads without errors.whlfiles are installed correctly on first load🤖 Generated with Claude Code