Skip to content

Conversation

@superstar54
Copy link
Member

@superstar54 superstar54 commented Oct 7, 2025

Why is this change needed?

Two new possible use-cases require top-level verdi extensibility:

  • Introducing a new aiida-gui package that should expose verdi gui.
  • The new aiida-restapi package that may need to expose the new restapi

This PR

mirrors the same pattern used by verdi data:

  • Declares the verdi Click group with cls=Pluginable and entry_point_group="aiida.cmdline.verdi".
  • Enables external packages to contribute first-level commands (e.g. verdi gui) without touching aiida-core.

Affect on the performance of verdi

One concern is that loading the entry point from the plugins will cause verdi to have a slow response.

Benchmark: verdi --help measured with and without this change shows an additional ~50 ms on average in my environment. This overhead is negligible compared to the benefits. Thanks @danielhollas for the tip.

image

Name conflicts

Improving conflict handling is out of scope for this PR and can be addressed for all Pluginable groups in a further PR..

- Declare the `verdi` Click group with `cls=Pluginable` and
  `entry_point_group="aiida.cmdline.verdi"`.
- Enables external packages to contribute first-level commands
  (e.g. `verdi gui`, `verdi restapi`) without touching aiida-core.
- Mirrors the same pattern used by `verdi data`.
@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.28%. Comparing base (cfbbd68) to head (09c9566).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7053      +/-   ##
==========================================
- Coverage   79.29%   79.28%   -0.00%     
==========================================
  Files         566      566              
  Lines       43847    43847              
==========================================
- Hits        34763    34761       -2     
- Misses       9084     9086       +2     

☔ 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
Collaborator

Benchmark: verdi --help measured with and without this change shows an additional ~50 ms on average in my environment. This overhead is negligible compared to the benefits.

@superstar54 thank you for the benchmark. Was this benchmarked with or without aiida-gui being installed in the environment? Can you benchmark also the other case?
(I wouldn't say 50ms is negligible, as I worked very hard on getting rid of much even slower slowdowns 😅 since they add up. But perhaps its worth it in this case?)

@superstar54
Copy link
Member Author

Was this benchmarked with or without aiida-gui being installed in the environment? Can you benchmark also the other case?

Hi @danielhollas, yes, this test was run with aidia-gui installed. In order to test more plugins, I created five more fake commands in five different plugin packages. The time difference only increases from ~ 50 ms to ~60 ms.

image

But perhaps its worth it in this case?

Yes, indeed.

@superstar54
Copy link
Member Author

Comment from @giovannipizzi , expose all plugin commands under the verdi plugin catalog. I will investigate this more.

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.

3 participants