Skip to content

Commit

Permalink
Merge pull request #73 from pyscript/mip
Browse files Browse the repository at this point in the history
Added MicroPython mip package manager
  • Loading branch information
WebReflection authored Dec 19, 2023
2 parents 4242821 + 819d3f1 commit 5bc4748
Show file tree
Hide file tree
Showing 18 changed files with 501 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ecmaVersion": 12,
"sourceType": "module"
},
"ignorePatterns": ["__template.js", "xworker.js"],
"ignorePatterns": ["__template.js", "xworker.js", "esm/python/*.js"],
"rules": {
"object-curly-spacing": ["error", "always"],
"quotes": ["error", "single"]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ pyscript.js
esm/worker/xworker.js
esm/worker/__template.js
types/
esm/python/
4 changes: 2 additions & 2 deletions docs/core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/core.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions esm/interpreter/micropython.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fetchFiles, fetchJSModules, fetchPaths, stdio, writeFile } from './_utils.js';
import { registerJSModule, run, runAsync, runEvent } from './_python.js';
import mip from '../python/mip.js';

const type = 'micropython';

Expand All @@ -16,6 +17,14 @@ export default {
if (config.files) await fetchFiles(this, interpreter, config.files);
if (config.fetch) await fetchPaths(this, interpreter, config.fetch);
if (config.js_modules) await fetchJSModules(config.js_modules);

// Install Micropython Package
this.writeFile(interpreter, './mip.py', mip);
if (config.packages){
const mpyPackageManager = interpreter.pyimport('mip');
for (const mpyPackage of config.packages)
mpyPackageManager.install(mpyPackage);
}
return interpreter;
},
registerJSModule,
Expand Down
128 changes: 64 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "./types/polyscript/esm/index.d.ts",
"scripts": {
"server": "npx static-handler --coi .",
"build": "npm run rollup:xworker && npm run rollup:core && eslint esm/ && npm run ts && npm run cjs && npm run rollup:integrations && cp core.* docs/",
"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/",
"cjs": "ascjs --no-default esm cjs",
"dev": "node dev.cjs",
"rollup:core": "rollup --config rollup/core.config.js",
Expand Down Expand Up @@ -43,9 +43,9 @@
"ascjs": "^6.0.3",
"c8": "^8.0.1",
"chokidar": "^3.5.3",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"linkedom": "^0.16.5",
"rollup": "^4.9.0",
"rollup": "^4.9.1",
"static-handler": "^0.4.3",
"typescript": "^5.3.3"
},
Expand Down Expand Up @@ -83,6 +83,6 @@
"sticky-module": "^0.1.1"
},
"worker": {
"blob": "sha256-cvr5TwJH3FX7KekdE0ALuJNaSIhhi7xaK7rHUQ0FNxE="
"blob": "sha256-Ff8OBms0P5eTVfjUpcA1RayQJVKinKqjW+A+nsLN/ns="
}
}
Loading

0 comments on commit 5bc4748

Please sign in to comment.