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]https://github.com/flexxui/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.0.tar.gz (104.3 kB view details)

Uploaded Source

Built Distribution

pscript-0.8.0-py3-none-any.whl (63.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pscript-0.8.0.tar.gz
Algorithm Hash digest
SHA256 d24e72a077c0fd37d2043c60de8742531273500ccfe9ff6d22269685f1edd1d8
MD5 4e247068f359962cb5ed7080684317be
BLAKE2b-256 b0e51ecd135229b43b1fab2d5f68e2a4e846e505a2983e6b365b927cfb34bd7e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pscript-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8097c8b898feb7cebc8ce15eba0ae3dfd5f12ac68567b1b36ecb0fb837d1b842
MD5 749080e0291a7c36ad3d60a3e97237d4
BLAKE2b-256 f08db35276e2b213c2e2b864a820daf697a0d18b2d70309bcd012a012d30c0e9

See more details on using hashes here.

Supported by

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