PyOxidizer: An Open Source Utility for Python Applications

Python is one of the most popular high-level programming languages that let you do more in less time. Knowledge of Python makes your journey easier. If you are planning to make a career in future-proof industries such as Artificial Intelligence, Machine Learning, Data Science and more. Tech giants like Microsoft, Google, and other developers are releasing useful tools to encourage people to adopt Python and make cool stuff.

According to a recent update, Gregory Szorc, a Developer Productivity Engineer at Airbnb announced PyOxidizer. It’s a Python application packaging and distribution tool to help developers solve complex problems so that they can focus on building applications instead of juggling with build systems and packaging tools.

PyOxidizer is written in Rust and available for Windows, macOS and Linux operating systems. Szorc shared his vision and wrote, “I want PyOxidizer to provide a Python application packaging and distribution experience that just works with a minimal cognitive effort from Python application maintainers.”

Read: Top Tips for Beginner Python Programmers to Get better

How PyOxidizer is different from others?

  • It supports almost all popular platforms (Windows, Linux & macOS).
  • It works even if the executing system does not have Python installed.
  • PyOxidizer does not have any special system requirements like SquashFS, container runtimes, etc.
  • The startup performance is comparable to regular Python execution.
  • It supports single-file executables with minimal or no dependencies.

“PyOxidizer is a collection of Rust crates that facilitate building libraries and binaries containing Python interpreters.” Its most visible component is the ‘pyoxidizer’ command-line tool. With this tool, you can create new projects, add PyOxidizer to existing projects, produce binaries containing a Python interpreter, and various related functionality,” as per the project’s Read Me.

Main Features of PyOxidizer

Works as a bridge between Rust and Python

The ‘Oxidizer’ uses Rust to produce executables. It also manages the embedded Python interpreter and its operations. PyOxidizer definitely solves the complex problems of packaging and distribution, but it also works as a bridge between Rust and Python. This bridge makes the addition of a Python interpreter to any Rust project possible and vice versa.

PyOxidizer executables faster

During the execution, The binaries built with PyOxidizer doesn’t have to create a temporary directory to run the Python interpreter during the execution. Everything is loaded directly from memory. So, When a Python module is imported, its bytecode is loaded using zero-copy. This results in making the executables produced by PyOxidizer faster.

Generates a single executable file

One of the most important features of PyOxidizer is that it can produce a single executable file that contains a fully-featured Python interpreter, its extensions, standard library, and your application’s modules and resources. PyOxidizer embeds self-contained Python interpreters as a tool and packages library by exposing its lower-level features.

Overall, PyOxidizer is still in its early stages. The current version can produce executables embedding Python. However, there’s a lot of work yet to done to make it able to solve the distribution part of the problem.

We can also expect a few new features such as build environment, support for C extensions, more robust packaging support and more. If you are a Python developer, try this tool and share feedback or file an issue on GitHub.