Release of PyOxidizer for packaging Python projects into self-contained executables

Submitted by first release of the utility PyOxidizer, which allows you to package a Python project into a self-contained executable file that includes the Python interpreter and all the libraries and resources necessary for work. Such files can be run in environments without Python tools installed or regardless of the required version of Python. PyOxidizer can also generate statically linked executables that are not linked to system libraries either. The project code is written in Rust and spreads licensed under MPL (Mozilla Public License) 2.0.

The project is based on the module of the same name for the Rust language, which allows you to embed a Python interpreter into Rust programs to execute Python scripts in them. PyOxidizer has now moved beyond being a Rust add-on and is positioning itself as a tool for building and distributing self-contained Python packages for a wider audience. For those who do not need to distribute applications as an executable, PyOxidizer provides the ability to generate libraries suitable for linking with any application to embed a Python interpreter and the necessary set of extensions into them.

For end users, delivering the project as a single executable file greatly simplifies installation and eliminates the work of selecting dependencies, which is relevant, for example, for complex Python projects, such as video editors. For application developers, PyOxidizer allows you to save time organizing the delivery of an application, without having to use different tools to generate packages for different operating systems.

The use of the proposed assemblies also has a positive effect on performance - the files generated in PyOxidizer run faster than when using the system Python due to the elimination of imports and the definition of basic modules. In PyOxidizer, modules are imported from memory - all built-in modules are immediately loaded into memory and then used without disk access). In tests, the application startup time when using PyOxidizer is reduced by about half.

Of the already existing similar projects, we can note: PyInstaller (unpacks the file into a temporary directory and imports modules from it), py2exe (tied to the Windows platform and requires distribution of multiple files), py2app (tied to macOS), cx-freeze (requires separate dependency packaging), Shiv ΠΈ PEX (form a package in zip format and requires Python on the system), Nuitka (compiles the code rather than embeds the interpreter), pinsist (tied to Windows), PyRun (proprietary development without explaining the principles of operation).

At the current stage of development, PyOxidizer has already implemented the main functionality for generating executable files for Windows, macOS and Linux. Of the opportunities not yet available noted lack of a typical build environment, inability to generate packages in MSI, DMG and deb/rpm formats, problems with packaging projects that include complex C extensions, lack of commands to accompany delivery ("pyoxidizer add", "pyoxidizer analyze" and "pyoxidizer upgrade" ), limited support for Terminfo and Readline, no support for releases other than Python 3.7, no support for resource compression, no cross-compilation.

Source: opennet.ru

Add a comment