Skip to main content

Python to JavaScript transpiler, supporting multiple inheritance and generating lean, highly readable code

Project description

Transcrypt is a tool to precompile a fairly extensive subset of Python into compact, readable Javascript. It has the following characteristics:

  • Allows for classical OO programming with multiple inheritance using pure Python syntax, parsed by CPython’s native parser

  • Seamless integration with the universe of high-quality web-oriented JavaScript libraries, rather than the desktop-oriented Python ones

  • Hierarchical URL based module system to prevent name conflicts

  • Simple relation between Python source and generated JavaScript code for easy debugging

  • Compact downloads, kB’s rather than MB’s

  • Lightning fast JavaScript code, using memoization (call caching) to optionally bypass the prototype lookup chain

  • Operator overloading can be switched on and off locally to facilitate use for numerical math that’s both readable and efficient

Logo

Transcription once used to be manual labour

Documentation with code examples

Take a look at the documentation with code examples at the Transcrypt website: http://www.transcrypt.org .

Status

First release! Extensive tests on both Windows and Linux have lead to the conclusion that Transcrypt is ready for production use. Any remaining bugs can reported as GitHub issues at: https://github.com/JdeH/Transcrypt .

What’s new

  • Status moved to Production/Stable

Known restrictions

  • No standard libs, use or encapsulate the JavaScript ones, that’s part of the concept. Some may be ported though.

  • Not all methods of builtin types are there by default. This results from a deliberate choice to keep Transcrypt lean. Such things can be distributed in separate libs.

  • No eval and exec of Python code. This is again part of the concept. Transcrypt code is compiled, optimized and minified in advance to warant fast page loads.

  • No threading of any kind. Will probably stay that way as long as JavaScript doesn’t properly support that.

  • No iterator, generator, xrange stuff. Maybe in the future if a broadly installed version of JavaScript suppports it.

Known bugs

  • None

Readability

As can be seen below, there’s a simple parallel between the Python and the JavaScript code. So it should be easy to debug. Also, code can be tested from the command prompt using stubs.

Screenshot of Python versus JavaScript code

Classic OO with multiple inheritance in JavaScript

Other packages you might like

Licence

Copyright 2014, 2015, 2016 Jacques de Hooge, GEATEC engineering, www.geatec.com

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

Transcrypt-3.5.142.zip (15.5 MB view details)

Uploaded Source

File details

Details for the file Transcrypt-3.5.142.zip.

File metadata

  • Download URL: Transcrypt-3.5.142.zip
  • Upload date:
  • Size: 15.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Transcrypt-3.5.142.zip
Algorithm Hash digest
SHA256 68258c40390f19caf27da34a6e6ee3158fb3e8a1502e4ccdd01fa64973d78270
MD5 ec48e1afeb82045dd29d4d43aefddd45
BLAKE2b-256 2263bb9ff815aaf808d62cf11be469303b7c4f52cf060e3d954027455e8fb62e

See more details on using hashes here.

Supported by

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