diff --git a/README.md b/README.md index 14d9babec..5b60ec1fa 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ - +[![NPM Latest Release](https://img.shields.io/npm/v/pyodide)](https://www.npmjs.com/package/pyodide) +[![PyPI Latest Release](https://img.shields.io/pypi/v/pyodide-build.svg)](https://pypi.org/project/pyodide-build/) [![Build Status](https://circleci.com/gh/pyodide/pyodide.png)](https://circleci.com/gh/pyodide/pyodide) [![Documentation Status](https://readthedocs.org/projects/pyodide/badge/?version=stable)](https://pyodide.readthedocs.io/?badge=stable) @@ -48,8 +49,8 @@ technical resources. These include: recommended for Windows and macOS users and for Linux users who prefer a Debian-based Docker image with the dependencies already installed. - ## History + Pyodide was created in 2018 by [Michael Droettboom](https://github.com/mdboom) at Mozilla as part of the [Iodide project](https://github.com/iodide-project/iodide). Iodide is an experimental diff --git a/src/core/pyproxy.js b/src/core/pyproxy.js index 6dd55bc9f..6d85cea67 100644 --- a/src/core/pyproxy.js +++ b/src/core/pyproxy.js @@ -17,7 +17,7 @@ * See Makefile recipe for src/js/pyproxy.js */ -import { Module } from "../js/module.js"; +import { Module } from "./module.js"; /** * Is the argument a :any:`PyProxy`? diff --git a/src/js/README.md b/src/js/README.md index b185778b9..da893fc99 100644 --- a/src/js/README.md +++ b/src/js/README.md @@ -1,12 +1,40 @@ -# js/pyodide +# Pyodide Javascript package -The Javascript code in this folder is responsible for the following tasks: +npm -1. Defines the public Javascript API +## Usage + +Download and extract Pyodide packages from [Github +releases](https://github.com/pyodide/pyodide/releases) +(`pyodide-build-*.tar.bz2`). The version of the release needs to match exactly the version of this package. + +Then you can load Pyodide in Node.js as follows, + +```js +let pyodide_pkg = await import("pyodide/pyodide.js"); + +let pyodide = await pyodide_pkg.loadPyodide({ + indexURL: "", +}); + +await pyodide.runPythonAsync("1+1"); +``` + +**Note**: To start node REPL with support for top level await, use `node --experimental-repl-await`. + +See the [documentation](https://pyodide.org/en/stable/) fore more details. + +## Details + +The Javascript code in this package is responsible for the following tasks: + +1. Defines the public [Javascript API](https://pyodide.org/en/stable/usage/api/js-api.html) - Package loading code to allow loading of other Python packages. - - Can load micropip.py to bootstrap loading of pure Python wheels + - Can load + [micropip](https://pyodide.org/en/stable/usage/api/micropip-api.html) to + bootstrap loading of pure Python wheels 2. Loads the CPython interpreter and the core/pyodide emscripten application which embeds the interpreter. -3. Injects the js/pyodide Javascript API into sys.modules. This is the final - runtime dependency for core/pyodide & py/pyodide, so after this step the - interpreter is fully up and running. +3. Injects the `js/pyodide` Javascript API into `sys.modules`. This is the + final runtime dependency for `core/pyodide` & `py/pyodide`, so after this step + the interpreter is fully up and running. diff --git a/src/js/package-lock.json b/src/js/package-lock.json index 560f2943f..0e136cc6d 100644 --- a/src/js/package-lock.json +++ b/src/js/package-lock.json @@ -1,6 +1,6 @@ { "name": "pyodide", - "version": "0.18.0dev0", + "version": "0.18.0-dev.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/js/package.json b/src/js/package.json index c169f2c72..66164f0ad 100644 --- a/src/js/package.json +++ b/src/js/package.json @@ -1,6 +1,20 @@ { "name": "pyodide", - "version": "0.18.0dev0", + "version": "0.18.0-dev.0", + "description": "The Pyodide JavaScript package", + "keywords": [ + "python", + "webassembly" + ], + "homepage": "https://github.com/pyodide/pyodide", + "repository": { + "type": "git", + "url": "https://github.com/pyodide/pyodide" + }, + "bugs": { + "url": "https://github.com/pyodide/pyodide/issues" + }, + "license": "Apache-2.0", "devDependencies": { "prettier": "^2.2.1", "terser": "^5.7.0",