{"id":10344,"library":"wagon","title":"Wagon Archiver","description":"Wagon is a Python library and command-line tool designed to create self-contained Python Wheel-based archives. It bundles packages along with their dependencies into 'wagons' (files with a .wgn extension), simplifying their distribution and offline installation. The current stable version is 1.0.3, with an irregular release cadence focusing on stability and broader compatibility.","status":"active","version":"1.0.3","language":"en","source_language":"en","source_url":"https://github.com/cloudify-cosmo/wagon","tags":["package management","archive","wheel","dependencies","offline installation"],"install":[{"cmd":"pip install wagon","lang":"bash","label":"Install Wagon"}],"dependencies":[],"imports":[{"note":"For programmatic wagon creation.","symbol":"create","correct":"from wagon import create"},{"note":"For programmatic wagon installation.","symbol":"install","correct":"from wagon import install"}],"quickstart":{"code":"import os\nimport tempfile\nimport shutil\nfrom wagon import create\n\n# Define the package to create a wagon for\npackage_name = \"requests\"\n\n# Create a temporary directory for the output wagon file\noutput_dir = tempfile.mkdtemp()\n\ntry:\n    print(f\"Creating wagon for '{package_name}' in '{output_dir}'...\")\n    # The 'create' function returns the path to the generated .wgn file\n    created_wagon_path = create(\n        source=package_name,\n        output_path=output_dir,\n        version=None, # Automatically fetches the latest version\n        pip_args=None # Pass additional pip arguments if needed, e.g., ['--no-deps']\n    )\n    print(f\"Wagon created successfully: {created_wagon_path}\")\n    print(f\"You can now install it using: wagon install {created_wagon_path}\")\nexcept Exception as e:\n    print(f\"An error occurred during wagon creation: {e}\")\nfinally:\n    # Clean up the temporary directory\n    print(f\"Cleaning up temporary directory: {output_dir}\")\n    shutil.rmtree(output_dir)","lang":"python","description":"This quickstart demonstrates how to programmatically create a .wgn archive for a specified package (e.g., 'requests') using the `wagon.create` function. It creates the wagon in a temporary directory and then cleans up."},"warnings":[{"fix":"For projects requiring Python 2.6 or 3.3, use `wagon<0.7.0`. For example, `pip install 'wagon<0.7.0'`.","message":"Wagon versions 0.7.0 and higher dropped official support for Python 2.6 and Python 3.3, aligning with Wheel's dependency updates.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"If manually parsing wagon metadata, update your code to look for `package_name` and `package_version`. Consider adding fallback logic for older wagons if necessary.","message":"The metadata keys for package name and version inside a wagon archive changed from `module_name`/`module_version` to `package_name`/`package_version`.","severity":"gotcha","affected_versions":"<0.2.2"},{"fix":"Expect `.wgn` files by default. If you require a `zip` format, use the `--format zip` flag in the CLI or equivalent in programmatic calls.","message":"The default output format for wagons changed to `tar.gz` and the file extension to `.wgn` starting from version 0.3.0. Previously, it might have been a different archive format or extension.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Always use the `-a` flag (e.g., `wagon create -s flask -a '--retries 5'`) for passing arbitrary pip arguments to both `create` and `install` commands, as it's supported since 0.3.0.","message":"Passing arbitrary pip arguments to `create` and `install` commands consolidated. Older versions used `--wheel-args` or `--install-args`, while newer versions use a single `-a` flag.","severity":"gotcha","affected_versions":"0.2.4 - 0.2.5"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the library using `pip install wagon`.","cause":"The 'wagon' library is not installed in your current Python environment or virtual environment.","error":"No module named 'wagon'"},{"fix":"Upgrade your Python environment to 3.4 or higher, or explicitly install an older compatible Wagon version like `pip install 'wagon<0.7.0'`.","cause":"This error often occurs when attempting to create a wagon using Python 2.6 or 3.3 with Wagon versions >= 0.7.0, which no longer support these Python versions.","error":"Command \"python setup.py egg_info\" failed with error code 1 in /tmp/pip-install-..."},{"fix":"Update your metadata parsing logic to check for `package_name` and `package_version`. If you need to support older wagons, add a fallback to `module_name` and `module_version`.","cause":"You are attempting to parse metadata from a wagon file created with Wagon versions older than 0.2.2, but your parsing logic expects the newer `package_name` or `package_version` keys.","error":"KeyError: 'module_name'"},{"fix":"Use the unified `-a` flag instead. For example, `wagon create -s flask -a '--retries 5'` or `wagon install <wagon_file> -a '--no-deps'`.","cause":"You are using the deprecated `--wheel-args` or `--install-args` flags for passing arbitrary pip arguments.","error":"Error: No such option: --wheel-args"}]}