pyodide 0.20.1-alpha.2 → 0.21.0-alpha.3

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/console.html CHANGED
@@ -15,9 +15,56 @@
15
15
  --size: 1.5;
16
16
  --color: rgba(255, 255, 255, 0.8);
17
17
  }
18
+ .noblink {
19
+ --animation: terminal-none;
20
+ }
21
+ body {
22
+ background-color: black;
23
+ }
24
+ #jquery-terminal-logo {
25
+ color: white;
26
+ border-color: white;
27
+ position: absolute;
28
+ top: 7px;
29
+ right: 18px;
30
+ z-index: 2;
31
+ }
32
+ #jquery-terminal-logo a {
33
+ color: gray;
34
+ text-decoration: none;
35
+ font-size: 0.7em;
36
+ }
37
+ #loading {
38
+ display: inline-block;
39
+ width: 50px;
40
+ height: 50px;
41
+ position: fixed;
42
+ top: 50%;
43
+ left: 50%;
44
+ border: 3px solid rgba(172, 237, 255, 0.5);
45
+ border-radius: 50%;
46
+ border-top-color: #fff;
47
+ animation: spin 1s ease-in-out infinite;
48
+ -webkit-animation: spin 1s ease-in-out infinite;
49
+ }
50
+
51
+ @keyframes spin {
52
+ to {
53
+ -webkit-transform: rotate(360deg);
54
+ }
55
+ }
56
+ @-webkit-keyframes spin {
57
+ to {
58
+ -webkit-transform: rotate(360deg);
59
+ }
60
+ }
18
61
  </style>
19
62
  </head>
20
63
  <body>
64
+ <div id="jquery-terminal-logo">
65
+ <a href="https://terminal.jcubic.pl/">jQuery Terminal</a>
66
+ </div>
67
+ <div id="loading"></div>
21
68
  <script>
22
69
  "use strict";
23
70
  function sleep(s) {
@@ -25,12 +72,19 @@
25
72
  }
26
73
 
