@tinyvolt/pie 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,16 +94,19 @@ pie.scalar(3, out='r') # the circle above now has radius 3
94
94
 
95
95
  Common mistake: `center = pie.point(1, 2)` does not give the node the id `center`. It gets an automatic id. Use `pie.point(1, 2, out='center')`.
96
96
 
97
+ `pie.get_node('<id>')` returns the existing node with that id, e.g. `c = pie.get_node('center')`, in any editor on the page. It makes no new node. An unknown id raises an error. It can't be called inside a lifted function.
98
+
97
99
  `fill='<color>'` and `stroke='<color>'` color a node, e.g. `pie.circle(a, r, fill='orange', stroke='#333')`:
98
100
 
99
101
  - A color is any CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`) or `'none'`. A bad color raises an error.
100
102
  - Every node the call makes gets the colors, including extra nodes such as the center point of `ellipse_from_foci`.
101
103
  - A node shows only the colors its render function draws with. A point uses only `fill`, a line only `stroke`. For `partial`'s arrow, `stroke` colors the line and `fill` the head.
102
104
 
103
- There are three system nodes:
105
+ There are five system nodes:
104
106
  - `unit`: a scalar holding the pixels per grid unit (default 50). Changing it changes the grid unit, e.g. `pie.scalar(80, out='unit')`.
105
107
  - `gridOpacity`: a scalar that multiplies the opacity of the grid lines and axes (default 1; 0 hides them), e.g. `pie.scalar(0.5, out='gridOpacity')`.
106
108
  - `canvasColor`: a text holding a CSS color for the canvas background (default `''`: no background), e.g. `pie.text('#111', out='canvasColor')`.
109
+ - `originX`, `originY`: scalars holding where the origin sits, in grid units from the canvas center (default 0; positive is right and up), e.g. `pie.scalar(1, out='originX')`. Every node moves with the origin.
107
110
 
108
111
  Built-in functions:
109
112
 
@@ -131,7 +134,7 @@ These change existing nodes instead of making a new one. They run once, when cal
131
134
 
132
135
  | Call | Does |
133
136
  | --- | --- |
134
- | `pie.clear()` | removes every node and resets the system nodes: `unit` (pixels per grid unit) to 50, `gridOpacity` to 1, `canvasColor` to `''` |
137
+ | `pie.clear()` | removes every node and resets the system nodes: `unit` (pixels per grid unit) to 50, `gridOpacity` to 1, `canvasColor` to `''`, `originX` and `originY` to 0 |
135
138
  | `pie.translate_point_to(p, x, y)` | moves point `p` to (x, y) |
136
139
  | `pie.translate_point_by(p, dx, dy)` | moves point `p` by (dx, dy) |
137
140
  | `pie.translate_scalar_to(s, value)` | sets scalar `s` to `value` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinyvolt/pie",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "A Markdown-based SSG for interactive science explainers. Create a site with: npx @tinyvolt/pie init my-site",
5
5
  "type": "module",
6
6
  "repository": {
Binary file
Binary file
package/public/logo.svg CHANGED
@@ -1,5 +1,5 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 21 64 45" width="256" height="180">
2
- <path d="M32 29 L8 29 A24 24 0 0 0 20 49.78 Z" fill="#41DBC9"/>
3
- <path d="M32 29 L44 49.78 A24 24 0 0 0 56 29 Z" fill="#41DBC9"/>
4
- <path d="M32 34 L20 54.78 A24 24 0 0 0 44 54.78 Z" fill="#0B6B73"/>
2
+ <path d="M32 29 L8 29 A24 24 0 0 0 20 49.78 Z" fill="#b45309"/>
3
+ <path d="M32 29 L44 49.78 A24 24 0 0 0 56 29 Z" fill="#b45309"/>
4
+ <path d="M32 34 L20 54.78 A24 24 0 0 0 44 54.78 Z" fill="#78350f"/>
5
5
  </svg>
package/src/app.css CHANGED
@@ -261,6 +261,8 @@ main .katex-display {
261
261
  .node-canvas {
262
262
  width: 100%;
263
263
  height: 100%;
264
+ /* Drags and pinches move the canvas, not the page. */
265
+ touch-action: none;
264
266
  }
265
267
 
266
268
  .canvas-page-canvas svg {
@@ -2,7 +2,7 @@ import { JSX, createMemo, Show } from 'solid-js';
2
2
  import { MIN_GRID_UNIT } from '../state/NodeStore';
3
3
 
4
4
  interface CenteredGridProps {
5
- /** Canvas size in viewBox units. The origin sits at the center. */
5
+ /** Canvas size in viewBox units. */
6
6
  width: number;
7
7
  height: number;
8
8
  /** Pixels per grid unit. */
@@ -11,6 +11,8 @@ interface CenteredGridProps {
11
11
  gridOpacity?: number;
12
12
  /** Solid fill painted behind the grid. Defaults to transparent (no rect). */
13
13
  backgroundColor?: string;
14
+ /** Position of the origin in the viewBox. Defaults to the center of the canvas. */
15
+ origin?: { x: number; y: number };
14
16
  children: JSX.Element;
15
17
  }
16
18
 
@@ -18,8 +20,8 @@ const GRID_OPACITY = 0.15;
18
20
  const AXIS_OPACITY = 0.4;
19
21
 
20
22
  export function CenteredGrid(props: CenteredGridProps) {
21
- const originX = () => props.width / 2;
22
- const originY = () => props.height / 2;
23
+ const originX = () => props.origin?.x ?? props.width / 2;
24
+ const originY = () => props.origin?.y ?? props.height / 2;
23
25
 
24
26
  // Local (post-transform) extents of the canvas relative to the origin.
25
27
  const extents = createMemo(() => ({
@@ -3,6 +3,7 @@ import { NodeStore, type NodeSignal } from '../state/NodeStore';
3
3
  import { getNodeDefinition } from '../state/Node';
4
4
  import { CenteredGrid } from './CenteredGrid';
5
5
  import { useCanvasResize } from '../hooks/useCanvasResize';
6
+ import { useCanvasGestures } from '../hooks/useCanvasGestures';
6
7
 
7
8
  interface NodeCanvasProps {
8
9
  store: NodeStore;
@@ -11,6 +12,7 @@ interface NodeCanvasProps {
11
12
  export function NodeCanvas(props: NodeCanvasProps): JSX.Element {
12
13
  let svgContainerRef: HTMLDivElement | undefined;
13
14
  useCanvasResize(() => svgContainerRef, props.store);
15
+ useCanvasGestures(() => svgContainerRef, props.store);
14
16
 
15
17
  // Canvas size in grid units: the viewBox maps one unit to `unit` pixels.
16
18
  const viewWidth = () => props.store.canvasBounds().width / props.store.unit();
@@ -52,6 +54,7 @@ export function NodeCanvas(props: NodeCanvasProps): JSX.Element {
52
54
  unit={props.store.unit()}
53
55
  gridOpacity={props.store.gridOpacity()}
54
56
  backgroundColor={props.store.canvasColor()}
57
+ origin={props.store.origin()}
55
58
  >
56
59
  {/* Step 1: Draw non-`Point` nodes first */}
57
60
  <For each={layers().geometry}>{(nodeSignal) => nodeGroup(nodeSignal)}</For>
@@ -40,11 +40,17 @@ function argType(arg: Arg, store: NodeStore): string {
40
40
  }
41
41
 
42
42
  /** The item type and shape of an argument that is an array, before any node is created for it. */
43
- function arrayOf(arg: Arg, store: NodeStore): { itemType: NodeType; shape: number[] } {
43
+ function arrayOf(arg: Arg, store: NodeStore): { itemType: NodeType | 'Mixed'; shape: number[] } {
44
44
  if (Array.isArray(arg)) return { itemType: listItemType(arg, item => argType(item, store)), shape: listShape(arg) };
45
45
  return store.getNodeValue((arg as { id: string }).id) as ArrayNode;
46
46
  }
47
47
 
48
+ /** The types of the items of an argument that is an array, without repeats. */
49
+ function itemTypesOf(arg: Arg, store: NodeStore): string[] {
50
+ if (Array.isArray(arg)) return [...new Set(leaves(arg).map(item => argType(item, store)))];
51
+ return [...new Set((store.getNodeValue((arg as { id: string }).id) as ArrayNode).items.map(item => item.type))];
52
+ }
53
+
48
54
  /**
49
55
  * A list gets one hidden Array node, reused by every call that passes the same list.
50
56
  * Its items follow the nodes they name.
@@ -130,8 +136,10 @@ export async function execute(store: NodeStore, keyword: string, args: Arg[], {
130
136
  if (func.broadcastable === false) throw new Error(`${keyword} does not take arrays`);
131
137
  const array = arrayOf(arg, store);
132
138
  broadcastInputShapes.push(array.shape);
133
- got = `Array of ${array.itemType}`;
134
- if (types.includes(array.itemType)) return;
139
+ // A Mixed array passes when every one of its item types does.
140
+ const itemTypes = array.itemType === 'Mixed' ? itemTypesOf(arg, store) : [array.itemType];
141
+ got = `Array of ${itemTypes.join(', ')}`;
142
+ if (itemTypes.every(type => types.includes(type as NodeType))) return;
135
143
  }
136
144
  if (!types.includes(got as NodeType)) {
137
145
  throw new Error(`${keyword}: expected ${types.join(' or ')} but got ${got} for argument '${param.name}'`);
@@ -10,7 +10,7 @@ import type { Track } from '../animation';
10
10
  * It has no inputs, so it no longer follows the old node's.
11
11
  * With `animate`, returns a track that moves the numbers from their old values to the new ones.
12
12
  */
13
- function replaceNode<N extends AnyNode>(store: NodeStore, node: N, changes: Partial<N>, animate: boolean): Track | undefined {
13
+ export function replaceNode<N extends AnyNode>(store: NodeStore, node: N, changes: Partial<N>, animate: boolean): Track | undefined {
14
14
  const { __graph_deps, ...unchanged } = node;
15
15
  const end = { ...unchanged, ...changes } as AnyNode;
16
16
  if (!animate) {
@@ -0,0 +1,128 @@
1
+ import { batch, onCleanup, onMount } from 'solid-js';
2
+ import { NodeStore } from '../state/NodeStore';
3
+ import { num, scalar } from '../jax';
4
+ import { replaceNode } from '../functions/sideEffects';
5
+
6
+ type Pixel = { x: number; y: number };
7
+
8
+ /** A trackpad pinch with a `deltaY` of 100 zooms by a factor of e. */
9
+ const PINCH_SPEED = 0.01;
10
+ /** Slower than a pinch: a scroll's `deltaY` is larger. */
11
+ const SCROLL_SPEED = 0.002;
12
+
13
+ /**
14
+ * Lets the reader move the canvas with a pointer:
15
+ * - Dragging a point moves it, like `translate_point_to`: it stops following its inputs.
16
+ * - Dragging anywhere else pans the canvas, through `originX` and `originY`.
17
+ * - A pinch, a two-finger trackpad slide or a mouse wheel zooms through `unit`, and moves the origin so the spot
18
+ * under the cursor or fingers stays put.
19
+ */
20
+ export function useCanvasGestures(containerRef: () => HTMLDivElement | undefined, store: NodeStore) {
21
+ // Pointers panning or pinching the canvas.
22
+ const pointers = new Map<number, Pixel>();
23
+ // The pointer dragging a point, and that point's id.
24
+ let drag: { pointerId: number; nodeId: string } | undefined;
25
+
26
+ /** Pixels from the canvas's top left. */
27
+ const toPixel = (e: MouseEvent): Pixel => {
28
+ const rect = containerRef()!.getBoundingClientRect();
29
+ return { x: e.clientX - rect.left, y: e.clientY - rect.top };
30
+ };
31
+
32
+ /** Sets system scalar `id` to `change(its value)`. Skipped if it is no longer a scalar. */
33
+ const changeScalar = (id: string, change: (value: number) => number) => {
34
+ const node = store.getNodeValue(id);
35
+ if (node?.type === 'Scalar') replaceNode(store, node, { value: scalar(change(num(node.value))) }, false);
36
+ };
37
+
38
+ const pan = (dx: number, dy: number) => {
39
+ const unit = store.unit();
40
+ changeScalar('originX', x => x + dx / unit);
41
+ // Pixels go down, grid units go up.
42
+ changeScalar('originY', y => y - dy / unit);
43
+ };
44
+
45
+ const zoomAt = (at: Pixel, factor: number) => {
46
+ const unit = store.unit();
47
+ const next = Math.max(1, unit * factor);
48
+ const { width, height } = store.canvasBounds();
49
+ // The spot `at` is a fixed number of pixels from the center; keep it on the same grid position.
50
+ const shift = 1 / next - 1 / unit;
51
+ changeScalar('unit', () => next);
52
+ changeScalar('originX', x => x + (at.x - width / 2) * shift);
53
+ changeScalar('originY', y => y + (height / 2 - at.y) * shift);
54
+ };
55
+
56
+ const movePoint = (id: string, at: Pixel) => {
57
+ const point = store.getNodeValue(id);
58
+ // Removed or replaced while being dragged.
59
+ if (point?.type !== 'Point') return;
60
+ const unit = store.unit();
61
+ const origin = store.origin();
62
+ replaceNode(store, point, { x: scalar(at.x / unit - origin.x), y: scalar(origin.y - at.y / unit) }, false);
63
+ };
64
+
65
+ /** The pointers' center, and their mean distance from it. */
66
+ const spread = () => {
67
+ const all = [...pointers.values()];
68
+ const x = all.reduce((sum, p) => sum + p.x, 0) / all.length;
69
+ const y = all.reduce((sum, p) => sum + p.y, 0) / all.length;
70
+ const size = all.reduce((sum, p) => sum + Math.hypot(p.x - x, p.y - y), 0) / all.length;
71
+ return { x, y, size };
72
+ };
73
+
74
+ const onPointerDown = (e: PointerEvent) => {
75
+ if (drag) return;
76
+ // Keeps text from being selected while dragging with a mouse.
77
+ e.preventDefault();
78
+ containerRef()!.setPointerCapture(e.pointerId);
79
+ const nodeId = (e.target as Element).closest('[data-node-id]')?.getAttribute('data-node-id');
80
+ if (nodeId && pointers.size === 0 && store.getNodeValue(nodeId)?.type === 'Point') {
81
+ drag = { pointerId: e.pointerId, nodeId };
82
+ } else {
83
+ pointers.set(e.pointerId, toPixel(e));
84
+ }
85
+ };
86
+
87
+ const onPointerMove = (e: PointerEvent) => {
88
+ if (drag?.pointerId === e.pointerId) return movePoint(drag.nodeId, toPixel(e));
89
+ if (!pointers.has(e.pointerId)) return;
90
+ const before = spread();
91
+ pointers.set(e.pointerId, toPixel(e));
92
+ const after = spread();
93
+ batch(() => {
94
+ pan(after.x - before.x, after.y - before.y);
95
+ // One pointer has no spread: it only pans.
96
+ if (before.size > 0) zoomAt(after, after.size / before.size);
97
+ });
98
+ };
99
+
100
+ const onPointerUp = (e: PointerEvent) => {
101
+ if (drag?.pointerId === e.pointerId) drag = undefined;
102
+ pointers.delete(e.pointerId);
103
+ };
104
+
105
+ const onWheel = (e: WheelEvent) => {
106
+ // The browser reports a trackpad pinch as a wheel event with `ctrlKey`, and a scroll as one without.
107
+ e.preventDefault();
108
+ const speed = e.ctrlKey ? PINCH_SPEED : SCROLL_SPEED;
109
+ batch(() => zoomAt(toPixel(e), Math.exp(-e.deltaY * speed)));
110
+ };
111
+
112
+ onMount(() => {
113
+ const container = containerRef()!;
114
+ container.addEventListener('pointerdown', onPointerDown);
115
+ container.addEventListener('pointermove', onPointerMove);
116
+ container.addEventListener('pointerup', onPointerUp);
117
+ container.addEventListener('pointercancel', onPointerUp);
118
+ // Not passive, so `preventDefault` can stop the browser zooming or scrolling the page.
119
+ container.addEventListener('wheel', onWheel, { passive: false });
120
+ onCleanup(() => {
121
+ container.removeEventListener('pointerdown', onPointerDown);
122
+ container.removeEventListener('pointermove', onPointerMove);
123
+ container.removeEventListener('pointerup', onPointerUp);
124
+ container.removeEventListener('pointercancel', onPointerUp);
125
+ container.removeEventListener('wheel', onWheel);
126
+ });
127
+ });
128
+ }
@@ -141,7 +141,8 @@ const PointGradDefinition: NodeDefinition<PointGradNode> = { type: 'PointGrad',
141
141
  /** `items` in row-major order: shape [2, 3] holds row 0's three items, then row 1's. */
142
142
  export interface ArrayNode extends Node {
143
143
  type: 'Array';
144
- itemType: NodeType;
144
+ /** 'Mixed' when the items are not all one type. */
145
+ itemType: NodeType | 'Mixed';
145
146
  shape: number[];
146
147
  items: AnyNode[];
147
148
  }
@@ -26,6 +26,8 @@ export class NodeStore {
26
26
  public gridOpacity!: Accessor<number>;
27
27
  /** Canvas background color, read from the `canvasColor` node. `undefined` when empty: no background. */
28
28
  public canvasColor!: Accessor<string | undefined>;
29
+ /** Where the grid origin sits in the viewBox, read from the `originX` and `originY` nodes. */
30
+ public origin!: Accessor<{ x: number; y: number }>;
29
31
 
30
32
  public nameGenerator: NameGenerator;
31
33
 
@@ -55,6 +57,17 @@ export class NodeStore {
55
57
  const node = this.nodes['canvasColor']?.signal() as TextNode | undefined;
56
58
  return node?.value?.trim() || undefined;
57
59
  });
60
+
61
+ this.origin = createMemo(() => {
62
+ const xNode = this.nodes['originX']?.signal() as ScalarNode | undefined;
63
+ const yNode = this.nodes['originY']?.signal() as ScalarNode | undefined;
64
+ const viewWidth = this.canvasBounds().width / this.unit();
65
+ const viewHeight = this.canvasBounds().height / this.unit();
66
+ // The offset is in grid units from the canvas center. The viewBox is y-down, hence `- y`.
67
+ const x = xNode ? num(xNode.value) : 0;
68
+ const y = yNode ? num(yNode.value) : 0;
69
+ return { x: viewWidth / 2 + x, y: viewHeight / 2 - y };
70
+ });
58
71
  });
59
72
 
60
73
  // untrack: names are generated inside reactive computations, which must not rerun when the checked node changes.
@@ -81,6 +94,18 @@ export class NodeStore {
81
94
  const signal = createMemo(() => ({ id: canvasColorId, type: 'Text', value: '' } as TextNode));
82
95
  this.saveNode(canvasColorId, signal, dispose);
83
96
  });
97
+
98
+ const originXId = 'originX';
99
+ createRoot((dispose) => {
100
+ const signal = createMemo(() => ({ id: originXId, type: 'Scalar', value: scalar(0) } as ScalarNode));
101
+ this.saveNode(originXId, signal, dispose);
102
+ });
103
+
104
+ const originYId = 'originY';
105
+ createRoot((dispose) => {
106
+ const signal = createMemo(() => ({ id: originYId, type: 'Scalar', value: scalar(0) } as ScalarNode));
107
+ this.saveNode(originYId, signal, dispose);
108
+ });
84
109
  }
85
110
 
86
111
  public clearNodes() {
@@ -31,12 +31,10 @@ export function getItem(store: NodeStore, arrayId: string, position: number): Ex
31
31
  return { id: item.id, type: item.type };
32
32
  }
33
33
 
34
- /** The one type all items of a nested list share. `typeOf` gives an item's type. */
35
- export function listItemType(list: Arg[], typeOf: (item: LeafArg) => string): NodeType {
34
+ /** The one type all items of a nested list share, or 'Mixed' when they differ. `typeOf` gives an item's type. */
35
+ export function listItemType(list: Arg[], typeOf: (item: LeafArg) => string): NodeType | 'Mixed' {
36
36
  listShape(list);
37
37
  const types = new Set(leaves(list).map(typeOf));
38
- if (types.size > 1) {
39
- throw new Error(`all items of a list must have the same type, got ${[...types].join(', ')}`);
40
- }
38
+ if (types.size > 1) return 'Mixed';
41
39
  return [...types][0] as NodeType;
42
40
  }
@@ -61,6 +61,7 @@ function inputValue(node: AnyNode | undefined, id: string): InputValue {
61
61
  if (node.type === 'Point') return [num(node.x), num(node.y)];
62
62
  if (node.type === 'Text') return node.value;
63
63
  if (node.type === 'Array') {
64
+ if (node.itemType === 'Mixed') throw new Error(`'${id}' is an Array of mixed types; an Array input must hold one type`);
64
65
  const values = node.items.flatMap(item => inputValue(item, item.id)) as number[];
65
66
  return { shape: node.itemType === 'Point' ? [...node.shape, 2] : node.shape, values };
66
67
  }
@@ -74,6 +74,13 @@ def _node(result):
74
74
  return Text(result.id)
75
75
  return Node(result.id, result.type)
76
76
 
77
+ def get_node(id):
78
+ """The existing node with id `id`, e.g. `a = pie.get_node("A")`. Creates nothing."""
79
+ if not isinstance(id, str):
80
+ raise TypeError(f"pie.get_node: id must be a str, got {type(id).__name__}")
81
+ _check_bridge()
82
+ return _node(run_sync(bridge.get_node(id)))
83
+
77
84
  def _arg(a):
78
85
  if isinstance(a, Node):
79
86
  return {"id": a.id}
@@ -45,7 +45,7 @@ function onMessage(this: Worker, { data }: MessageEvent) {
45
45
  loaded = true;
46
46
  run?.onStatus('running');
47
47
  }
48
- if (data.type === 'call' || data.type === 'item' || data.type === 'lift') {
48
+ if (data.type === 'call' || data.type === 'item' || data.type === 'get_node' || data.type === 'lift') {
49
49
  // The request to answer: this one, or, after a batch, Python's request with the batch's results.
50
50
  let reqId: number = data.reqId;
51
51
  // A reply from before a kill must not reach the new worker.
@@ -65,6 +65,13 @@ function onMessage(this: Worker, { data }: MessageEvent) {
65
65
  }
66
66
  return;
67
67
  }
68
+ if (data.type === 'get_node') {
69
+ const node = store.getNodeValue(data.id);
70
+ if (!node) reply({ error: `pie.get_node: no node with id '${data.id}'` });
71
+ else if (node.type === 'Array') reply({ result: { id: node.id, type: node.type, shape: node.shape, itemType: node.itemType } });
72
+ else reply({ result: { id: node.id, type: node.type } });
73
+ return;
74
+ }
68
75
  if (data.type === 'lift') {
69
76
  try {
70
77
  reply({ result: startLift(store, data.name, data.inputIds, data.kind, data.out, data.fill, data.stroke) });
@@ -22,6 +22,9 @@ const call = (keyword: string, args: unknown[], options: CallOptions) =>
22
22
  /** The node at `position` of an array's items. Creates nothing. */
23
23
  const item = (arrayId: string, position: number) => request({ type: 'item', arrayId, position });
24
24
 
25
+ /** The node with id `id`. Creates nothing. */
26
+ const get_node = (id: string) => request({ type: 'get_node', id });
27
+
25
28
  /** First half of `g(a)` for `g = pie.lift(f, ...)`: the input values and the output id. */
26
29
  const lift = (name: string, inputIds: string[], kind: string, out?: string, fill?: string, stroke?: string) =>
27
30
  request({ type: 'lift', name, inputIds, kind, out, fill, stroke });
@@ -38,7 +41,7 @@ const ready = (async () => {
38
41
  py.setStdout({ batched: (text: string) => postMessage({ type: 'output', text: text + '\n' }) });
39
42
  py.setStderr({ batched: (text: string) => postMessage({ type: 'output', text: text + '\n' }) });
40
43
  py.registerJsModule('bridge', {
41
- call, item, lift, lift_save, batch_done, plot: (png: string) => postMessage({ type: 'plot', png }),
44
+ call, item, get_node, lift, lift_save, batch_done, plot: (png: string) => postMessage({ type: 'plot', png }),
42
45
  });
43
46
  py.FS.writeFile('/home/pyodide/pie.py', PIE_PY);
44
47
  py.FS.writeFile('/home/pyodide/pie_mpl.py', PIE_MPL_PY);