Skip to content

Commit

Permalink
Fix worker to patch matplotlib after runtime installs (#261)
Browse files Browse the repository at this point in the history
* Fix worker to patch matplotlib after runtime installs

* Update CHANGELOG.md
  • Loading branch information
whitphx committed Sep 15, 2022
1 parent a86df8c commit 3ff0e68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### `@stlite/stlite-kernel`

#### Changed

- Patch the Matplotlib backend after installing it at runtime, [#261](https://github.com/whitphx/stlite/pull/261).

## [0.6.0] - 2022-09-01

### `@stlite/stlite-kernel`
Expand Down
7 changes: 7 additions & 0 deletions packages/stlite-kernel/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,13 @@ self.onmessage = async (event: MessageEvent<InMessage>): Promise<void> => {
console.debug("Install the requirements:", requirements);
micropip.install
.callKwargs(requirements, { keep_going: true })
.then(() => {
if (requirements.includes("matplotlib")) {
return pyodide.runPythonAsync(`
bootstrap._fix_matplotlib_crash()
`);
}
})
.then(() => {
console.debug("Successfully installed");
messagePort.postMessage({
Expand Down

0 comments on commit 3ff0e68

Please sign in to comment.