Skip to content

ENH: Make Qt default browser, add scraper - #9960

Merged
larsoner merged 52 commits into
mne-tools:mainfrom
larsoner:pg_scraper
Feb 17, 2022
Merged

larsoner merged 52 commits into
mne-tools:mainfrom
larsoner:pg_scraper

Conversation

@larsoner

@larsoner larsoner commented Nov 4, 2021

Copy link
Copy Markdown
Member

Let's see how it works. I think it won't work well because of mne-tools/mne-qt-browser#19, but otherwise should be functional.

@larsoner

larsoner commented Nov 4, 2021

Copy link
Copy Markdown
Member Author

On main:

On this PR:

so it works, except for (I think) mne-tools/mne-qt-browser#19. Leaving this as draft and I'll try running it again once mne-qt-browser is fixed. Or we can close if we don't want it to be our default scraped view.

Comment thread mne/viz/_scraper.py Resolved
@larsoner

Copy link
Copy Markdown
Member Author

@marsipu feel free to push directly here, you can even install your branch of mne-qt-browser for testing purposes to CircleCI in this PR if you want. Please push with [skip azp] [skip actions] in your commit message, though, so that only CircleCI bothers to run for now

Comment thread tools/circleci_dependencies.sh Resolved
Comment thread mne/viz/_scraper.py Resolved
@larsoner

Copy link
Copy Markdown
Member Author

I found a bug, about to push...

@larsoner

Copy link
Copy Markdown
Member Author

Okay things build well locally for me now @marsipu, I think I'm done pushing for a bit. Feel free to push if it doesn't work for you!

I'll leave this as WIP until we finalize the threading PR and hopefully cut a new release of mne-qt-browser so that we can just pip install the stable version here

@marsipu

marsipu commented Nov 29, 2021

Copy link
Copy Markdown
Member

I had some little fixes but when I try to push to your fork, I get Permission to larsoner/mne-python.git denied to marsipu.
What am I doing wrong?

@marsipu

marsipu commented Nov 29, 2021

Copy link
Copy Markdown
Member

I also noticed that the scraped images were still showing the progressbar, so I added QTest.qWait(100) to give the gui some time to update

@larsoner

Copy link
Copy Markdown
Member Author

You should have permission now if you accept my collaboration invite

@larsoner

Copy link
Copy Markdown
Member Author

I also noticed that the scraped images were still showing the progressbar, so I added QTest.qWait(100) to give the gui some time to update

Looks like adding one inst.processEvents() is enough to fix it locally at least made the build hang, so I pushed one with more. I like the direct processEvents approach rather than the QTest.qWait one, since I guess during the wait time it might or might not process events? In any case, it looks like CircleCI is happy with the latest version, and locally the windows appear, get scraped, and close, which is nice and mimics the behavior of matplotlib and PyVista. The CircleCI output looks okay, too:

Comment thread tools/circleci_dependencies.sh Outdated
echo "Installing doc build dependencies"
python -m pip uninstall -y pydata-sphinx-theme
python -m pip install --upgrade --progress-bar off --only-binary matplotlib -r requirements.txt -r requirements_testing.txt -r requirements_doc.txt
python -m pip install --upgrade --progress-bar off --only-binary matplotlib https://github.com/marsipu/mne-qt-browser/zipball/fix_threading -r requirements.txt -r requirements_testing.txt -r requirements_doc.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder: Needs to be reverted before merging. This PR should be merged after mne-qt-browser was bumped to the next version (0.1.7)

Suggested change
python -m pip install --upgrade --progress-bar off --only-binary matplotlib https://github.com/marsipu/mne-qt-browser/zipball/fix_threading -r requirements.txt -r requirements_testing.txt -r requirements_doc.txt
python -m pip install --upgrade --progress-bar off --only-binary matplotlib mne-qt-browser -r requirements.txt -r requirements_testing.txt -r requirements_doc.txt

@marsipu

marsipu commented Nov 30, 2021 •

Copy link
Copy Markdown
Member

Should the scraper now also work for the other tutorials? Because in CircleCi it's not (e.g. for "Built-in plotting methods for Raw objects/40_visualize_raw") while locally it is working (with PATTERN=40_visualize_raw):

