pyodide 0.20.0 → 0.20.1-alpha.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.
- package/package.json +31 -9
- package/pyodide.ts +31 -39
- package/api.ts +0 -495
- package/compat.ts +0 -146
- package/error_handling.gen.ts +0 -335
- package/index.d.ts +0 -1
- package/index.test-d.ts +0 -167
- package/load-package.ts +0 -414
- package/module.ts +0 -117
- package/pyproxy.gen.ts +0 -1507
- package/rollup.config.js +0 -43
- package/test/conftest.js +0 -7
- package/test/filesystem.test.js +0 -12
- package/test/module.test.js +0 -10
- package/test/pyodide.test.mjs +0 -26
- package/tsconfig.json +0 -15
package/rollup.config.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
2
|
-
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
3
|
-
import { terser } from "rollup-plugin-terser";
|
|
4
|
-
import ts from "rollup-plugin-ts";
|
|
5
|
-
|
|
6
|
-
function config({ input, format, minify, ext }) {
|
|
7
|
-
const dir = `build/`;
|
|
8
|
-
// const minifierSuffix = minify ? ".min" : "";
|
|
9
|
-
const minifierSuffix = "";
|
|
10
|
-
return {
|
|
11
|
-
input: `./src/js/${input}.ts`,
|
|
12
|
-
output: {
|
|
13
|
-
name: "loadPyodide",
|
|
14
|
-
file: `${dir}/pyodide${minifierSuffix}.${ext}`,
|
|
15
|
-
format,
|
|
16
|
-
sourcemap: true,
|
|
17
|
-
},
|
|
18
|
-
external: ["path", "fs/promises", "node-fetch", "vm"],
|
|
19
|
-
plugins: [
|
|
20
|
-
commonjs(),
|
|
21
|
-
ts({
|
|
22
|
-
tsconfig: "src/js/tsconfig.json",
|
|
23
|
-
}),
|
|
24
|
-
// The nodeResolve plugin allows us to import packages from node_modules.
|
|
25
|
-
// We need to include node-only packages in `external` to ensure they
|
|
26
|
-
// aren't bundled for use in browser.
|
|
27
|
-
nodeResolve(),
|
|
28
|
-
minify
|
|
29
|
-
? terser({
|
|
30
|
-
compress: true,
|
|
31
|
-
mangle: false,
|
|
32
|
-
})
|
|
33
|
-
: undefined,
|
|
34
|
-
].filter(Boolean),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default [
|
|
39
|
-
// { input: "pyodide", format: "esm", minify: false, ext: "mjs" },
|
|
40
|
-
{ input: "pyodide", format: "esm", minify: true, ext: "mjs" },
|
|
41
|
-
// { input: "pyodide", format: "umd", minify: false },
|
|
42
|
-
{ input: "pyodide.umd", format: "umd", minify: true, ext: "js" },
|
|
43
|
-
].map(config);
|
package/test/conftest.js
DELETED
package/test/filesystem.test.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
|
|
3
|
-
// for a persistence-related browser test see /src/tests/test_filesystem.py
|
|
4
|
-
|
|
5
|
-
describe("FS", () => {
|
|
6
|
-
const exists = () => {
|
|
7
|
-
return pyodide.runPython("import os; os.path.exists('/tmp/js-test')");
|
|
8
|
-
};
|
|
9
|
-
it("no dir", async () => assert.strictEqual(exists(), false));
|
|
10
|
-
it("mkdir", async () => pyodide.FS.mkdir("/tmp/js-test"));
|
|
11
|
-
it("made dir", async () => assert.strictEqual(exists(), true));
|
|
12
|
-
});
|
package/test/module.test.js
DELETED
package/test/pyodide.test.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
import { loadPyodide } from "../pyodide.js";
|
|
3
|
-
|
|
4
|
-
import fetch from "node-fetch";
|
|
5
|
-
|
|
6
|
-
describe("Pyodide", () => {
|
|
7
|
-
it("runPython", async () => {
|
|
8
|
-
let res = pyodide.runPython("1+1");
|
|
9
|
-
assert.equal(res, 2);
|
|
10
|
-
});
|
|
11
|
-
it("loadPackage", async () => {
|
|
12
|
-
await pyodide.loadPackage(["micropip"]);
|
|
13
|
-
});
|
|
14
|
-
it("micropip.install", async () => {
|
|
15
|
-
// TODO: micropip currently requires a globally defined fetch function
|
|
16
|
-
global.fetch = fetch;
|
|
17
|
-
await pyodide.runPythonAsync(
|
|
18
|
-
'import micropip; await micropip.install("snowballstemmer")'
|
|
19
|
-
);
|
|
20
|
-
let res = pyodide.runPython(`
|
|
21
|
-
import snowballstemmer
|
|
22
|
-
len(snowballstemmer.stemmer('english').stemWords(['A', 'node', 'test']))
|
|
23
|
-
`);
|
|
24
|
-
assert.equal(res, 3);
|
|
25
|
-
});
|
|
26
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"lib": ["ES2021", "DOM"],
|
|
6
|
-
"outDir": "../../build",
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"target": "ES6",
|
|
9
|
-
"module": "ES2020",
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"noImplicitAny": true
|
|
12
|
-
},
|
|
13
|
-
"include": ["*.ts"],
|
|
14
|
-
"exclude": ["rollup.config.js", "*test*"]
|
|
15
|
-
}
|