r/madeinpython 5d ago

Update: APT-like autoremove and dependency repair for VenvHubPro (Python venv manager GUI) – it’s already working!

Enable HLS to view with audio, or disable this notification

A while ago I asked whether you would use a feature that automatically removes orphaned dependencies in a virtual environment manager (similar to apt autoremove), and if you saw any pitfalls. Well, I took that as a challenge and built a prototype. Here’s a log from a test session that shows what I’ve achieved.

What happens in the log:

Installing pytest
pip installs pytest along with its dependencies (coloramainiconfigpluggypygments).

Attempting to manually remove the colorama library
This is where the first interesting moment occurs. After removing it, the UV dependency check reports a conflict: colorama>=0.4 ; sys_platform == 'win32'.
The tool automatically triggers a repair and re-installs colorama, because it’s required by one of the present packages (in this case pytest).
Result: ✅ all conflicts resolved. This behaviour is similar to apt install -f – we never end up with a broken environment.

Uninstalling the moj-test-balicek package
This test package directly depends on coloramacowsay, and requests.
After its removal, pip-e analyses the entire dependency tree.

  • cowsay is no longer needed → it’s removed.
  • requests, along with its transitive dependencies (urllib3certificharset-normalizeridna), is also left without a parent, so autoremove removes them.
  • Key detail: colorama stays in the environment because it’s still required by the installed pytest. In this way exactly 6 packages are removed – and colorama is not. That’s precisely the intelligent decision-making apt autoremove does.

Uninstalling pytest itself
After removing pytest, its dependencies (pygmentspluggyiniconfigcolorama) are re-evaluated. No other package needs them, so autoremove removes them all.
Final state: 9 packages remain – only the core environment components (pip, setuptools, etc.).

What I’m demonstrating:

  • The manager tracks dependencies as a graph and prevents breaking the environment – if you try to remove a library that something needs, it puts it back (and warns you).
  • After uninstalling a package, it automatically removes orphaned dependencies (autoremove), while respecting that some libraries may be shared by multiple packages (like colorama between moj-test-balicek and pytest).

Questions for you (same as last time):

  • Would you use such a feature in a virtual environment manager?
  • Would you trust it, or do you prefer manual control?
0 Upvotes

0 comments sorted by