diff --git a/qiskit/__init__.py b/qiskit/__init__.py index 20f2e3c80851..8075ae39d3c9 100644 --- a/qiskit/__init__.py +++ b/qiskit/__init__.py @@ -14,7 +14,6 @@ """Main Qiskit public functionality.""" -import pkgutil import sys import warnings @@ -69,14 +68,6 @@ import qiskit.circuit.measure import qiskit.circuit.reset -# Allow extending this namespace. Please note that currently this line needs -# to be placed *before* the wrapper imports or any non-import code AND *before* -# importing the package you want to allow extensions for (in this case `backends`). - -# Support for the deprecated extending this namespace. -# Remove this after 0.46.0 release -__path__ = pkgutil.extend_path(__path__, __name__) - # Please note these are global instances, not modules. from qiskit.providers.basicaer import BasicAer diff --git a/qiskit/providers/__init__.py b/qiskit/providers/__init__.py index d7ec4b21b9fe..0c3da6d21197 100644 --- a/qiskit/providers/__init__.py +++ b/qiskit/providers/__init__.py @@ -750,8 +750,6 @@ def status(self): to wrap a :class:`~.BackendV1` object with a :class:`~.BackendV2` interface. """ -import pkgutil - # Providers interface from qiskit.providers.provider import Provider from qiskit.providers.provider import ProviderV1 @@ -773,8 +771,3 @@ def status(self): BackendConfigurationError, ) from qiskit.providers.jobstatus import JobStatus - - -# Support for the deprecated extending this namespace. -# Remove this after 0.46.0 release -__path__ = pkgutil.extend_path(__path__, __name__) diff --git a/releasenotes/notes/remove-namespace-hooks-995bdb7515a9fe35.yaml b/releasenotes/notes/remove-namespace-hooks-995bdb7515a9fe35.yaml new file mode 100644 index 000000000000..df8601ba031c --- /dev/null +++ b/releasenotes/notes/remove-namespace-hooks-995bdb7515a9fe35.yaml @@ -0,0 +1,14 @@ +--- +upgrade: + - | + Support for extensions of the ``qiskit`` and ``qiskit.providers`` namespaces + by external packages has been removed. Support for doing this was deprecated + in the Qiskit 0.44.0 release. In the past, the Qiskit project was composed + of elements that extended a shared namespace and hook points were added + to enable doing that. However, it was not intended for these interfaces to + ever be used by other packages. Now that the overall Qiskit package is no + longer using that packaging model, leaving the possibility for these + extensions carry more risk than benefits and has therefore been removed. + If you’re maintaining a package that extends the Qiskit namespace (i.e. + your users import from ``qiskit.x`` or ``qiskit.providers.y``) you should + transition to using a standalone Python namespace for your package.