JavaScripthon — A Simple Python To ES6 JavaScript Translator


Javascripthon python js converterShort Bytes: If you are looking for a Python to JavaScript converter, JavaScripthon is worth checking out. JavaScripthon completes the conversion process without any full python-in-js environment. Read more to know everything about the project.

So many, Python and JavaScript seem like similar languages — object oriented, functional hybrid, dynamically typed and a rich library. Keeping the same in mind, probably, a coder has created a small and simple Python to JavaScript translator.

What are the aims of JavaScripthon?

Called JavaScripthon, this Python 3.5 translator aims to convert most of the Python’s core semantics. Unlike the most existing translators, JavaScripthon completes this process without any full python-in-js environment.

It aims to produce a simple to read code and solve the need of developers. The ES6 code is also converted to ES5 code if requested with the help of BabelJS library with dumpy embedded js interpreter.

JavaScripthon has the ability to generate single modules or complete dir tree structures without emitting concatenated or minified files.

If you are willing to debug some translated JavaScript code, this is made easier with the help of SourceMap that’s generated by JavaScripthon.


How to install and use JavaScripthon?

To install JavaScripthon, Python 3.5 is needed. To install, you need to execute the following command:

$ pip install javascripthon

To compile or transpile a python source module, you need to execute following commands:

$ python -m metapensiero.pj


$ python -m metapensiero.pj -5

To know more about JavaScripthon and get things done, you can visit project’s GitHub page.

Here’s an example of converted code:
javascripthon python to js translator

Also Read: What Is “Incremental-Hacking Cycle”?

Adarsh Verma

Adarsh Verma

Fossbytes co-founder and an aspiring entrepreneur who keeps a close eye on open source, tech giants, and security. Get in touch with him by sending an email — [email protected]
More From Fossbytes

Latest On Fossbytes