27
74
  async function main() {
28
- globalThis.pyodide = await loadPyodide();
75
+ let term;
76
+ globalThis.pyodide = await loadPyodide({
77
+ stdin: () => {
78
+ let result = prompt();
79
+ echo(result);
80
+ return result;
81
+ },
82
+ });
29
83
  let namespace = pyodide.globals.get("dict")();
30
84
  pyodide.runPython(
31
85
  `
32
86
  import sys
33
- from pyodide import to_js
87
+ from pyodide.ffi import to_js
34
88
  from pyodide.console import PyodideConsole, repr_shorten, BANNER
35
89
  import __main__
36
90
  BANNER = "Welcome to the Pyodide terminal emulator 🐍\\n" + BANNER
@@ -51,6 +105,11 @@
51
105
  let await_fut = namespace.get("await_fut");
52
106
  let pyconsole = namespace.get("pyconsole");
53
107
  let clear_console = namespace.get("clear_console");
108
+ const echo = (msg, ...opts) =>
109
+ term.echo(
110
+ msg.replace("]]", "&rsqb;&rsqb;").replace("[[", "&lsqb;&lsqb;"),
111
+ ...opts
112
+ );
54
113
  namespace.destroy();
55
114
 
56
115
  let ps1 = ">>> ",
@@ -91,9 +150,9 @@
91
150
  try {
92
151
  let [value] = await wrapped;
93
152
  if (value !== undefined) {
94
- term.echo(
153
+ echo(
95
154
  repr_shorten.callKwargs(value, {
96
- separator: "\n[[;orange;]<long output truncated>]\n",
155
+ separator: "\n<long output truncated>\n",
97
156
  })
98
157
  );
99
158
  }
@@ -117,7 +176,7 @@
117
176
  unlock();
118
177
  }
119
178
 
120
- let term = $("body").terminal(interpreter, {
179
+ term = $("body").terminal(interpreter, {
121
180
  greetings: banner,
122
181
  prompt: ps1,
123
182
  completionEscape: false,
@@ -128,7 +187,7 @@
128
187
  "CTRL+C": async function (event, original) {
129
188
  clear_console();
130
189
  term.enter();
131
- term.echo("KeyboardInterrupt");
190
+ echo("KeyboardInterrupt");
132
191
  term.set_command("");
133
192
  term.set_prompt(ps1);
134
193
  },
@@ -144,7 +203,7 @@
144
203
  },
145
204
  });
146
205
  window.term = term;
147
- pyconsole.stdout_callback = (s) => term.echo(s, { newline: false });
206
+ pyconsole.stdout_callback = (s) => echo(s, { newline: false });
148
207
  pyconsole.stderr_callback = (s) => {
149
208
  term.error(s.trimEnd());
150
209
  };
@@ -161,6 +220,11 @@
161
220
  await sleep(15);
162
221
  term.pause();
163
222
  };
223
+
224
+ const searchParams = new URLSearchParams(window.location.search);
225
+ if (searchParams.has("noblink")) {
226
+ $(".cmd-cursor").addClass("noblink");
227
+ }
164
228
  }
165
229
  window.console_ready = main();
166
230
  </script>
package/distutils.tar CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyodide",
3
- "version": "0.20.1-alpha.2",
3
+ "version": "0.21.0-alpha.3",
4
4
  "description": "The Pyodide JavaScript package",
5
5
  "keywords": [
6
6
  "python",
@@ -25,18 +25,25 @@
25
25
  "@types/node": "^17.0.25",
26
26
  "@types/node-fetch": "^2.6.1",
27
27
  "@types/ws": "^8.5.3",
28
+ "chai": "^4.3.6",
29
+ "chai-as-promised": "^7.1.1",
30
+ "cross-env": "^7.0.3",
28
31
  "dts-bundle-generator": "^6.7.0",
29
- "error-stack-parser": "^2.0.6",
32
+ "error-stack-parser": "^2.1.4",
33
+ "express": "^4.17.3",
30
34
  "mocha": "^9.0.2",
35
+ "npm-run-all": "^4.1.5",
36
+ "nyc": "^15.1.0",
31
37
  "prettier": "^2.2.1",
38
+ "puppeteer": "^13.6.0",
32
39
  "rollup": "^2.48.0",
33
40
  "rollup-plugin-terser": "^7.0.2",
34
41
  "rollup-plugin-ts": "^2.0.5",
35
42
  "terser": "^5.7.0",
36
43
  "ts-mocha": "^9.0.2",
37
44
  "tsd": "^0.15.1",
38
- "typedoc": "^0.22.11",
39
- "typescript": "^4.2.4"
45
+ "typedoc": "^0.22.15",
46
+ "typescript": "^4.6.4"
40
47
  },
41
48
  "main": "pyodide.js",
42
49
  "exports": {
@@ -46,25 +53,69 @@
46
53
  },
47
54
  "./pyodide.mjs": "./pyodide.mjs",
48
55
  "./pyodide.js": "./pyodide.js",
49
- "./package.json": "./package.json"
56
+ "./package.json": "./package.json",
57
+ "./repodata.json": "./repodata.json"
50
58
  },
51
59
  "files": [
52
60
  "pyodide*",
53
- "packages.json",
61
+ "repodata.json",
54
62
  "distutils.tar",
55
63
  "console.html"
56
64
  ],
65
+ "browser": {
66
+ "child_process": false,
67
+ "crypto": false,
68
+ "fs": false,
69
+ "fs/promises": false,
70
+ "path": false,
71
+ "vm": false,
72
+ "ws": false
73
+ },
57
74
  "scripts": {
58
- "test": "ts-mocha -p tsconfig.test.json test/**/*.test.ts"
75
+ "test": "npm-run-all test:*",
76
+ "test:unit": "cross-env TEST_NODE=1 ts-mocha -p tsconfig.test.json test/unit/**/*.test.ts",
77
+ "test:node": "cross-env TEST_NODE=1 mocha test/integration/**/*.test.js",
78
+ "test:browser": "mocha test/integration/**/*.test.js",
79
+ "coverage": "cross-env TEST_NODE=1 npm-run-all coverage:*",
80
+ "coverage:build": "nyc npm run test:node"
59
81
  },
60
82
  "mocha": {
83
+ "bail": false,
61
84
  "timeout": 30000,
62
- "file": "test/conftest.ts"
85
+ "full-trace": true,
86
+ "inline-diffs": true,
87
+ "check-leaks": false,
88
+ "global": [
89
+ "pyodide",
90
+ "page",
91
+ "chai"
92
+ ],
93
+ "file": [
94
+ "test/conftest.js"
95
+ ]
96
+ },
97
+ "nyc": {
98
+ "reporter": [
99
+ "html",
100
+ "text-summary"
101
+ ],
102
+ "include": [
103
+ "*.ts"
104
+ ],
105
+ "all": true,
106
+ "clean": true,
107
+ "cache": false,
108
+ "instrument": false,
109
+ "checkCoverage": true,
110
+ "statements": 95,
111
+ "functions": 95,
112
+ "branches": 80,
113
+ "lines": 95
63
114
  },
64
115
  "tsd": {
65
116
  "compilerOptions": {
66
117
  "lib": [
67
- "ES2018",
118
+ "ES2017",
68
119
  "DOM"
69
120
  ]
70
121
  }
package/pyodide.asm.data CHANGED
Binary file