Google develops Grumpy to translate Python code into Go programs
With a view to overcoming some major limitations of Python, Google has brought out its transcompiling tool called Grumpy. The new open source project is designed to translate Python code into Go programs to address the concurrency issue, and run the transpiled programs seamlessly within the Go runtime.
Google’s YouTube and various YouTube APIs are the finest example of Python-based solutions by the company. The front-end of YouTube runs on
CPython 2.7. Though the high-level programming language brought about fruitful results to the video streaming website, it was restricting the achievements on concurrent workloads. This led to the demand for an alternative runtime that was optimised for real-time serving, and ultimately took the shape of Grumpy.
“We are excited about the prospects for Grumpy. Although it is still alpha software, most of the language constructs and many core built-in types work like you would expect,” YouTube engineer Dylan Trotter wrote in a blog post.
The alpha state of Grumpy limits its usage. The tool does not have support for C extension modules and is not operable as an interpreter. However, it uses Go’s garbage collection for object lifetime management and has the potential to scale more smoothly over Cpython.
Google does not seem set to leave Python at this moment. Instead, Grumpy is being backed to bring out a model of ‘Python in Go’ and enable interoperability in its major Python developments.
In the near future, Google is expected to improve Grumpy and will soon convert some of its major Python code into a Go program using the latest model. The present release has some areas for improvement around built-in types and functions. Also, the hybrid approach is yet to be supported by a large number of Python developers.