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

Add FigureCanvasWasm.destroy() method so that user can call pyplot.close() method to delete previous divs #55

Merged
merged 6 commits into from
Mar 7, 2024

Conversation

yu0A
Copy link
Contributor

@yu0A yu0A commented Mar 1, 2024

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 18 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@df6c97b). Click here to learn what that means.

Files Patch % Lines
matplotlib_pyodide/browser_backend.py 0.00% 6 Missing ⚠️
matplotlib_pyodide/html5_canvas_backend.py 0.00% 6 Missing ⚠️
matplotlib_pyodide/wasm_backend.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             main     #55   +/-   ##
======================================
  Coverage        ?   0.00%           
======================================
  Files           ?       4           
  Lines           ?     671           
  Branches        ?       0           
======================================
  Hits            ?       0           
  Misses          ?     671           
  Partials        ?       0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

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

Thanks @yu0A for working on this!

Please add some tests so we can make sure this works as expected. I think you should test that the intended HTML elements are deleted, that the behavior is idempotent (calling show and destroy multiple times does not break matplotlib), and that it is compatible with pyodideMplTarget.

This very simple test would be a good starting point to take a look.

Also, please

  • update the PR title to be a bit more descriptive, we can search for it later.
  • update the CHANGELOG.md

matplotlib_pyodide/browser_backend.py Show resolved Hide resolved
matplotlib_pyodide/browser_backend.py Show resolved Hide resolved
@yu0A yu0A changed the title fix bug #49 Add FigureCanvasWasm.destroy() method so that user can call pyplot.close() method to delete previous divs Mar 4, 2024
Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

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

Thanks. It seems like CI was failing because of outdated package versions in CI. I updated it in #56, so please merge the main branch in your PR and see if it works.

tests/test_matplotlib.py Show resolved Hide resolved
Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

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

Thanks!

@ryanking13 ryanking13 merged commit ff8cccf into pyodide:main Mar 7, 2024
3 checks passed
@ryanking13
Copy link
Member

Released 0.2.2 including this.

@hoodmane
Copy link
Member

hoodmane commented Mar 7, 2024

Thanks @yu0A!

@yu0A
Copy link
Contributor Author

yu0A commented Mar 8, 2024

Thanks @yu0A!

You're welcome.

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.

4 participants