From 32d97015fa7db3df9328d053d3cc8e7de0e10efc Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Fri, 23 Aug 2024 13:59:14 -0500 Subject: [PATCH 1/2] API: Don't expose SpyderPlugin and SpyderPluginWidget as part of it Since the migration to the new API is complete, there are no internal plugins that rely on those classes anymore. So it's better not to support them for Spyder 6 (otherwise we wouldn't notice when we break them). --- changelogs/Spyder-6.md | 4 +++- spyder/api/plugin_registration/registry.py | 5 ++--- spyder/api/plugins/__init__.py | 3 +-- spyder/api/plugins/{old_api.py => _old_api.py} | 6 +++--- spyder/api/plugins/new_api.py | 2 +- spyder/app/mainwindow.py | 5 ++--- spyder/plugins/preferences/plugin.py | 3 ++- 7 files changed, 14 insertions(+), 14 deletions(-) rename spyder/api/plugins/{old_api.py => _old_api.py} (99%) diff --git a/changelogs/Spyder-6.md b/changelogs/Spyder-6.md index 10ce7c6f8fb..1dfc5b855fe 100644 --- a/changelogs/Spyder-6.md +++ b/changelogs/Spyder-6.md @@ -39,12 +39,14 @@ * Add a new button to the Variable Explorer to indicate when variables are being filtered. -### New API features +### New API and plugin features * `SpyderPluginV2.get_description` must be a static method now and `SpyderPluginV2.get_icon` a class or static method. This is necessary to display the list of available plugins in Preferences in a more user-friendly way (see PR spyder-ide/spyder#21101). +* `SpyderPlugin` and `SpyderPluginWidget` are no longer exposed in the public + API. They will be removed in Spyder 6.1. * Generalize the Run plugin to support generic inputs and executors. This allows plugins to declare what kind of inputs (i.e. file, cell or selection) they can execute and how they will display the result. diff --git a/spyder/api/plugin_registration/registry.py b/spyder/api/plugin_registration/registry.py index 040f1cdfaf0..c2cc39ee089 100644 --- a/spyder/api/plugin_registration/registry.py +++ b/spyder/api/plugin_registration/registry.py @@ -20,9 +20,8 @@ from spyder.api.config.mixins import SpyderConfigurationAccessor from spyder.api.plugin_registration._confpage import PluginsConfigPage from spyder.api.exceptions import SpyderAPIError -from spyder.api.plugins import ( - Plugins, SpyderPluginV2, SpyderDockablePlugin, SpyderPluginWidget, - SpyderPlugin) +from spyder.api.plugins import Plugins, SpyderDockablePlugin, SpyderPluginV2 +from spyder.api.plugins._old_api import SpyderPlugin, SpyderPluginWidget from spyder.utils.icon_manager import ima diff --git a/spyder/api/plugins/__init__.py b/spyder/api/plugins/__init__.py index 2a2cfb63c63..2877409ef05 100644 --- a/spyder/api/plugins/__init__.py +++ b/spyder/api/plugins/__init__.py @@ -9,7 +9,7 @@ ================== Here, 'plugins' are Qt objects that can make changes to Spyder's main window -and call other plugins directly. +and call/connect to other plugins directly. There are two types of plugins available: @@ -22,5 +22,4 @@ """ from .enum import Plugins, DockablePlugins # noqa -from .old_api import SpyderPlugin, SpyderPluginWidget # noqa from .new_api import SpyderDockablePlugin, SpyderPluginV2 # noqa diff --git a/spyder/api/plugins/old_api.py b/spyder/api/plugins/_old_api.py similarity index 99% rename from spyder/api/plugins/old_api.py rename to spyder/api/plugins/_old_api.py index d86c3df1a6d..b8aae8afc24 100644 --- a/spyder/api/plugins/old_api.py +++ b/spyder/api/plugins/_old_api.py @@ -7,9 +7,9 @@ """ Old API for plugins. -These plugins were supported until Spyder 4, but they will be deprecated in -the future. Please don't rely on them for new plugins and use instead the -classes present in new_api.py +These plugins were supported until Spyder 5, but that's no longer the case. +Please don't rely on them for new plugins and use instead the classes present +in new_api.py """ # Third-party imports diff --git a/spyder/api/plugins/new_api.py b/spyder/api/plugins/new_api.py index 7d8f58b2f3d..f35916a5a50 100644 --- a/spyder/api/plugins/new_api.py +++ b/spyder/api/plugins/new_api.py @@ -43,7 +43,7 @@ # Package imports from .enum import Plugins -from .old_api import SpyderPluginWidget +from ._old_api import SpyderPluginWidget # Logging diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py index 7e406c7a001..32b3254f972 100644 --- a/spyder/app/mainwindow.py +++ b/spyder/app/mainwindow.py @@ -94,9 +94,8 @@ # Spyder API Imports from spyder.api.exceptions import SpyderAPIError -from spyder.api.plugins import ( - Plugins, SpyderPlugin, SpyderPluginV2, SpyderDockablePlugin, - SpyderPluginWidget) +from spyder.api.plugins import Plugins, SpyderDockablePlugin, SpyderPluginV2 +from spyder.api.plugins._old_api import SpyderPlugin, SpyderPluginWidget #============================================================================== # Windows only local imports diff --git a/spyder/plugins/preferences/plugin.py b/spyder/plugins/preferences/plugin.py index 80d7f459c3d..a5230ee7f46 100644 --- a/spyder/plugins/preferences/plugin.py +++ b/spyder/plugins/preferences/plugin.py @@ -24,7 +24,8 @@ from qtpy.QtWidgets import QMessageBox # Local imports -from spyder.api.plugins import Plugins, SpyderPluginV2, SpyderPlugin +from spyder.api.plugins import Plugins, SpyderPluginV2 +from spyder.api.plugins._old_api import SpyderPlugin from spyder.api.plugin_registration.decorators import ( on_plugin_available, on_plugin_teardown) from spyder.api.plugin_registration.registry import PreferencesAdapter From b79c552ff777c9a6100d0dc899e6acbb5be5cf87 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Fri, 23 Aug 2024 14:00:44 -0500 Subject: [PATCH 2/2] API: Bump version to 1.0 This means that from now on we'll try to keep it as stable as possible. --- spyder/api/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/api/_version.py b/spyder/api/_version.py index 9e275cbcd63..9137d39c778 100644 --- a/spyder/api/_version.py +++ b/spyder/api/_version.py @@ -22,5 +22,5 @@ updated. """ -VERSION_INFO = (0, 10, 0) +VERSION_INFO = (1, 0, 0) __version__ = '.'.join(map(str, VERSION_INFO))