Fork me on GitHub
Latest stable release: 3.6.3 'Paris'
Lean, fast, open!

Clear standard syntax

Transcrypt has exactly the same clear, powerful syntax that Python is famous for, without the need for any proprietary extensions.

It supports string slicing with [i:j:k], matrix and vector operations with +, -, *, / and more, out of the box.

It compiles to compact, readable JavaScript that can be debugged from the Python source code using sourcemaps.

Superior scalability

Python was designed for large scale programs from the ground up.

Hierarchical modules, local classes and multiple inheritance are all supported by Transcrypt, allowing a flexible, yet stable overall structure.

Transcrypt comes integrated with a static type validator, a linter and a minifier, enabling effective cooperation of large teams on extensive projects.

One project, one language

Python is used everywhere at the back-end, from web servers to scientific computing. Now you can use it at the front-end as well.

Transcrypt offers seamless access to any JavaScript library and also runs on top of Node.js.

Python source code and JavaScript target code roughly have the same size, so your pages load as fast as ever.

Installing and using it is simple

Transcrypt workflow

Harness the power of Python for increasingly complex web applications

Transcrypt produces readable, debuggable, lean and mean JavaScript. The minified downloads are measured in kB's rather than MB's. And it's precompiled for speed. As for the availabity of libraries, a clear choice has been made to seamlessly integrate with the JavaScript universe of free, high-quality web oriented software. No need to reinvent the wheel. Calling JavaScript functions from Python, attaching Python event handlers to DOM elements, passing native data between Python and JavaScript, it all happens without any conversion or special syntax.

Transcrypt stays as close to the Python original as possible without sacrificing performance. Multiple inheritance, recursive tuple assignment, multi-loop nested list comprehensions, LHS and RHS extended slices, assignment of bound functions, lambdas, named, default, *args and **kwargs parameters, properties, optional operator overloading, iterators, generators, selective exception handling and a hierarchical module system are just a few of its characteristics that make this clear. Transcrypt is parsed by CPython's AST module, so no surprises there.

Transcrypt features multi-level sourcemaps, so you can debug your application comfortably, working from the Python source code in your browser, even if the generated JavaScript is minified. It also has a unique autotest feature that makes back to back regression testing with CPython a snap.

Transcrypt comes with 3rd party tools for optional static type validation (experimental), lightweight consistency checks and minification, all at the tip of a command line switch. It can generate code for JavaScript 5 and 6. All tools are fully integrated in the distribution, one simple pip install will get you started.

Even with multiple inheritance there's a simple correspondence between Python and JavaScript

The ability to understand exactly what's going on under the hood, allows for fine grained optimizations. Speed up an inner loop? Use __pragma__('js',...) to freely mix Python with native JavaScript. Not that you'll need it often... An expression like i+=1 is compiled to i++, and optional call caching bypasses the prototype chain, making repeated function calls even faster than handwritten JavaScript.

Python and JavaScript side by side

Transcrypt can be mixed seamlessly with JavaScript and HTML

Anything you can do in JavaScript, you can do in Transcrypt. You'll always have immediate access to the newest libraries, use the newest DOM functions, interact with the newest HTML or CSS. Just join the party without restrictions.

Seamless mix with JavaScript and HTML

Transcrypt is suitable for a broad area of applications

Transcrypt supports customization through the use of pragmas. Pragmas are function calls that allow you to switch on and off compiler facilities locally, to conditionally compile code, comparable to the use of #ifdef...#endif and #ifndef...#endif in C++ and to include native JavaScript code anywhere in your program. They also allow efficient, selective operator overloading.

Many people know Python from internet programming, especially from the Django webserver. But it is also tremendously popular in world of scientific computing and education. Selective operator overloading enables the use of elegant notation for mathematical expressions, making Transcrypt an attractive choice for writing small to medium scale numerical applications that have to run in a browser.

Being able to write matrix multiplication and vector addition as v3 = M3 * (M1 * v1 + M2 * v2) rather than v3 = multiply (M3, add (multiply (M1, v1, multiply (M2, v2)))) is a big advantage if the formulas get complicated.

Being able to write c = (3 + 5j) * (-4 - 2j) + (1 + 1j) rather than c = add (multiply (complex (3, 5), complex (-4, -2)), complex (1, 1) when complex numbers are involved is equally handy.

While operator overloading is very powerful, when compiling to JavaScript it is important to be able to switch it on and off selectively to prevent something simple like x = 3 * 4 + 5 * 6 from being translated to x = add (multiply (3, 4), multiply (5, 6) everywhere in your program.

An example of the efficient use of operator overloading is Numscrypt. Numscrypt is a port of a small part of Numpy to Transcrypt. It currently supports real and complex matrix and vector multiplication, division, addition, subtraction, dot product, inverse, transpose, FFT, IFFT, FFT2 and IFFT2, using Numpy's familiar notation, including array slicing. To achieve speed, Numscrypt uses JavaScript TypedArray's under the hood. While it's just as fast and compact as comparable native JavaScript numerical libraries, its notation much more simple and concise, closely resembling mathematical notation.

It's free. It's open. It's yours.

Transcrypt is licensed under the Apache 2.0 open source license. You can download the source code, modify it, keep it in a locker, cut and paste from it, contribute to it, or make it part of your product.