8000 Introduce a new plugin API by edan-bainglass · Pull Request #1610 · aiidalab/aiidalab-qe · GitHub
[go: up one dir, main page]

Skip to content

Introduce a new plugin API - #1610

Merged
edan-bainglass merged 2 commits into
mainfrom
new-plugin-api
Nov 16, 2026
Merged

edan-bainglass merged 2 commits into
mainfrom
new-plugin-api

Conversation

@edan-bainglass
@edan-bainglass edan-bainglass commented Nov 11, 2026 •
Copy link
Copy Markdown
Member

This PR introduces a plugin API contract in the form of a QeAppPlugin abstract class for plugins to implement, injecting their various components as methods, with, and this is the key to this change, imports embedded in the method body. This effectively defers all plugin imports until they are absolutely needed! Since these are now so cheap to load, the app now loads and caches instances of QeAppPlugin from all installed apps. The rest of the app fetches what it needs, when it needs it, from the cache. The change is implemented on the builtin plugins. The contract is documented. PRs have been opened on all plugins to switch to this API. The entry point group for plugins is also changed to aiidalab_qe.plugins, for clarity.

A few other minor modifications were made to the plugin manager to improve its plugin compatibility checks. Mostly, both here and in the app's step 2, we NEED to run these checks to validate that a plugin is useable. This PR makes these run in parallel, on threads, to reduce the overall time. To improve UX on top, the message is made a bit clearer, and rendering occurs as checks complete.

@codecov
codecov Bot commented Nov 11, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.56338% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.71%. Comparing base (ee0a4b6) to head (94f69b6).

Files with missing lines Patch % Lines
src/aiidalab_qe/utils/plugin_manager.py 65.00% 28 Missing ⚠️
src/aiidalab_qe/app/configuration/step.py 78.37% 24 Missing ⚠️
src/aiidalab_qe/plugins/utils.py 90.00% 6 Missing ⚠️
src/aiidalab_qe/plugins/plugin.py 86.84% 5 Missing ⚠️
src/aiidalab_qe/app/structure/step.py 20.00% 4 Missing ⚠️
...idalab_qe/plugins/electronic_structure/__init__.py 87.50% 1 Missing ⚠️
src/aiidalab_qe/utils/examples_importer.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1610      +/-   ##
==========================================
+ Coverage   78.68%   78.71%   +0.02%     
==========================================
  Files         128      130       +2     
  Lines        8445     8681     +236     
