@cfasim-ui/pyodide 0.3.7 → 0.3.9

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.3.7",
3
+ "version": "0.3.9",
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.3.7"
24
+ "@cfasim-ui/shared": "0.3.9"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vue": "^3.5.0"
package/src/vitePlugin.js CHANGED
@@ -6,6 +6,8 @@ import { resolve } from "node:path";
6
6
  * @typedef {object} CfasimPyodideOptions
7
7
  * @property {string} [model] Path to the Python model directory (default: "model")
8
8
  * @property {string[]} [pypiDeps] PyPI packages to download at build time and serve locally
9
+ * @property {string} [pipCommand] Command used to invoke pip for downloading `pypiDeps` (default: "uvx pip"). Override with e.g. "pip" or "uv run pip".
10
+ * @property {string} [pythonVersion] Python version passed to pip's --python-version flag when downloading `pypiDeps` (default: "3.12"). Should match the Python shipped by your Pyodide runtime.
9
11
  */
10
12
 
11
13
  /**
@@ -20,13 +22,15 @@ import { resolve } from "node:path";
20
22
  */
21
23
  export function cfasimPyodide(options) {
22
24
  const modelDir = options?.model ?? "model";
25
+ const pipCommand = options?.pipCommand ?? "uvx pip";
26
+ const pythonVersion = options?.pythonVersion ?? "3.12";
23
27
 
24
28
  function build(root) {
25
29
  const publicDir = resolve(root, "public");
26
30
  mkdirSync(publicDir, { recursive: true });
27
31
  for (const dep of options?.pypiDeps ?? []) {
28
32
  execSync(
29
- `uv run pip download ${dep} --dest public --no-deps --python-version 3.12 --platform any`,
33
+ `${pipCommand} download ${dep} --dest public --no-deps --python-version ${pythonVersion} --platform any`,
30
34
  { cwd: root, stdio: "pipe" },
31
35
  );
32
36
  }