Skip to content

refactor: use pip uninstall instead of folder deletion on plugin reload#370

Open
wu-vincent wants to merge 2 commits intomainfrom
refactor/plugin-uninstall-on-reload
Open

refactor: use pip uninstall instead of folder deletion on plugin reload#370
wu-vincent wants to merge 2 commits intomainfrom
refactor/plugin-uninstall-on-reload

Conversation

@wu-vincent
Copy link
Copy Markdown
Member

Summary

  • Replace shutil.rmtree of endstone_* directories with pip uninstall in PythonPluginLoader.__del__
  • Track installed distribution names throughout the loader's lifetime
  • Remove unnecessary LD_PRELOAD env stripping (already handled in main.cpp)

Motivation

On server reload, the old approach deleted the entire .local prefix folder contents. This caused:

  1. File-lock errors on Windows — some files can't be deleted while in use
  2. Slow reloads — all dependencies get reinstalled even when unchanged

Now pip uninstall cleanly removes only the plugin packages when the loader is destroyed, leaving shared dependencies intact for the next load cycle.

Test plan

  • /reload command cleanly uninstalls plugins and reloads without errors
  • Plugin dependencies survive across reloads (not reinstalled)
  • New plugin .whl files are installed correctly on first load

🤖 Generated with Claude Code

@wu-vincent wu-vincent force-pushed the refactor/plugin-uninstall-on-reload branch 3 times, most recently from c4a3429 to a65a961 Compare April 7, 2026 19:05
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.
@wu-vincent wu-vincent force-pushed the refactor/plugin-uninstall-on-reload branch from a65a961 to af0344b Compare April 7, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant