-
Notifications
You must be signed in to change notification settings - Fork 317
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
Fix add_to_spyder_UMR_excludelist for Spyder 6 #6544
Open
sldesnoo-Delft
wants to merge
2
commits into
microsoft:main
Choose a base branch
from
sldesnoo-Delft:spyder6_umr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also encountered qcodes not running with the new Spyder 6. The
UserModuleReloader
is also available via a normal import:Using that instead of
sitecustomize.UserModuleReloader
works for me so far.@ccordoba12 Do you have an opinion on how to approach this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that as well.
Unfortunately Spyder6 does not use the global umr. So assignment of the changed UMR has no effect.
That's why I searched for the UMR instance that is being used and modify that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eendebakpt @sldesnoo-Delft I am not using spyder my self at the moment so unlikely to spot this.
At some point a long time ago I did look into addressing this issue on the spyder side spyder-ide/spyder#2451 If anyone have bandwidth to do that it would be great as this is a much cleaner option.
Otherwise happy to merge this once you have converted on the best solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware people was adding modules to our UMR programmatically (no one has reported it to our issue tracker).
Since the code to do that for Spyder 6/Spyder-kernels 3 is too convoluted (from what I can see below), we could add a public API at the shell level (i.e. the object you get with
get_python()
) to make the life of other projects easier.@jenshnielsen, @sldesnoo-Delft, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qcodes adds itselft to the list of packages to exclude.
I had a closer look at the UMR. It checks if the module is in the library path. (
path_is_library
in utils.py). When qcodes is normally installed, i.e. not in "develop mode", then it will not be reloaded by UMR.So, I believe the add_to_spyder_UMR_excludelist function is not really needed. It might be a remainder from a distant past.
@jenshnielsen , @eendebakpt do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sldesnoo-Delft I think this has ever only been a problem with editable installs. As I recall the problem is that when spyder does reload all singletons are destroyed so instruments are lost. I think that when we originally added this qcodes did not see regular releases, so a lot of users were installing from source. This is much less of an issue now so I think it would be fine to deprecate/remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no strong opinion on this, we usually disable the spyder UMR (other packages have issues with automatic reloading as well). We only noticed because the new spyder 6 would not import qcodes.
If we do remove the functionality, I do think it warrants some attention in the release notes (and maybe the documentation?).