CircleCI

grafik

Local build

grafik

@drammock

Copy link
Copy Markdown
Member

Should the scraper now also work for the other tutorials?

Circle CI only builds tutorials that have changed. The are no changes in that file

@marsipu

marsipu commented Nov 30, 2021

Copy link
Copy Markdown
Member

Thanks @drammock , good to know

@larsoner larsoner added this to the 1.0 milestone Dec 17, 2021
@larsoner

Copy link
Copy Markdown
Member Author

We forgot to decide at the dev meeting if we're going to make mne-qt-browser the default for MNE 1.0 :(

If we do that, we might want to resurrect this PR, too. So I'm leaving this marked as 1.0 just so we remember to discuss.

@agramfort any opinion?

@marsipu marsipu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjust for backend-renaming

Comment thread .circleci/config.yml Resolved
Comment thread doc/conf.py Resolved
@larsoner

Copy link
Copy Markdown
Member Author

@marsipu do you want to try changing the default from matplotlib to qt here? I think we want some behavior where by default it tries to use 'qt' (unless the user has MNE_BROWSE_BACKEND=matplotlib set) and falls back to matplotlib if not available

@marsipu

marsipu commented Feb 17, 2022 •

Copy link
Copy Markdown
Member

What does "[circle full]" mean? Is it more than default?

@larsoner

Copy link
Copy Markdown
Member Author

I should update the docs to say that by default for PRs Circle will only render things that change, but for your question:

# Tagging a commit with:
# - [circle front] will build the front page and perform test-doc
# - [circle full] will build everything
# - [circle linkcheck] will run our linkcheck
# - [circle deploy] on a main or maint/* commit will try to immediately build
# and deploy docs rather than waiting for the nightly build

@larsoner

Copy link
Copy Markdown
Member Author

This PR is exposing all sorts of fun stuff! sphinx-gallery/sphinx-gallery#916

@larsoner

Copy link
Copy Markdown
Member Author

All green except CircleCI. I've pushed another commit to see if it comes back green. If it passes I think we should keep it, if it fails, depending on how clear the error(s) are, @marsipu we can make a call on whether to continue working on getting the build to work, or call it quits for now and set the backend to matplotlib for now. I feel like it must be close to working, though, so it's tough to stop!

@marsipu

marsipu commented Feb 17, 2022

Copy link
Copy Markdown
Member

Yeah me too, lets fix this 👍

@marsipu

marsipu commented Feb 17, 2022

Copy link
Copy Markdown
Member

When do you think is the best time to do the 0.2.0-release for mne-qt-browser?

@larsoner

Copy link
Copy Markdown
Member Author

You can go ahead and do it now. If we need to push out 0.2.1 almost immediately it's easy enough. Version numbers are cheap :)

@larsoner

Copy link
Copy Markdown
Member Author

I'm going to run a full doc build locally to save CircleCI some headaches

@larsoner

Copy link
Copy Markdown
Member Author

lasso_event is not an actually supported matplotlib event, so I pushed a fix to get around that, along with some more tutorial fixes

* upstream/main:
  MAINT: Update NIRx tests (mne-tools#10357)
  ENH: add Shift_JIS mu in _read_edf_header (mne-tools#10356)
  API: Return Path in data_path (mne-tools#10348)
@larsoner

Copy link
Copy Markdown
Member Author

This was not a circle full run, still working on tutorials locally. Hopefully just another hour or two, then I can push [circle full] and we can hope it works!

@larsoner

Copy link
Copy Markdown
Member Author

All green locally, let's see if CircleCI agrees!

Screenshot from 2022-02-17 12-19-58

@larsoner

Copy link
Copy Markdown
Member Author

So close, it only had a few examples left!

generating gallery for auto_examples/datasets... [ 80%] opm_data.py
4672.6 s : 3.02 GB    
ERROR:mprof:Program resulted with a non-zero exit code: -9
Makefile:55: recipe for target 'html_dev-memory' failed

It suggests that the pyqtgraph windows are for some reason not being garbage collected properly, probably due to some circular refs that gc is not able to resolve :(

For now I'm going to set CircleCI to use matplotlib, but I'll see if I can figure out the memory leak somehow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants