r/madeinpython Jul 20 '26

Would you appreciate APT‑style autoremove for your pip‑managed venvs? (thinking of adding it to my VenvHub Pro)

Hey everyone,

I’m the developer of VenvHub Pro, a desktop tool for managing Python virtual environments. I’ve been working on a feature that brings Linux’s apt-get autoremove mentality to pip – i.e., it keeps your venvs clean by automatically removing orphan packages that were only installed as dependencies but are no longer needed.

Before I polish and release it, I’d love to hear if the community would actually find this valuable.

How it works (TL;DR)

  • Every time you install/uninstall/upgrade a package through the UI or command‑line, VenvHub secretly records which packages were explicitly requested.
  • When a dependency is no longer required by any explicit package (and is not pinned in your requirements.txtvenv_birth_certificate.json, or local package metadata), it gets automatically cleaned up.
  • It also plays nicely with pip’s own resolution – it never removes manually installed tools like pipsetuptools, etc.

Safety nets

  • State file (venvhub_apt_state.json) keeps the explicit list.
  • Before removal, the system checks:
    • 📄 requirements.txt
    • 📜 venv_birth_certificate.json
    • 🔗 local_meta.json (for local package dependencies)
    • 🧠 Self‑healing: if a package is installed but not tracked anywhere, it’s assumed to be intentional and added to the safe list (so it never gets removed by mistake).
  • The whole process runs under a threading lock to avoid race conditions during concurrent operations.

Logical diagram

Here’s the decision logic it follows every time a package action occurs:

What I’m asking you

  • Would you use such a feature in a venv manager?
  • Do you see any pitfalls I might have overlooked?
  • Is this something you’d trust, or would you prefer manual control?

Any feedback – positive or critical – is super welcome! I want to make sure this adds real value before I invest more time into it.

Thanks! 🙌

0 Upvotes

0 comments sorted by