Programming language Python's 'existential threat' is app distribution: Is this the answer?

New tool aims to bring Python apps on Windows, Mac, and Linux to users who've never heard of Python.

Python's rise asks questions of JavaScript's dominance Rise in queries driven by interest in Python and community of new programmers.

Mozilla Firefox coder Gregory Szorc has released a tool for popular programming language Python to make it easier for developers to create Python programs that can be used by non-technical people on Windows, Mac, and Linux systems. 

Python might soon be the most popular programming language in the world, but it does have a weakness: there's no easy way to distribute Python apps as a simple executable or a program that people can run on their computers without knowing anything about Python. 

SEE: Six in-demand programming languages: Getting started (free PDF)

Szorc, who's been improving Firefox and Mozilla tools for the past decade, may have solved this distribution problem, which Australian programmer Russell Keith-Magee recently described as Python's potential "black swan" – a theory built around the idea that the realization of completely unexpected and extreme events can have an outsized impact on the future, yet seem obvious in hindsight. 

Besides the actual black swan discovered in Western Australia in the 17th century, the PC's popularity supposedly was not predicted by IBM's CEO in the 1940s, making it one too. 

Keith-Magee was discussing Python's future in a world where JavaScript dominates web applications on desktop and mobile web browsers and is already replacing Python on the server. Additionally, the experience around third-party libraries makes computers a "toxic waste site", the developer said.  

Anyway, the final black swan for Python is the assumption that Python code distribution doesn't matter, which in Szorc's words, could be an "existential threat" to the language's longevity. 

Szorc's answer to this problem is PyOxidizer, a tool for producing binaries that embed Python, avoiding the need for users to install Python or know the language to use a program that was built with it. 

"PyOxidizer is capable of producing a single file executable – with a copy of Python and all its dependencies statically linked and all resources (like .pyc files) embedded in the executable. You can copy a single executable file to another machine and run a Python application contained within. It just works," he explains on the GitHub page for the tool

SEE: Learn Python: Online training courses for beginning developers and coding experts (TechRepublic)

Py obviously stands for Python, while the Oxidizer part of the name comes from Rust, the C++-like language designed by Mozilla Research. Oxidation is a Firefox project that integrates Rust. Szorc has posted more details about PyOxidizer and its differences to other similar projects

Szorc says PyOxidizer's main feature is that it "can produce a single file executable containing a fully-featured Python interpreter, its extensions, standard library, and your application's modules and resources". That means developers can create a single .exe file for delivering a Python application. 

He also notes that, "PyOxidizer loads everything from memory and there is no explicit I/O being performed", which should make the executables faster to start and import. 

Szorc hasn't addressed Python's mobile distribution story yet, but notes that this release is just the first in what he expects will be a long-running project.

"While my over-arching goal with PyOxidizer is to solve vast swaths of the Python application-distribution problem, I want to be clear that this first release comes nowhere close to doing so. I toiled with what features must be in the initial release," he explains. 

SEE: How to build a successful developer career (free PDF)

He also admits that PyOxidizer doesn't get anywhere close to definitively solving the distribution challenge for Python, but he believes big apps that use Python such as Dropbox, Kodi, MusicBrainz Picard, could use it to produce self-contained executables. 

"This would likely cut down on installer size, decrease install/update time (fewer files mean faster operations), and hopefully make packaging simpler for application maintainers. Maintainers of Python utilities could produce self-contained executables, making their utilities faster to start and easier to package and distribute," he writes. 

Szorc also gives a huge endorsement of Rust. 

"While Rust is certainly not as expressive or compact as, say, Python, it is far, far closer to Python than I was expecting it to be," he writes. 

"After learning a bit more Rust and realizing the obvious code quality benefits, I ditched Python and adopted Rust for the build time logic. And as the code base has grown and gone through various refactorings, I am so glad I did so. The Rust compiler has caught dozens of would-be bugs in Python."

More on Python and programming languages