The BeeWare project isn't currently focussing on Batavia development. Python on the Web is still a goal that is important to the BeeWare project; however, the approach that is being used by Batavia needs to be reconsidered. In particular, the emergence of WASM as a viable target for web development opens many options for Python on the web that weren't previously possible.
As a result, we're not dedicating any BeeWare resources to Batavia development, and we we're not encouraging other to contribute to VOC at this time.
If you're interested in exploring future directions for Batavia, please get in touch.
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.5+ syntax and conventions, and allows you to reference objects and classes defined natively in JavaScript.
Batavia requires a Python 3.5, 3.6, or 3.7 installation, and a virtualenv to run it all in.
You also need to have a recent install of Node.js (from the 10.x LTR 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.
1. Clone the code repositories
$ mkdir beeware $ cd beeware $ git clone https://github.com/beeware/batavia
- Setup a virtualenv:
(for other environments, see Getting Started).
Type the following commands in your terminal
$ python3 --version $ python3 -m venv venv $ . venv/bin/activate $ cd batavia $ pip install -e .
Type the following commands in your terminal
> py -3 -m venv venv > venv\Scripts\activate > cd batavia > pip install -e .
Type in the following commands in your terminal
> pip install virtualenvwrapper-win > mkvirtualenv venv > workon venv > cd batavia > pip install -e .
- Install Node.js.
You must have a recent version of Node; we do our testing using v10.x. Once you've installed Node, you can use it to install the JavaScript dependencies and compile the Batavia library:
$ npm install
- 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
After you have setup the local installation of Batavia, you can now run Python in the browser:
$ cd testserver $ pip install -r requirements.txt $ python manage.py runserver
then open a web browser at http://localhost:8000
For more detailed instructions, see the Python In The Browser guide.
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 for Batavia can be found on Read The Docs, including:
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.
Batavia is part of the BeeWare suite. You can talk to the community through:
- @pybeeware on Twitter
- The beeware/general channel on Gitter.
We foster a welcoming and respectful community as described in our BeeWare Community Code of Conduct.