From 879c7d5f7d12e69e880480a39fc3f3f2461024c9 Mon Sep 17 00:00:00 2001 From: tlestang Date: Fri, 27 Mar 2026 15:38:24 +0100 Subject: [PATCH 1/3] Remove messages on stdout on import and interpreter exit --- src/vortex/__init__.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/vortex/__init__.py b/src/vortex/__init__.py index 17d72cc6..848407af 100644 --- a/src/vortex/__init__.py +++ b/src/vortex/__init__.py @@ -35,7 +35,6 @@ import importlib.metadata from bronx.fancies import loggers as bloggers -import bronx.stdtypes.date import footprints @@ -141,26 +140,9 @@ def complete(): for kid in multiprocessing.active_children(): logger.warning("Terminate active kid %s", str(kid)) kid.terminate() - print( - "Vortex", - __version__, - "completed", - "(", - bronx.stdtypes.date.at_second().reallynice(), - ")", - ) atexit.register(complete) del atexit, complete -print( - "Vortex", - __version__, - "loaded", - "(", - bronx.stdtypes.date.at_second().reallynice(), - ")", -) - del footprints From 8fbad542432ed22d598e19aceec07aa08ca3c389 Mon Sep 17 00:00:00 2001 From: tlestang Date: Fri, 27 Mar 2026 15:39:04 +0100 Subject: [PATCH 2/3] Replace messages listing loaded plugins Replace by function loaded_plugins --- src/vortex/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vortex/__init__.py b/src/vortex/__init__.py index 848407af..3f796b0c 100644 --- a/src/vortex/__init__.py +++ b/src/vortex/__init__.py @@ -21,6 +21,7 @@ """ import atexit +import copy from pathlib import Path import sys @@ -127,9 +128,15 @@ def vortexfpdefaults(): # will typically depend on objects defined in 'vortex' # and 'vortex.nwp', these must be imported /before/ # loading plugins. +_LOADED_PLUGINS = set() for plugin in importlib.metadata.entry_points(group="vtx"): plugin.load() - print(f"Loaded plugin {plugin.name}") + _LOADED_PLUGINS.add(plugin.name) + + +def loaded_plugins() -> set[str]: + """Return the set of names for loaded plugins""" + return copy.copy(_LOADED_PLUGINS) # Register proper vortex exit before the end of interpreter session From 4bdc75d898a206a2833d56b87b7ca3e6b75fea9b Mon Sep 17 00:00:00 2001 From: tlestang Date: Tue, 31 Mar 2026 10:21:28 +0200 Subject: [PATCH 3/3] Document vortex.loaded_plugins --- sphinx/user-guide/plugins.rst | 3 +++ src/vortex/__init__.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sphinx/user-guide/plugins.rst b/sphinx/user-guide/plugins.rst index 731e31e3..0504cb4e 100644 --- a/sphinx/user-guide/plugins.rst +++ b/sphinx/user-guide/plugins.rst @@ -20,6 +20,9 @@ or :py:func:`vortex.task`, the corresponding Python modules must be installed as part of a package that declares the ``vtx`` entry point in its metadata. +The :py:func:`vortex.loaded_plugins` can be used to list currently +loaded plugin packages. + Example ------- diff --git a/src/vortex/__init__.py b/src/vortex/__init__.py index 3f796b0c..3197bf7a 100644 --- a/src/vortex/__init__.py +++ b/src/vortex/__init__.py @@ -67,6 +67,7 @@ "task", "promise", "diff", + "loaded_plugins", ] # Set vortex specific priorities for footprints usage @@ -135,7 +136,16 @@ def vortexfpdefaults(): def loaded_plugins() -> set[str]: - """Return the set of names for loaded plugins""" + """Return the set of names for loaded plugins + + **Example:** + + .. code:: python + + >>> import vortex + >>> vortex.loaded_plugins() + {"gco", "cen"} + """ return copy.copy(_LOADED_PLUGINS)