diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fd4933e..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -*.py[cod] -*~ -# C extensions -*.so - -# Packages -*.egg -*.egg-info - -__pycache__ diff --git a/COPYING b/COPYING deleted file mode 100644 index ef6c109..0000000 --- a/COPYING +++ /dev/null @@ -1,14 +0,0 @@ -"The New BSD License" - -Copyright (c) 2013, Amirouche Boubekki and Brett Hartshorn -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -Neither the name of the Amirouche Boubekki or Brett Hartshorn nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index db3e43f..0000000 --- a/README.md +++ /dev/null @@ -1,408 +0,0 @@ -Introduction ------------- -PythonJS is a transpiler written in Python that converts a python like language into fast -JavaScript. It also includes experimental backends that translate to: Dart, Lua, CoffeeScript, and Go. - -[Syntax Documentation](https://github.com/PythonJS/PythonJS/blob/master/doc/syntax.md) - - -Go backend ----------- -The Go backend uses a fully typed subset of Python, mixed with extra syntax inspired by Golang to output Go programs that can be compiled to native executeables, or translated to JavaScript using GopherJS. - -[Syntax Documentation](https://github.com/PythonJS/PythonJS/blob/master/doc/go_syntax.md) - - -Getting Started -=============== -PythonJS can be run with regular Python, or fully self-hosted within -NodeJS using Empythoned. - -To get started, you have two options: -1. install NodeJS, python-js package, and write a build script. -2. or install Python2 and use translator.py from this repo directly. - - -1. Installing NodeJS Package -------------- -You can quickly get started with the stable version of PythonJS by installing the NodeJS package, -and writing a build script in javascript to compile your python scripts to javascript. -(Python2.7 is not required) - -``` -npm install python-js -``` - -NodeJS Quick Example --------------- - -``` -var pythonjs = require('python-js'); -var pycode = "a = []; a.append('hello'); a.append('world'); print(a)"; -var jscode = pythonjs.translator.to_javascript( pycode ); -eval( pythonjs.runtime.javascript + jscode ); - -``` - - -Example Projects ----------------- -The example projects below, require the NodeJS python-js package. - -[https://github.com/PythonJS/pythonjs-demo-server-nodejs](https://github.com/PythonJS/pythonjs-demo-server-nodejs) - -[https://github.com/PythonJS/pypubjs](https://github.com/PythonJS/pypubjs) - - - -2. translator.py --------------------------------------- -If you want to run the latest version of the translator, you will need to install -Python2.7 and git clone this repo. (the NodeJS package above is not required) -Then, to translate your python script, directly run the `translator.py` script in the "pythonjs" directory. You can give it a list of python files to translate at once. -It will output the translation to stdout. The default output type is JavaScript. -An html file can also be used as input, python code inside a script tag: ` + + + + + + +
+Python to JavaScript Translator
+PythonJS
+ +
PythonJS is a Python to Javascript translator written in Python, created by Amirouche Boubekki and Brett Hartshorn. It converts a subset of Python into a subset of Javascript. It features: list comprehensions, classes, multiple inheritance, first-class functions, operator overloading, function and class decorators, HTML DOM, and easily integrates with JavaScript and external JavaScript libraries. The generated code works in the Browser and in NodeJS.
+ +Get Source Code::
+ +git clone https://github.com/PythonJS/PythonJS.git
+
+
+Translate Your Script::
+ +cd PythonJS/pythonjs
+./translator.py myscript1.py myscript2.py > ~/myapp.js
+
+
+The translator.py script can take in multiple Python scripts, these are appended together, and translated into a single JavaScript. The output is printed to stdout. If no command line arguments is given, then translator.py takes input from stdin.
+ +Install Tornado for Python3::
+ +wget https://pypi.python.org/packages/source/t/tornado/tornado-3.1.1.tar.gz
+tar xvf tornado-3.1.1.tar.gz
+cd tornado-3.1.1
+python3 setup.py build
+sudo python3 setup.py install
+
+
+Run Test Server::
+ +cd PythonJS/tests
+./server.py
+
+
+Then open a web browser and go to: http://localhost:8080
+ +The test server dynamically compiles Python into JavaScript, this greatly speeds up the testing and development process. Any html file you place in the PythonJS/tests directory will become available as a new web-page. When this web-page is requested the server will parse the html and check all the
+