Package: batavia
Tools to run Python bytecode in the browser.This is experimental code. If it breaks, you get to keep all the shiny pieces.What it does:Implements a Python 3.4 Bytecode machine that can handle function calls
and basic class definitions.Unmarshals Base64 encoded bytecode into Code objectsImplements most of the common Python VM opcodesAllows access to the DOM usingimport dom,What it doesn’t do:Make a good distinction between integer and floating point mathAny attempt at unicode handling.Raise errors (especially TypeErrors during math operations) in exactly
the same way as PythonSupport all Python’s builtin functionsSupport the full Python standard libraryAllow for class inheritanceQuickstartThetestserverdirectory contains a minimal Django project that will serve
Python bytecode to your browser and execute it. To run this project, you’ll
need to be running Python 3.4. Install Django 1.8 into your virtual
environment; then, at a shell prompt:$ cd testserver
$ ./manage.py runserverYou can then loadhttp://127.0.0.1:8000in your browser. When the page loads,
you will see a set of buttons corresponding to Python modules that
have been embedded in the page:The PyStone performance benchmark. The Python bytecode is embedded as a
string in the HTML file.sample.py, a simple Python example demonstrating basic VM features.The PYC content that is dynamically generated on the server and served
to the client. This file imports a second file,other.py, to
demonstrate how imports work.Click one of the buttons, and the code will run; stdout/stderr has been
redirected to the webpage, so if the script has any output, you’ll see it.To start tinkering, make changes totestserver/sample.py, reload the page,
and click the button.DocumentationDocumentation for Batavia can be found onRead The Docs.Why “Batavia?”On 27 October, 1628,CommandeurFrancisco Pelsaert took command of theBatavia, and with 340 passengers and crew, set sail from Texel. Their
destination? The Spice Islands - or more specifically, island of Java in the
Dutch East Indies (now part of Indonesia).The Batavia was… a Java ship (rimshot!).Interestingly, during the voyage, Ariaen Jacobsz andonderkoopmanJeronimus
Cornelisz incited a mutiny, because they didn’t want to go to Java - they
wanted to escape to start a new life somewhere else. As a result of the
mutiny, on 4 June 1629, the Batavia ran aground on Morning Reef, part of the
Houtman Abrolhos, about 450km North of Perth, Western Australia, where this
project was conceived.Thefull story of the Bataviais known to most Western Australian
schoolchildren, and is a harrowing tale of intrigue, savagery, and murder. It
serves as a reminder of what can happen when you force people to go to Java
:-)The wreck of the Batavia was recovered in the 1970s, and now stands in theshipwrecks gallery of the Western Australian Maritime Museum.CommunityBatavia is part of theBeeWare suite. You can talk to the community through:@pybeeware on TwitterTheBeeWare Users Mailing list, for questions about how to use the BeeWare suite.TheBeeWare Developers Mailing list, for discussing the development of new features in the BeeWare suite, and ideas for new tools for the suite.ContributingIf you experience problems with Batavia,log them on GitHub. If you
want to contribute code, pleasefork the codeandsubmit a pull request.