A JavaScript implementation of the Python virtual machine.
JavaScript Python Other
Clone or download
freakboy3742 Merge pull request #755 from danyeaw/python-requires
Add required minimum and maximum required python versions
Latest commit accf09a Jun 4, 2018
Permalink
Failed to load latest commit information.
.github Simplified pull request template. Aug 17, 2017
batavia Merge pull request #715 from lielfr/eval_enumerate May 28, 2018
docs Contributing docs update (#751) May 26, 2018
tests Merge pull request #715 from lielfr/eval_enumerate May 28, 2018
testserver Merge pull request #743 from EtiennePelletier/etp-dev May 25, 2018
.babelrc Change Babel preset from 'latest' to 'env' Apr 19, 2017
.editorconfig updates .editorconfig to trim_trailing_whitespace unless it's a .md file Aug 7, 2017
.eslintrc Removed lint from types. Feb 21, 2017
.gitignore Added WebPack cache-loader to speed up batavia.js builds Sep 6, 2017
.npmignore Fix the entry point. Dec 30, 2016
AUTHORS Initial commit of JS bytecode interpreter. Aug 9, 2015
CODE_OF_CONDUCT.md Remove trailing whitespaces from Batavia May 14, 2018
CONTRIBUTING.md Remove trailing whitespaces from Batavia May 14, 2018
LICENSE Initial commit of JS bytecode interpreter. Aug 9, 2015
MANIFEST.in Node script to run Python code using Batavia (#671) Oct 11, 2017
README.rst Merge pull request #707 from smitar0y/patch-1 May 15, 2018
beekeeper.yml Tweaked syntax in beekeeper file. Aug 21, 2017
compile_module.py Node script to run Python code using Batavia (#671) Oct 11, 2017
compile_stdlib.py Modify compile_stdlib to compile all of ouroboros unless explicitly e… Aug 18, 2017
package-lock.json Update package-lock.json Apr 16, 2018
package.json Update moment (GitHub Security Notification) Mar 27, 2018
run_in_batavia.js Remove trailing whitespaces from Batavia May 14, 2018
setup.cfg Tweaked the flake8 configuration to ignore node_modules. Jul 20, 2017
setup.py Add required minimum and maximum required python versions Jun 4, 2018
webpack.config.js Added WebPack cache-loader to speed up batavia.js builds Sep 6, 2017

README.rst

http://pybee.org/project/projects/bridges/batavia/batavia.png

Batavia

py-version pypi-version pypi-status license build-status gitter

Batavia is an early alpha project. If it breaks, you get to keep all the shiny pieces.

Batavia is an implementation of the Python virtual machine, written in JavaScript. With Batavia, you can run Python bytecode in your browser.

It honors Python 3.4.4+ syntax and conventions, and allows you to reference objects and classes defined natively in JavaScript.

Quick Start

Prerequisites

Batavia requires a Python 3.4 or Python 3.5 installation, and a virtualenv to run it all in. Python 3.6 is not yet supported.

You also need to have a recent install of Node.js (from the “stable” 6.X series), and a current version of npm. If your version of npm is outdated, you can update it using the command:

$ npm install npm@latest -g

Check the Setting up your environment for configuration help.

Downloading and Installing

1. Clone the code repositories

$ mkdir pybee
$ cd pybee
$ git clone https://github.com/pybee/batavia
  1. Setup a virtualenv:

(for other environments, see Getting Started).

Linux/Unix/Mac

Check your python3 version first. If it's pointing to version 3.6, replace $(which python3) in the virtualenv command below with the path to your Python 3.4 or 3.5 installation.

$ python3 --version
$ python3 -m venv venv
$ . venv/bin/activate
$ cd batavia
$ pip install -e .

Windows

Type in the following commands in your terminal

> py -3 -m venv venv
> venv\Scripts\activate
> cd batavia
> pip install -e .

Windows (with only conda installed)

Type in the following commands in your terminal

> pip install virtualenvwrapper-win
> mkvirtualenv venv
> workon venv
> cd batavia
> pip install -e .
  1. Install Node.js.

You must have a recent version of Node; we do our testing using v6.9.1. Once you've installed Node, you can use it to install the JavaScript dependencies and compile the Batavia library:

$ npm install
  1. Compile the Batavia library and bundle its dependencies

Run the following command in the terminal

$ npm run build

For more detailed setup instructions, see the Getting Started tutorial

Running Batavia in the browser

After you have setup the local installation of Batavia, you can now run Python in the browser:

$ cd testserver
$ pip install -r requirements.txt

On Linux/macOS:

$ ./manage.py runserver

On Windows:

> python manage.py runserver

then open a web browser at http://localhost:8000

For more detailed instructions, see the Python In The Browser guide.

Running Batavia in the terminal

If you want to run some Python code from a file in the terminal, you can also run Batavia on Node:

$ npm run python /path/to/python/file.py

This will should run the Python file and show output on the terminal.

For more details see Running Python code using Batavia from the command line.

Documentation

Documentation for Batavia can be found on Read The Docs, including:

Contributing

If you'd like to contribute to Batavia development, our guide for first time contributors will help you get started.

If you experience problems with Batavia, log them on GitHub.

Community

Batavia is part of the BeeWare suite. You can talk to the community through:

We foster a welcoming and respectful community as described in our BeeWare Community Code of Conduct.