@cfasim-ui/pyodide 0.1.5 → 0.1.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfasim-ui/pyodide",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Pyodide (Python-in-browser) integration for cfasim-ui",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "pyodide": "^0.29.3",
24
- "@cfasim-ui/shared": "0.1.5"
24
+ "@cfasim-ui/shared": "0.1.7"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vue": "^3.5.0"
@@ -53,7 +53,7 @@ async function installAllWheels() {
53
53
  (f) => `${self.location.origin}${baseUrl}${f}`,
54
54
  );
55
55
  if (urls.length > 0) {
56
- await micropip.install(urls, { deps: false });
56
+ await micropip.install(urls);
57
57
  }
58
58
  }
59
59
 
package/src/vitePlugin.ts CHANGED
@@ -6,13 +6,16 @@ import type { Plugin } from "vite";
6
6
  interface CfasimPyodideOptions {
7
7
  /** Path to the Python model directory (default: "model") */
8
8
  model?: string;
9
- /** Additional local package directories to build as wheels */
10
- deps?: string[];
9
+ /** PyPI packages to download at build time and serve locally */
10
+ pypiDeps?: string[];
11
11
  }
12
12
 
13
13
  /**
14
14
  * Vite plugin that builds a Python wheel from a local model directory
15
15
  * and generates wheels.json in the public directory.
16
+ *
17
+ * Use `pypiDeps` to prebuild PyPI packages (like cfasim-model) as local
18
+ * wheels for faster browser runtime — avoids PyPI round-trips on page load.
16
19
  */
17
20
  export function cfasimPyodide(options?: CfasimPyodideOptions): Plugin {
18
21
  const modelDir = options?.model ?? "model";
@@ -20,11 +23,11 @@ export function cfasimPyodide(options?: CfasimPyodideOptions): Plugin {
20
23
  function build(root: string) {
21
24
  const publicDir = resolve(root, "public");
22
25
  mkdirSync(publicDir, { recursive: true });
23
- for (const dep of options?.deps ?? []) {
24
- execSync(`uv build ${dep} --wheel --out-dir public`, {
25
- cwd: root,
26
- stdio: "pipe",
27
- });
26
+ for (const dep of options?.pypiDeps ?? []) {
27
+ execSync(
28
+ `uv run pip download ${dep} --dest public --no-deps --python-version 3.12 --platform any`,
29
+ { cwd: root, stdio: "pipe" },
30
+ );
28
31
  }
29
32
  execSync(`uv build ${modelDir} --wheel --out-dir public`, {
30
33
  cwd: root,