Skip to content

Uninstall python package during app removal#515

Draft
danielhollas wants to merge 6 commits into
aiidalab:mainfrom
danielhollas:pip-uninstall
Draft

Uninstall python package during app removal#515
danielhollas wants to merge 6 commits into
aiidalab:mainfrom
danielhollas:pip-uninstall

Conversation

@danielhollas

@danielhollas danielhollas commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Currently, when an app is being uninstalled, the only thing we do is to remove the app directory (the git repo in /home/jovyan/apps/<app-name>). We don't remove the apps python package (if any) or any of its python dependencies.

Removing apps python dependencies would be unsafe, since they can be shared with other apps, but we can safely remove the python package of the app itself, since keeping it around is (at the very least) confusing. This is what this PR implements.

Note, this is only done on a best-effort basis, since the app name might not be the same as python package name. Notably, this is the case for QeApp, where the app name is quantum-espresso, while the python package is aiidalab-qe. Perhaps we can special case QeApp here?

Closes #405

Test plan

  1. Tested in CI on aiidalab-docker-stack repo: Test aiidalab pip-uninstall branch aiidalab-docker-stack#571

  2. Manual testing

$ aiidalab install --yes aurora

$ pip show aurora
Name: aurora
Version: 0.12.3
Summary: An AiiDAlab application for the Aurora BIG-MAP Stakeholder initiative.
Home-page: https://github.com/EmpaEconversion/aiidalab-aurora
Author: Edan Bainglass, Francisco F. Ramirez, Loris Ercole, Giovanni Pizzi
Author-email: edan.bainglass@psi.ch
License: 
Location: /home/jovyan/.local/lib/python3.9/site-packages
Requires: aiida-aurora, aiidalab, dgbowl-schemas, ipyfilechooser, ipympl, ipywidgets, numpy, pandas, pydantic, seaborn
Required-by:
$ aiidalab uninstall --yes aurora
Collecting apps to uninstall... Done.

Would uninstall:

  App name    Version    Path
  ----------  ---------  ------------------------
  aurora      0.12.3     /home/jovyan/apps/aurora

  ▬:detached •:modified

Uninstalled 'aurora' ('/home/jovyan/apps/aurora').
$ pip show aurora
WARNING: Package(s) not found: aurora

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.41%. Comparing base (40ad37c) to head (3b9eb26).

Files with missing lines Patch % Lines
aiidalab/app.py 46.15% 7 Missing ⚠️
aiidalab/utils.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #515      +/-   ##
==========================================
- Coverage   72.72%   72.41%   -0.31%     
==========================================
  Files          18       18              
  Lines        1672     1686      +14     
==========================================
+ Hits         1216     1221       +5     
- Misses        456      465       +9     
Flag Coverage Δ
py-3.12 72.41% <46.66%> (-0.31%) ⬇️
py-3.9 72.41% <46.66%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danielhollas

Copy link
Copy Markdown
Contributor Author

This proved a bit trickier then I thought. I think the current code works, but requires more testing so keeping in draft and moving to other more pressing things for now. No need to review yet.

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.

aiidalab uninstall does not remove the AiiDALab app package installed by pip

1 participant