Python to JavaScript compiler.
Project description
PScript
========
.. image:: https://travis-ci.org/flexxui/pscript.svg
:target: https://travis-ci.org/flexxui/pscript
.. image:: https://readthedocs.org/projects/pscript/badge/?version=latest
:target: https://pscript.readthedocs.org
PScript is a Python to JavaScript compiler, and is also the name of the subset
of Python that this compiler supports. It was developed as a part of
`Flexx <https://flexx.app>`_ (as `flexx.pyscript`) and is now represented
by its own project. Although it is still an important part of Flexx, it can
also be useful by itself.
Installation
------------
PScript is pure Python and requires Python 2.7 or 3.5+ (including Pypy).
It has no further dependencies.
* ``pip install pscript``, or
* ``conda install pscript -c conda-forge``
Short example
-------------
```py
from pscript import py2js
def foo(a, b=2):
print(a - b)
print(py2js(foo))
```
Gives:
```js
var foo;
foo = function flx_foo (a, b) {
b = (b === undefined) ? 2: b;
console.log((a - b));
return null;
};
```
Supported browsers
------------------
PScript aims to support all modern browsers, including Firefox, Chrome and Edge.
Internet Explorer is in principal supported from version 9, though some constructs
(e.g. ``async`` and ``await``) do not work in Internet Explorer.
License
-------
PScript makes use of the liberal 2-clause BSD license. See LICENSE for details.
========
.. image:: https://travis-ci.org/flexxui/pscript.svg
:target: https://travis-ci.org/flexxui/pscript
.. image:: https://readthedocs.org/projects/pscript/badge/?version=latest
:target: https://pscript.readthedocs.org
PScript is a Python to JavaScript compiler, and is also the name of the subset
of Python that this compiler supports. It was developed as a part of
`Flexx <https://flexx.app>`_ (as `flexx.pyscript`) and is now represented
by its own project. Although it is still an important part of Flexx, it can
also be useful by itself.
Installation
------------
PScript is pure Python and requires Python 2.7 or 3.5+ (including Pypy).
It has no further dependencies.
* ``pip install pscript``, or
* ``conda install pscript -c conda-forge``
Short example
-------------
```py
from pscript import py2js
def foo(a, b=2):
print(a - b)
print(py2js(foo))
```
Gives:
```js
var foo;
foo = function flx_foo (a, b) {
b = (b === undefined) ? 2: b;
console.log((a - b));
return null;
};
```
Supported browsers
------------------
PScript aims to support all modern browsers, including Firefox, Chrome and Edge.
Internet Explorer is in principal supported from version 9, though some constructs
(e.g. ``async`` and ``await``) do not work in Internet Explorer.
License
-------
PScript makes use of the liberal 2-clause BSD license. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pscript-0.6.3.tar.gz
(128.3 kB
view details)
File details
Details for the file pscript-0.6.3.tar.gz
.
File metadata
- Download URL: pscript-0.6.3.tar.gz
- Upload date:
- Size: 128.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dad52c47d8ded540f6d7bb75d070c32fb59d004fe5f3d0bf4f4f0b9922470f0a |
|
MD5 | 013f8eeae99da8ec329dcc8a71199e0f |
|
BLAKE2b-256 | 26036b3c69ad9b4ec5eadc11c913cc43c3a7e780f9646943cb9dea942f165df7 |