The most widely used Python compiler is CPython, the default implementation, but several other tools translate Python into JavaScript, C, C++ or standalone programs. The best-known alternatives are Brython, Nuitka, Pyjs, Shed Skin, Skulpt, Transcrypt and WinPython, and the right one depends on where the code needs to run.
Key takeaways
- A compiler translates code from one language into another form; most tools on this list translate Python into JavaScript or C/C++.
- Brython, Pyjs, Skulpt and Transcrypt target the web browser by producing JavaScript.
- Nuitka and Shed Skin target native code, aiming at standalone programs and better speed.
- WinPython is a portable Python distribution for Windows rather than a compiler in the strict sense.
What is a compiler, and how does it apply to Python?
A compiler is a program that translates source code written in a high-level language into another form, such as machine code, bytecode or a different programming language. The result can then be run without the original source being interpreted line by line.
Python is one of the fastest-growing programming languages, so a range of tools has appeared to serve different project needs. The reference implementation, CPython, compiles source files to bytecode and runs that bytecode in a virtual machine. The tools below take other routes, such as producing JavaScript for browsers or C code for native executables.
How do the Python compilers compare?
| Tool | What it produces | Typical use |
|---|---|---|
| Brython | JavaScript, run in the browser | Client-side web scripting in Python |
| Nuitka | C code and executables | Standalone programs and speed |
| Pyjs | JavaScript | Browser apps and desktop apps from one code base |
| Shed Skin | C++ from statically typed Python | Faster standalone programs and extension modules |
| Skulpt | JavaScript, run in the browser | Running Python on a page with no server support |
| Transcrypt | Readable JavaScript | Large browser projects that use JavaScript libraries |
| WinPython | Not a compiler; a Windows distribution | Portable Python with data science libraries |
What is Brython?
Brython
Brython, short for Browser Python, is an implementation of Python 3 for client-side web programming. It converts Python code into JavaScript so it can run in the browser, and it provides an interface to the DOM objects and events of the HTML5 environment.
It supports most of the Python 3 syntax, including generators, comprehensions and imports, along with many modules from the CPython distribution. It also works with HTML5 and CSS3 and with CSS frameworks such as Bootstrap.
What does Nuitka do?
Nuitka
Nuitka is a source-to-source compiler. It translates Python code into C source code and can build executables from it, so programs can be distributed to machines that do not have Python installed.
Nuitka itself is written in Python and works with many Python libraries and extension modules. It runs on Linux, macOS, Windows, FreeBSD and NetBSD, and it is released under the Apache License 2.0.
How does Pyjs work?
Pyjs
Pyjs lets developers write Python and run it in a web browser. It builds JavaScript from the Python abstract syntax tree and includes an Ajax framework that smooths over differences in how browsers handle JavaScript and the DOM.
It also offers a desktop module, so a web application written in Python can run as a standalone desktop application. Because the project is older, check its current maintenance status before choosing it for new work.
What is Shed Skin?
Shed Skin
Shed Skin is an experimental compiler that converts statically typed Python programs into optimized C++. Statically typed here means each variable must hold values of one type only.
It has clear limits. Nested functions and functions that accept a variable number of arguments are not supported, and only part of the standard library is available. An unsupported module must be replaced with plain code that does the same job.
In return, Shed Skin can produce standalone programs or extension modules that larger Python programs can import, and its main benefit is a significant speedup.
Why use Skulpt?
Skulpt
Skulpt is an implementation of Python written in JavaScript that runs entirely in the browser. No plugins, extra processing or server-side support are needed, so a site can let visitors run Python without exposing back-end servers.
It can be embedded in an existing webpage, and custom modules can be made importable for tighter control over what the code can do.
What is Transcrypt?
Transcrypt
Transcrypt compiles a fairly extensive subset of Python into compact, readable JavaScript that is easy to debug. It supports features such as multiple inheritance and local classes, and it can work with JavaScript libraries.
It ships with tooling such as a linter and a static type validator, which helps teams collaborating on larger projects. It can also run on top of Node.js.
Is WinPython a compiler?
WinPython
No. WinPython is a Python distribution built for Windows. It is self-contained, so it can be downloaded and started without a traditional installation.
It bundles popular data science libraries such as NumPy, pandas and SciPy, so they are ready to use immediately. The downside is that the full package includes many components, such as C and C++ compilers, that not everyone needs. A slimmer option containing only Python is also available.
Frequently asked questions
What is the default Python compiler?
CPython is the reference implementation and the one most developers use. It compiles source code to bytecode and executes it in a virtual machine.
Which tool runs Python in a web browser?
Brython, Skulpt, Pyjs and Transcrypt all produce JavaScript for the browser. Brython and Skulpt are the simplest to embed in a page.
Which option creates standalone programs?
Nuitka and Shed Skin both generate native code and can produce standalone programs. Shed Skin is experimental and restricts the Python features you can use.
Do these tools make Python faster?
Some can, particularly Shed Skin and Nuitka, which translate code to C++ or C. Results vary by program, so test with your own code before relying on any speed claim.
Conclusion
Each of these tools serves a different need, from running Python in a browser to building standalone executables. Matching the target environment to the tool is the key decision. Trying a small project with two or three of them is the quickest way to find the best fit.












