[New-bugs-announce] [issue38280] Feature request: Add support to compile to native binary like as golang

WHK Yan report at bugs.python.org
Wed Sep 25 15:05:18 EDT 2019


New submission from WHK Yan <yan.uniko.102 at gmail.com>:

It would be very useful to be able to compile at a low level a complete Python functional script and generate a native binary for each type of operating system and architecture just like golang does.

For example:

Run script: $ go run script.go
Compile script: $ GOOS=linux GOARCH=amd64 go build -o test test.go

The generated binary does not require goland installed to be executed and does not require complex dependencies. This allows me to distribute applications in binary are an excellent performance without requiring the installation of the entire interpreter.

Golang's problem is that it is not an intuitive language and the learning curve is very long, they had a very good idea but they carried it out in a horrible way.

On the other hand, python is very flexible and very intuitive, the learning curve is very short, I learned python in less than a week and I have been creating python applications for several years, instead I have been trying to learn golang for months and it is excessively strange.

Why not combine the best of both worlds? Unite non-dependence and cross-platform distribution without relying on the interpreter and the most versatile and intuitive language?

For example:

Run script: $ python script.py
Compile pyc $ python -m compileall
Compile native: $ python -m ncompileall -k linux -a amd_64

When compileall generate the pyc files and ncompileall generate a native binaries without complex dependencies or python dependencies.

This would be a great advantage in equipment that does not require additional installation of components.

For example, on servers of some companies they do not allow you to install something that can affect the entire environment or ecosystem, in addition, in many cases the scripts require a specific version of python and cause problems when different versions are required to other applications, the complete compilation at low level would allow to resolve this conflict.

There are currently few projects that allow you to translate a python script to binary but most do not have support or do not have a good performance, if python already brought it integrated it would increase its use even more since it would not depend on the interpreter to be able to distribute a complete application that already include all its modules and others.

----------
components: Cross-Build
messages: 353224
nosy: Alex.Willmer, WHK Yan
priority: normal
severity: normal
status: open
title: Feature request: Add support to compile to native binary like as golang
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38280>
_______________________________________


More information about the New-bugs-announce mailing list