Skip to main content

Python to JavaScript compiler.

Project description


.. image::

.. image::

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 <>`_ (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.


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


from pscript import py2js

def foo(a, b=2):
print(a - b)



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.


PScript makes use of the liberal 2-clause BSD license. See LICENSE for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pscript-0.7.1-py3-none-any.whl (126.5 kB) Copy SHA256 hash SHA256 Wheel 3.7
pscript-0.7.1.tar.gz (120.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page