The tl;dr is that Facebook has released, via open source, a new tool for doing single-file deployments of Python projects, a problem which is also partially solved by pex and Python3’s native zipapp.
The architecture of XARs is novel, though. It’s not a zip file that gets decompressed on the fly; instead, it’s more a disk image which gets mounted on the fly. The details:
XARs are slightly modified squashfs files that mount themselves when executed and unmount after an idle timeout. They could almost be thought of as a self-executing container without the virtualization. By using the squashfs format, we not only distribute data in a far more compressed format than with zip file, but we also decompress on demand only the portions we need. Thanks to this architecture, XARs have nearly zero overhead in production and can be used just as native scripts or executables would be. […] XARs have advantages for interpreted languages like Python. By collecting a Python script, associated data, and all native and Python dependencies, we achieve a hermetic binary that can run anywhere in our infrastructure, regardless of operating system or packages already installed. In fact, this works for many Python tools as well as for JavaScript (Node.js), Lua tooling, and bundling multiple C++ executables and data files together, yielding a single archive that is smaller and can be moved as a single unit.
So, though it solves this problem for Python, Facebook suggests that XARs might be useful as a generic packaging tool for production code, without the overhead of full machine pre-baked images (e.g. packer AMIs), and also without the complexity of Linux system package managers (e.g. deb, rpm).
The tl;dr is that Facebook has released, via open source, a new tool for doing single-file deployments of Python projects, a problem which is also partially solved by pex and Python3’s native zipapp.
The architecture of XARs is novel, though. It’s not a zip file that gets decompressed on the fly; instead, it’s more a disk image which gets mounted on the fly. The details:
So, though it solves this problem for Python, Facebook suggests that XARs might be useful as a generic packaging tool for production code, without the overhead of full machine pre-baked images (e.g. packer AMIs), and also without the complexity of Linux system package managers (e.g. deb, rpm).