Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop trying to exclude qcodes from Spyder UMR #6647

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (

Check warning on line 35 in src/qcodes/utils/helpers.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/utils/helpers.py#L35

Added line #L35 was not covered by tests
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

Check warning on line 4 in src/qcodes/utils/spyder_utils.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/utils/spyder_utils.py#L4

Added line #L4 was not covered by tests

from qcodes.utils.deprecate import QCoDeSDeprecationWarning

Check warning on line 6 in src/qcodes/utils/spyder_utils.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/utils/spyder_utils.py#L6

Added line #L6 was not covered by tests

_LOG = logging.getLogger(__name__)


@deprecated(

Check warning on line 11 in src/qcodes/utils/spyder_utils.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/utils/spyder_utils.py#L11

Added line #L11 was not covered by tests
"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
Loading