{"id":22994,"library":"xar","title":"XAR - eXecutable ARchive packaging toolchain","description":"XAR is a toolchain for packaging Python applications into self-contained executables (XAR files). It creates a single-file, executable archive that bundles all dependencies and runs with the system Python. The current version is 20.12.2, released in December 2020. The project appears to be in maintenance mode with infrequent releases.","status":"maintenance","version":"20.12.2","language":"python","source_language":"en","source_url":"https://github.com/facebookincubator/xar","tags":["xar","executable-archive","packaging","facebook"],"install":[{"cmd":"pip install xar","lang":"bash","label":"PyPI install"}],"dependencies":[],"imports":[{"note":"Common mistake: not importing the class directly.","wrong":"import xar; xar.XarFile","symbol":"XarFile","correct":"from xar import XarFile"}],"quickstart":{"code":"from xar import XarFile\n\n# Create a XAR archive from a Python script\nwith XarFile('hello.xar', 'w') as xf:\n    xf.add('hello.py')\n    xf.add_directory('mylib')\n\n# To run: python xar hello.xar","lang":"python","description":"Creates a XAR file from a Python script and a directory."},"warnings":[{"fix":"Ensure deployment targets are Linux or macOS with Python 3.5+.","message":"XAR files require Python 3.5+ on Linux or macOS. They do not work on Windows.","severity":"gotcha","affected_versions":"all"},{"fix":"Build XAR files on the target platform.","message":"The XAR format does not support cross-platform execution. Archives built on Linux will not run on macOS or vice versa.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the Python API from xar import XarFile instead of the xar CLI.","message":"The 'xar' command-line tool is deprecated. Use the Python API instead.","severity":"deprecated","affected_versions":"20.0+"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with: pip install xar","cause":"The xar package is not installed.","error":"ModuleNotFoundError: No module named 'xar'"},{"fix":"Recreate the XAR file using the XarFile API. Ensure all dependencies are included.","cause":"The XAR file was corrupted or not created correctly.","error":"OSError: Unable to run XAR file: not a valid XAR archive"},{"fix":"Use: from xar import XarFile","cause":"Incorrect import: importing xar instead of using from xar import XarFile.","error":"AttributeError: module 'xar' has no attribute 'XarFile'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}