Skip to content

Commit 5bc4748

Browse files
Merge pull request #73 from pyscript/mip
Added MicroPython mip package manager
2 parents 4242821 + 819d3f1 commit 5bc4748

File tree

18 files changed

+501
-74
lines changed

18 files changed

+501
-74
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ecmaVersion": 12,
99
"sourceType": "module"
1010
},
11-
"ignorePatterns": ["__template.js", "xworker.js"],
11+
"ignorePatterns": ["__template.js", "xworker.js", "esm/python/*.js"],
1212
"rules": {
1313
"object-curly-spacing": ["error", "always"],
1414
"quotes": ["error", "single"]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ pyscript.js
1111
esm/worker/xworker.js
1212
esm/worker/__template.js
1313
types/
14+
esm/python/

docs/core.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/interpreter/micropython.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { fetchFiles, fetchJSModules, fetchPaths, stdio, writeFile } from './_utils.js';
22
import { registerJSModule, run, runAsync, runEvent } from './_python.js';
3+
import mip from '../python/mip.js';
34

45
const type = 'micropython';
56

@@ -16,6 +17,14 @@ export default {
1617
if (config.files) await fetchFiles(this, interpreter, config.files);
1718
if (config.fetch) await fetchPaths(this, interpreter, config.fetch);
1819
if (config.js_modules) await fetchJSModules(config.js_modules);
20+
21+
// Install Micropython Package
22+
this.writeFile(interpreter, './mip.py', mip);
23+
if (config.packages){
24+
const mpyPackageManager = interpreter.pyimport('mip');
25+
for (const mpyPackage of config.packages)
26+
mpyPackageManager.install(mpyPackage);
27+
}
1928
return interpreter;
2029
},
2130
registerJSModule,

package-lock.json

Lines changed: 64 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "./types/polyscript/esm/index.d.ts",
77
"scripts": {
88
"server": "npx static-handler --coi .",
9-
"build": "npm run rollup:xworker && npm run rollup:core && eslint esm/ && npm run ts && npm run cjs && npm run rollup:integrations && cp core.* docs/",
9+
"build": "mkdir -p esm/python && node rollup/build_python.cjs && npm run rollup:xworker && npm run rollup:core && eslint esm/ && npm run ts && npm run cjs && npm run rollup:integrations && cp core.* docs/",
1010
"cjs": "ascjs --no-default esm cjs",
1111
"dev": "node dev.cjs",
1212
"rollup:core": "rollup --config rollup/core.config.js",
@@ -43,9 +43,9 @@
4343
"ascjs": "^6.0.3",
4444
"c8": "^8.0.1",
4545
"chokidar": "^3.5.3",
46-
"eslint": "^8.55.0",
46+
"eslint": "^8.56.0",
4747
"linkedom": "^0.16.5",
48-
"rollup": "^4.9.0",
48+
"rollup": "^4.9.1",
4949
"static-handler": "^0.4.3",
5050
"typescript": "^5.3.3"
5151
},
@@ -83,6 +83,6 @@
8383
"sticky-module": "^0.1.1"
8484
},
8585
"worker": {
86-
"blob": "sha256-cvr5TwJH3FX7KekdE0ALuJNaSIhhi7xaK7rHUQ0FNxE="
86+
"blob": "sha256-Ff8OBms0P5eTVfjUpcA1RayQJVKinKqjW+A+nsLN/ns="
8787
}
8888
}

0 commit comments

Comments
 (0)