Skip to content

Commit

Permalink
Merge pull request #6647 from jenshnielsen/remove_spyder_exclude
Browse files Browse the repository at this point in the history
Stop trying to exclude qcodes from Spyder UMR
  • Loading branch information
jenshnielsen authored Nov 21, 2024
2 parents 39d04a1 + 70a19c9 commit 8e9bf7c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/6647.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
QCoDeS no longer attempts to automatically disable Sypders User module reloader (UMR).
The code was no longer working correctly with the latest version of Spyder and is not
maintainable since Spyder does not have a public api to disable UMR. If you use
QCoDeS from an editable install it is strongly recommended to disable UMR for QCoDeS.
See :ref:`gettingstarted` for more details.
11 changes: 11 additions & 0 deletions docs/start/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,17 @@ or jupyter lab:
jupyter lab
.. note::

Note that Spyder ships with functionality to automatically reload modules that are installed
editable. This functionality called
`User Module Reloader <https://docs.spyder-ide.org/current/panes/ipythonconsole.html#reload-changed-modules>`__
is known to not work well with QCoDeS. If you install QCoDeS editable (with -e flag)
we strongly recommend users to exclude QCoDeS from UMR. QCoDeS used to attempt to automatically
disable this feature. However, as `Spyder does not provide a public API for doing this <https://github.com/spyder-ide/spyder/issues/2451>`__
this relied on a private API in Spyder and broke with the last Spyder release.
If at some point this becomes possible to do with a public API QCoDeS may again disable this automatically.

For other options from the terminal you can activate the QCoDeS in that terminal
then start any other application, such as *IPython* or
just plain old *Python*.
Expand Down
6 changes: 0 additions & 6 deletions src/qcodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import qcodes.configuration as qcconfig
from qcodes.logger.logger import conditionally_start_all_logging
from qcodes.utils import QCoDeSDeprecationWarning
from qcodes.utils.spyder_utils import add_to_spyder_UMR_excludelist

__version__ = qcodes._version.__version__

Expand All @@ -25,11 +24,6 @@

conditionally_start_all_logging()

# we dont want spyder to reload qcodes as this will overwrite the default station
# instrument list and running monitor
add_to_spyder_UMR_excludelist("qcodes")


import atexit

import qcodes.validators
Expand Down
4 changes: 3 additions & 1 deletion src/qcodes/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
from .json_utils import NumpyJSONEncoder
from .partial_utils import partial_with_docstring
from .path_helpers import QCODES_USER_PATH_ENV, get_qcodes_path, get_qcodes_user_path
from .spyder_utils import add_to_spyder_UMR_excludelist
from .spyder_utils import (
add_to_spyder_UMR_excludelist, # pyright: ignore[reportDeprecated]
)


# on longer in used but left for backwards compatibility until
Expand Down
8 changes: 8 additions & 0 deletions src/qcodes/utils/spyder_utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import logging
import os

from typing_extensions import deprecated

from qcodes.utils.deprecate import QCoDeSDeprecationWarning

_LOG = logging.getLogger(__name__)


@deprecated(
"Known to not work with latest Spyder and unused in QCoDeS",
category=QCoDeSDeprecationWarning,
)
def add_to_spyder_UMR_excludelist(modulename: str) -> None:
"""
Spyder tries to reload any user module. This does not work well for
Expand Down

0 comments on commit 8e9bf7c

Please sign in to comment.