==========================================
+ Hits         6645     6833     +188     
- Misses       1800     1848      +48     
Flag Coverage Δ
python-3.12 78.71% <80.56%> (+0.02%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cpignedoli
Copy link
Copy Markdown
Member

@edan-bainglass, I completed the five plugin migration reviews and the integrated API/panel checks. Manual Safari tests passed for Fast Si2 bands, PP charge density and the SiO2 Vibroscopy results, including the three INS views and a recalculated Q-plane map. HP, Muon and Wannier90 checks covered API integration and configuration/resource panels.

The Vibroscopy test exposed obsolete ARM setup downgrades. The fix is in aiidalab/aiidalab-qe-vibroscopy#194, with green CI and your review requested. Activation and INS loading now pass with the default catalog.

Before release, please coordinate the migrated plugin releases and store references. The store still pins Muon v1.3.0, whose legacy registration passes the activation check while the plugin disappears from the new catalog.

I also found follow-up issues with the older Silicon example archive and standalone Raman imports. The standalone Raman issue can be handled as a non-blocking follow-up.

Review and testing performed with the assistance of Codex.

@edan-bainglass
edan-bainglass commented Nov 12, 2026 •
Copy link
Copy Markdown
Member Author

@edan-bainglass, I completed the five plugin migration reviews and the integrated API/panel checks. Manual Safari tests passed for Fast Si2 bands, PP charge density and the SiO2 Vibroscopy results, including the three INS views and a recalculated Q-plane map. HP, Muon and Wannier90 checks covered API integration and configuration/resource panels.

Good! Especially regarding the INS views. Important to check all plugin features, as we saw recently 👍

The Vibroscopy test exposed obsolete ARM setup downgrades. The fix is in aiidalab/aiidalab-qe-vibroscopy#194, with green CI and your review requested. Activation and INS loading now pass with the default catalog.

Left a comment there. It is a bit confusing that the same code that is giving you issues on ARM was apparently working on ARM, as confirmed by you. Let's discuss on that PR.

Before release, please coordinate the migrated plugin releases and store references. The store still pins Muon v1.3.0, whose legacy registration passes the activation check while the plugin disappears from the new catalog.

This is a bit of a chicken and egg problem, as some plugins need this PR for testing. In the end, we just need to release all simultaneously and tag.

I also found follow-up issues with the older Silicon example archive and standalone Raman imports. The standalone Raman issue can be handled as a non-blocking follow-up.

Can you clarify what were the isssues? 🙏

Review and testing performed with the assistance of Codex.

🙏

@cpignedoli
Copy link
Copy Markdown
Member

@edan-bainglass, I repeated the manual Safari tests in the isolated ARM demo today, using QE 2242961 and the companion plugin PR heads fetched today.

  • Fresh Fast Si2 bands and PP charge-density calculations finished successfully, with their plots rendered in Safari.
  • The imported LiCoO2_hp.aiida example displays the Hubbard table and 3D structure. Selecting an inter-site row works.
  • The imported SiO2_full_vibro.aiida example passes the tested phonon bands/DOS and atom-selection controls, Raman/IR plot updates, dielectric/Born/Raman tensors with atom-site selection, and all three INS views. The Q-plane was recalculated on a 20×20 grid at 40 meV. This runtime includes Limit MPI ranks for projwfc.x and dos.x #193 plus the exact two CLI/test files from Fix ARM setup downgrades and Phonopy verification aiidalab-qe-vibroscopy#194.

I reproduced three archive-related crashes through the normal Examples → Import → History route.

Example Action and failing access
vibronic/Si_vibro_full.aiida Opening the calculation fails in the structure viewer at base.pw.parameters.get_dict().
muonic/LiF_full_muons.aiida Opening “Muon results” fails in produce_muonic_dataframe() at all_index_uuid.get_dict().
wannier90/GaAs_wannier90.aiida Opening “Wannier functions” fails at bands_distance.value.

With AiiDA 2.9.4 and aiida-pythonjob 0.5.2, the affected legacy data.pythonjob.builtins.dict.Dict. and data.pythonjob.builtins.float.Float. nodes resolve as generic Data. Their corresponding PythonJob data entry points are absent from the installed package. This explains the missing get_dict() and value attributes in this environment. The examples are from tag 2.0, commit 188248f016b9e57ea612ab1893d9891b0331359c. Example archive sources

For the standalone Raman issue, the existing test_spectrum_widgets_import_without_qe still fails because aiidalab_qe_vibroscopy/app/__init__.py:3 eagerly imports QeAppPlugin. That crosses the independent viewer's import boundary. We can handle this as the separate ORCA follow-up discussed above.

The feature-import and configuration/resource-panel checks pass for all five migrated plugins, and 21 focused API/post-install/Phonopy unit tests pass. Fresh scientific submissions covered bands and PP. HP and Vibroscopy result checks used imported examples. Muon and Wannier90 result checks stop at the crashes above.

I also clarified the mocked-test scope of my earlier #190 approval and the current numerical-stack findings in the #194 discussion. Clarification

Testing and review performed with the assistance of Codex.

@edan-bainglass
Copy link
Copy Markdown
Member Author

@cpignedoli I take it then that all is well with this PR then? All other matters are unrelated and are to be resolved in follow-up PRs in the appropriate repos. Please confirm (and if so, approve 🙂🙏).

@cpignedoli
Copy link
Copy Markdown
Member

Hi @edan-bainglass yes correct. I approve now

@cpignedoli cpignedoli left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ad discussed with Edan

@cpignedoli
Copy link
Copy Markdown
Member

Tested on 12–13 November in the isolated ARM64 AiiDAlab environment with Python 3.12, aiida-core 2.9.4 and aiida-quantumespresso 5.1.0.

@edan-bainglass, the requested fresh-calculation follow-up is complete. Bands, PP charge density, PDOS, PtO Bader, LiCoO2 HP, Si/SiO2 Vibroscopy, C8H6 XPS, Li2CO3 XAS, GaAs Wannier90 and LiF Muon results were calculated and their result viewers checked manually in Safari. PDOS succeeded as the property workflow from the initial combined PDOS/Bader submission. Bader was subsequently validated with the separate successful PtO app workflow.

The Muon parent was rebuilt successfully using standard AiiDA caching of our newly completed calculations after recovery problems. Details, input differences and linked companion fixes are documented in the individual plugin PR reports. The Muon convergence-formula finding is tracked separately in aiidalab/aiidalab-qe-muon#93, following your review-scope clarification.

The failed-workflow status display was also corrected and manually verified in #1612. The overnight SQLite session/lock problem is reported with a standalone reproducer in aiidateam/aiida-core#7789.

For release, please coordinate the host API, companion fixes and published plugin/backend versions, including aiida-muon and UNDI, then update the catalog references.

Testing and review performed with Codex assistance.

@edan-bainglass
Copy link
Copy Markdown
Member Author

Thanks @cpignedoli. All plugins are now updated w.r.t this PR. This can now proceed. I've bumped the minimum versions in the registry. Can you test against the registry versions? 🙏

@cpignedoli
Copy link
Copy Markdown
Member

@edan-bainglass, I am checking the published plugin artifacts against src/aiidalab_qe/plugins/plugins.yaml and preparing the installation/GUI checks.

One candidate-alignment question: at head 513160a, version.py still declares v26.11.0, while every registry entry requires >=26.11.1. The plugin manager's app-compatibility check would therefore reject this host version.

Will the candidate version be bumped before these tests, or is there another 26.11.1 candidate you would like me to use?

@edan-bainglass
Copy link
Copy Markdown
Member Author

@cpignedoli blocker removed. Kindly retry 🙏

@cpignedoli
Copy link
Copy Markdown
Member

@edan-bainglass I retried after your update on 94f69b6f5b94abb181299ff0d49bc6bc9b36948e (QE app 26.11.0). All seven registry installs and their declared post-install checks passed. All eight property configuration tabs and the saved-result viewers opened. The isolated runtime passed a cold restart, and the final source and import check passed across all 376 files. No workflows were submitted.

I reproduced one actionable defect in Xspec 0.4.2. From a fresh GUI session, open the saved Li₂CO₃ C K-edge result and click Duplicate. The original tab raises KeyError: 'Li' in XasConfigurationSettingsModel.get_model_state(), and the duplicate fails to restore its state. The getter mutates core_hole_treatments when reading the settings, so a repeated read tries to remove Li a second time. The XAS spectra and broadening controls passed.

I suggest a separate PR in aiidaplugins/aiida-qe-xspec to serialize the selected treatments into a new dictionary. All five focused tests passed with the proposed fix. The remaining check is to repeat Duplicate → Back → Confirm in the GUI with the fix applied.

@edan-bainglass
Copy link
Copy Markdown
Member Author

I reproduced one actionable defect in Xspec 0.4.2. From a fresh GUI session, open the saved Li₂CO₃ C K-edge result and click Duplicate. The original tab raises KeyError: 'Li' in XasConfigurationSettingsModel.get_model_state(), and the duplicate fails to restore its state. The getter mutates core_hole_treatments when reading the settings, so a repeated read tries to remove Li a second time. The XAS spectra and broadening controls passed.

Thanks @cpignedoli . Indeed, let's open a issue in xspec for this.

@edan-bainglass
edan-bainglass merged commit 5e1ddd3 into main Nov 16, 2026
14 checks passed
@edan-bainglass
edan-bainglass deleted the new-plugin-api branch November 16, 2026 16:57
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.

2 participants

0