Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyodide

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyodide - npm Package Compare versions

Comparing version 0.19.0 to 0.20.0-alpha.1

api.ts

40

index.test-d.ts
import { expectType, expectAssignable } from "tsd";
import {
loadPyodide,
Py2JsResult,
PyProxy,

@@ -17,9 +16,8 @@ PyProxyWithLength,

TypedArray,
} from "../../build/pyodide";
} from "./pyodide";
async function main() {
let pyodide = await loadPyodide({ indexURL: "blah" });
expectType<Promise<typeof pyodide>>(
loadPyodide({ indexURL: "blah", fullStdLib: true })
);
let pyodide = await loadPyodide();
expectType<Promise<typeof pyodide>>(loadPyodide({ indexURL: "blah" }));
expectType<Promise<typeof pyodide>>(loadPyodide({ fullStdLib: true }));

@@ -38,3 +36,3 @@ expectType<Promise<typeof pyodide>>(

let x: Py2JsResult;
let x: any;
expectType<boolean>(pyodide.isPyProxy(x));

@@ -44,3 +42,3 @@ if (pyodide.isPyProxy(x)) {

} else {
expectType<number | string | boolean | bigint | undefined>(x);
expectType<any>(x);
}

@@ -50,4 +48,6 @@

expectType<Py2JsResult>(pyodide.runPython("1+1"));
expectType<Py2JsResult>(pyodide.runPython("1+1", px));
expectType<any>(pyodide.runPython("1+1"));
expectType<any>(pyodide.runPython("1+1", { globals: px }));
expectType<Promise<any>>(pyodide.runPythonAsync("1+1"));
expectType<Promise<any>>(pyodide.runPythonAsync("1+1", { globals: px }));

@@ -87,6 +87,6 @@ expectType<Promise<void>>(pyodide.loadPackagesFromImports("import some_pkg"));

pyodide.setInterruptBuffer(new Int32Array(1));
expectType<PyProxy>(pyodide.toPy({}));
expectType<any>(pyodide.toPy({}));
expectType<string>(pyodide.version);
expectType<Py2JsResult>(px.x);
expectType<any>(px.x);
expectType<PyProxy>(px.copy());

@@ -106,3 +106,3 @@ expectType<void>(px.destroy("blah"));

expectType<PyProxyWithGet>(px);
expectType<(x: any) => Py2JsResult>(px.get);
expectType<(x: any) => any>(px.get);
}

@@ -127,3 +127,3 @@

expectType<PyProxyAwaitable>(px);
expectType<Py2JsResult>(await px);
expectType<any>(await px);
}

@@ -151,4 +151,4 @@

expectType<PyProxyCallable>(px);
expectType<Py2JsResult>(px(1, 2, 3));
expectAssignable<(...args: any[]) => Py2JsResult>(px);
expectType<any>(px(1, 2, 3));
expectAssignable<(...args: any[]) => any>(px);
}

@@ -159,6 +159,6 @@

for (let x of px) {
expectType<Py2JsResult>(x);
expectType<any>(x);
}
let it = px[Symbol.iterator]();
expectAssignable<{ done?: Py2JsResult; value: Py2JsResult }>(it.next());
expectAssignable<{ done?: any; value: any }>(it.next());
}

@@ -168,5 +168,5 @@

expectType<PyProxyIterator>(px);
expectAssignable<{ done?: Py2JsResult; value: Py2JsResult }>(px.next());
expectAssignable<{ done?: Py2JsResult; value: Py2JsResult }>(px.next(22));
expectAssignable<{ done?: any; value: any }>(px.next());
expectAssignable<{ done?: any; value: any }>(px.next(22));
}
}
{
"name": "pyodide",
"version": "0.19.0",
"version": "0.20.0-alpha.1",
"description": "The Pyodide JavaScript package",

@@ -19,18 +19,25 @@ "keywords": [

"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.3",
"@types/emscripten": "^1.39.5",
"@types/node-fetch": "^3.0.3",
"error-stack-parser": "^2.0.6",
"mocha": "^9.0.2",
"prettier": "^2.2.1",
"terser": "^5.7.0",
"rollup": "^2.48.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-ts": "^2.0.5",
"terser": "^5.7.0",
"ts-node": "^10.4.0",
"tsd": "^0.15.1",
"typescript": "^4.2.4",
"mocha": "^9.0.2",
"@types/emscripten": "^1.39.5"
"typedoc": "^0.22.11"
},
"type": "module",
"scripts": {
"test": "mocha"
"test": "mocha --loader node_modules/ts-node/dist/esm.js"
},
"mocha": {
"timeout": 30000,
"file": "./test/conftest.js"
"file": "./test/conftest.mjs"
},

@@ -37,0 +44,0 @@ "tsd": {

@@ -0,4 +1,7 @@

import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import ts from "rollup-plugin-ts";
function config({ input, format, minify, ext = "js" }) {
function config({ input, format, minify, ext }) {
const dir = `build/`;

@@ -8,10 +11,19 @@ // const minifierSuffix = minify ? ".min" : "";

return {
input: `./src/js/${input}.js`,
input: `./src/js/${input}.ts`,
output: {
name: "loadPyodide",
file: `${dir}/${input}${minifierSuffix}.${ext}`,
file: `${dir}/pyodide${minifierSuffix}.${ext}`,
format,
sourcemap: true,
},
external: ["path", "fs/promises", "node-fetch", "vm"],
plugins: [
commonjs(),
ts({
tsconfig: "src/js/tsconfig.json",
}),
// The nodeResolve plugin allows us to import packages from node_modules.
// We need to include node-only packages in `external` to ensure they
// aren't bundled for use in browser.
nodeResolve(),
minify

@@ -31,3 +43,3 @@ ? terser({

// { input: "pyodide", format: "umd", minify: false },
{ input: "pyodide", format: "umd", minify: true },
{ input: "pyodide.umd", format: "umd", minify: true, ext: "js" },
].map(config);

@@ -6,3 +6,3 @@ import { loadPyodide } from "../pyodide.js";

before(async () => {
globalThis.pyodide = await loadPyodide({ indexURL: "../../build/" });
globalThis.pyodide = await loadPyodide();
});
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"lib": ["ES2018", "DOM"],
"lib": ["ES2021", "DOM"],
"outDir": "../../build",
"rootDir": "."
"esModuleInterop": true,
"target": "ES6",
"module": "ES2020",
"moduleResolution": "node",
"noImplicitAny": true
},
"include": ["./*.js"],
"exclude": ["rollup.config.js"]
"include": ["*.ts"],
"exclude": ["rollup.config.js", "*test*"]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc