feat: implement python dependency lifecycle and reference counting #1025
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.
Overview
This PR introduces a robust Python library management system for the IPM (InterSystems Package Manager). It transitions the system to a state-aware lifecycle manager that tracks library ownership, handles local wheel files, and ensures a clean environment during module uninstallation.
fixed: #1006
Key Implementations
-with-pyModifier: New opt-in flag foruninstall. By default, Python libraries are preserved. Physical removal only occurs when-with-pyis explicitly called.%IPM.Storage.PythonReferenceto track library usage across the instance.RefCount- Prevents "Dependency Breaking": A library is only physically uninstalled when itsRefCountreaches 0, meaning no other installed module requires it.pip uninstalltriggers only whenRefCountreaches 1 (the final module using it).Execution Sample (Verbose Mode)
Additionally fixed the
<UNDEFINED>InstallOrDownloadPythonRequirem+64^%IPM.Lifecycle.Base.1errorto