Skip to main content

Python to JavaScript compiler.

Project description

PScript

Build Status Documentation Status

PScript is a Python to JavaScript compiler, and is also the name of the subset of Python that this compiler supports. It was originally developed as a part of Flexx and is now a project on its own.

Installation

PScript is pure Python and requires Python 3.6+ (including Pypy). It has no further dependencies.

pip install pscript

Short example

   from pscript import py2js

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

   print(py2js(foo))

Gives:

   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 in the wild

To give an idea of what PScript can do, here are some examples in the wild:

  • Obviously, everything built in Flexx uses PScript, see e.g. these examples
  • The front-end of TimeTagger.app is built in Python using PScript.

Let us know if you know more!

License

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.

Source Distribution

pscript-0.8.1.tar.gz (104.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pscript-0.8.1-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file pscript-0.8.1.tar.gz.

File metadata

  • Download URL: pscript-0.8.1.tar.gz
  • Upload date:
  • Size: 104.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.33.0

File hashes

Hashes for pscript-0.8.1.tar.gz
Algorithm Hash digest
SHA256 d3858bf9b34454af8018c7eab832c2f4aaf54f878d7e40f3131ff6dd634bcdfd
MD5 638aca99d052441c936fd1c56566f24c
BLAKE2b-256 682e73709f4b3ec5c7f3b73a468fe2c1a6fb40e4371ae2921a306c1c53002109

See more details on using hashes here.

File details

Details for the file pscript-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: pscript-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.33.0

File hashes

Hashes for pscript-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bbae5fa9d585b3dc3f9fa3a5ddeb1e634cbdc90bd9637d082de015e25358c794
MD5 3813a7a122dbcdf0da667dff1965673f
BLAKE2b-256 88facfe3fe748610a3efecb4487d2e86dcbf7d35cc0d6ba8b8eb8e8bc9c6d537

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page