pinokiod 1.0.51 → 1.0.52

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.
@@ -0,0 +1,20 @@
1
+ class Py {
2
+ async install(req, ondata) {
3
+ await this.kernel.exec({
4
+ message: "git clone https://github.com/pinokiocomputer/python py",
5
+ path: this.kernel.path("bin")
6
+ }, ondata)
7
+ await this.kernel.exec({
8
+ message: "pip install -r requirements.txt",
9
+ path: this.kernel.bin.path("py")
10
+ }, ondata)
11
+ }
12
+ async installed() {
13
+ let exists = await this.kernel.exists(this.kernel.bin.path("py"))
14
+ return exists
15
+ }
16
+ async uninstall(req, ondata) {
17
+ await this.kernel.bin.rm(this.kernel.bin.path("py"), ondata)
18
+ }
19
+ }
20
+ module.exports = Py
@@ -7,20 +7,10 @@ class Python {
7
7
  console.log("CALL", { modname, modpath, method, args })
8
8
  // if this.proc doesn't exist, create
9
9
  if (!this.proc) {
10
- await this.kernel.exec({
11
- message: [
12
- "which pip",
13
- "pip install fastapi importlib_metadata uvicorn[standard]",
14
- ],
15
- conda: "base"
16
- }, (s) => {
17
- ondata(s)
18
- })
19
- console.log("Start uvicorn", __dirname)
20
10
  await new Promise((resolve, reject) => {
21
11
  this.kernel.exec({
22
12
  message: "uvicorn --port 42001 server:app",
23
- path: __dirname,
13
+ path: this.kernel.bin.path("py"),
24
14
  conda: "base"
25
15
  }, (s) => {
26
16
  // process.stdout.write(s)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -289,6 +289,8 @@ class Server {
289
289
  type: "conda",
290
290
  name: "nodejs",
291
291
  args: "-c conda-forge"
292
+ }, {
293
+ name: "py"
292
294
  }]
293
295
  let platform = os.platform()
294
296
  if (platform === "win32") {
@@ -528,6 +530,8 @@ class Server {
528
530
  type: "conda",
529
531
  name: "nodejs",
530
532
  args: "-c conda-forge"
533
+ }, {
534
+ name: "py"
531
535
  }]
532
536
  let platform = os.platform()
533
537
  if (platform === "win32") {