{"id":19946117,"url":"https://github.com/quantco/pixi-pack","last_synced_at":"2025-04-06T02:07:19.060Z","repository":{"id":247975351,"uuid":"808140254","full_name":"Quantco/pixi-pack","owner":"Quantco","description":"📦 Pack and unpack conda environments created with pixi","archived":false,"fork":false,"pushed_at":"2025-03-28T12:58:34.000Z","size":23385,"stargazers_count":105,"open_issues_count":16,"forks_count":8,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-30T01:05:39.868Z","etag":null,"topics":["conda","packaging","pixi"],"latest_commit_sha":null,"homepage":"https://pixi.sh/latest/advanced/production_deployment/#pixi-pack","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quantco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-30T13:14:04.000Z","updated_at":"2025-03-28T12:58:38.000Z","dependencies_parsed_at":"2024-09-05T12:50:23.356Z","dependency_job_id":"8a828e33-de2e-44f4-90c1-2ed2599fac9a","html_url":"https://github.com/Quantco/pixi-pack","commit_stats":null,"previous_names":["quantco/pixi-pack"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpixi-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpixi-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpixi-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpixi-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quantco","download_url":"https://codeload.github.com/Quantco/pixi-pack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423512,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conda","packaging","pixi"],"created_at":"2024-11-13T00:28:22.246Z","updated_at":"2025-04-06T02:07:19.048Z","avatar_url":"https://github.com/Quantco.png","language":"Rust","funding_links":[],"categories":["Extensions"],"sub_categories":["Example projects"],"readme":"![banner](.github/assets/pixi-pack-banner-dark.svg#gh-dark-mode-only)\n![banner](.github/assets/pixi-pack-banner-light.svg#gh-light-mode-only)\n\n\u003cdiv align=\"center\"\u003e\n\n[![License][license-badge]](LICENSE)\n[![CI Status][ci-badge]][ci]\n[![Conda Platform][conda-badge]][conda-url]\n[![Conda Downloads][conda-downloads-badge]][conda-url]\n[![Project Chat][chat-badge]][chat-url]\n[![Pixi Badge][pixi-badge]][pixi-url]\n\n[license-badge]: https://img.shields.io/github/license/quantco/pixi-pack?style=flat-square\n[ci-badge]: https://img.shields.io/github/actions/workflow/status/quantco/pixi-pack/ci.yml?style=flat-square\u0026branch=main\n[ci]: https://github.com/quantco/pixi-pack/actions/\n[conda-badge]: https://img.shields.io/conda/vn/conda-forge/pixi-pack?style=flat-square\n[conda-downloads-badge]: https://img.shields.io/conda/dn/conda-forge/pixi-pack?style=flat-square\n[conda-url]: https://prefix.dev/channels/conda-forge/packages/pixi-pack\n[chat-badge]: https://img.shields.io/discord/1082332781146800168.svg?label=\u0026logo=discord\u0026logoColor=ffffff\u0026color=7389D8\u0026labelColor=6A7EC2\u0026style=flat-square\n[chat-url]: https://discord.gg/kKV8ZxyzY4\n[pixi-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json\u0026style=flat-square\n[pixi-url]: https://pixi.sh\n\n\u003c/div\u003e\n\n![pixi-pack demo](.github/assets/demo/demo-light.gif#gh-light-mode-only)\n![pixi-pack demo](.github/assets/demo/demo-dark.gif#gh-dark-mode-only)\n\n## 🗂 Table of Contents\n\n- [Introduction](#-introduction)\n- [Installation](#-installation)\n- [Usage](#-usage)\n\n## 📖 Introduction\n\nStarting with a [pixi](https://pixi.sh) lockfile `pixi.lock`, you can create a packed environment that can be shared with others.\nThis environment can be unpacked on any system using `pixi-pack` to recreate the original environment.\n\nIn contrast to [`conda-pack`](https://conda.github.io/conda-pack/), `pixi-pack` does not require the original conda environment to be present on the system for packing.\nInstead, it uses the lockfile to download the required packages and puts them into a `.tar` archive.\nThis archive can then be shared with others and installed using `pixi-pack unpack` to recreate the original environment.\n\nThe original motivation behind `pixi-pack` was to create a `conda-pack` alternative that does not have the same reproducibility issues as `conda-pack`.\nIt also aims to allow cross-platform building packs, so you can create a pack for `win-64` on a `linux-64` system.\n\n## 💿 Installation\n\nYou can install `pixi-pack` using `pixi`:\n\n```bash\npixi global install pixi-pack\n```\n\nOr using `cargo`:\n\n```bash\ncargo install --locked --git https://github.com/quantco/pixi-pack.git\n```\n\nOr by downloading our pre-built binaries from the [releases page](https://github.com/quantco/pixi-pack/releases).\n\nInstead of installing `pixi-pack` globally, you can also use `pixi exec` to run `pixi-pack` in a temporary environment:\n\n```bash\npixi exec pixi-pack pack\npixi exec pixi-pack unpack environment.tar\n```\n\n## 🎯 Usage\n\n### `pixi-pack pack`: Packing an environment\n\nWith `pixi-pack pack`, you can pack a conda environment into a `environment.tar` file:\n\n```bash\npixi-pack pack --manifest-file pixi.toml --environment prod --platform linux-64\n```\n\nThis will create a `environment.tar` file that contains all conda packages required to create the environment.\n\n```\n# environment.tar\n| pixi-pack.json\n| environment.yml\n| channel\n|    ├── noarch\n|    |    ├── tzdata-2024a-h0c530f3_0.conda\n|    |    ├── ...\n|    |    └── repodata.json\n|    └── linux-64\n|         ├── ca-certificates-2024.2.2-hbcca054_0.conda\n|         ├── ...\n|         └── repodata.json\n```\n\n### `pixi-pack unpack`: Unpacking an environment\n\nWith `pixi-pack unpack environment.tar`, you can unpack the environment on your target system.\nThis will create a new conda environment in `./env` that contains all packages specified in your `pixi.toml`.\nIt also creates an `activate.sh` (or `activate.bat` on Windows) file that lets you activate the environment\nwithout needing to have `conda` or `micromamba` installed.\n\n```bash\n$ pixi-pack unpack environment.tar\n$ ls\nenv/\nactivate.sh\nenvironment.tar\n$ cat activate.sh\nexport PATH=\"/home/user/project/env/bin:...\"\nexport CONDA_PREFIX=\"/home/user/project/env\"\n. \"/home/user/project/env/etc/conda/activate.d/activate_custom_package.sh\"\n```\n\n### Cross-platform packs\n\nSince `pixi-pack` just downloads the `.conda` and `.tar.bz2` files from the conda repositories, you can trivially create packs for different platforms.\n\n```bash\npixi-pack pack --platform win-64\n```\n\n\u003e [!NOTE]\n\u003e You can only `unpack` a pack on a system that has the same platform as the pack was created for.\n\n### Self-extracting binaries\n\nYou can create a self-extracting binary that contains the packed environment and a script that unpacks the environment.\nThis can be useful if you want to distribute the environment to users that don't have `pixi-pack` installed.\n\n```bash\n# unix\n$ pixi-pack pack --create-executable\n$ ls\nenvironment.sh\n$ ./environment.sh\n$ ls\nenv/\nactivate.sh\nenvironment.sh\n```\n\n```powershell\n# windows\nPS \u003e pixi-pack pack --create-executable\nPS \u003e ls\nenvironment.ps1\nPS \u003e .\\environment.ps1\nPS \u003e ls\nenv/\nactivate.sh\nenvironment.ps1\n```\n\n\u003e [!TIP]\n\u003e The produced executable is a simple shell script that contains both the `pixi-pack` binary as well as the packed environment.\n\n### Inject additional packages\n\nYou can inject additional packages into the environment that are not specified in `pixi.lock` by using the `--inject` flag:\n\n```bash\npixi-pack pack --inject local-package-1.0.0-hbefa133_0.conda --manifest-pack pixi.toml\n```\n\nThis can be particularly useful if you build the project itself and want to include the built package in the environment but still want to use `pixi.lock` from the project.\nBefore creating the pack, `pixi-pack` will ensure that the injected packages' dependencies and constraints are compatible with the packages in the environment.\n\n### PyPi support\n\nYou can also pack PyPi wheel packages into your environment.\n`pixi-pack` only supports wheel packages and not source distributions.\nIf you happen to use source distributions, you can ignore them by using the `--ignore-pypi` flag.\nThis will skip the bundling of all PyPi packages.\n\n### Cache downloaded packages\n\nYou can cache downloaded packages to speed up subsequent pack operations by using the `--use-cache` flag:\n\n```bash\npixi-pack pack --use-cache ~/.pixi-pack/cache\n```\n\nThis will store all downloaded packages in the specified directory and reuse them in future pack operations. The cache follows the same structure as conda channels, organizing packages by platform subdirectories (e.g., linux-64, win-64, etc.).\n\nUsing a cache is particularly useful when:\n\n- Creating multiple packs with overlapping dependencies\n- Working with large packages that take time to download\n- Operating in environments with limited bandwidth\n- Running CI/CD pipelines where package caching can significantly improve build times\n\n### Unpacking without `pixi-pack`\n\nIf you don't have `pixi-pack` available on your target system, you can still install the environment if you have `conda` or `micromamba` available.\nJust unarchive the `environment.tar`, then you have a local channel named `pixi-pack` on your system where all necessary packages are available.\nNext to this local channel, you will find an `environment.yml` file that contains the environment specification.\nYou can then install the environment using `conda` or `micromamba`:\n\n```bash\ntar -xvf environment.tar\nmicromamba create -p ./env --file environment.yml\n# or\nconda env create -p ./env --file environment.yml\n```\n\n\u003e [!NOTE]\n\u003e The `environment.yml` and `repodata.json` files are only for this use case, `pixi-pack unpack` does not use them.\n\n\u003e [!NOTE]\n\u003e Both `conda` and `mamba` are always installing pip as a side effect when they install python, see [`conda`'s documentation](https://docs.conda.io/projects/conda/en/25.1.x/user-guide/configuration/settings.html#add-pip-as-python-dependency-add-pip-as-python-dependency).\n\u003e This is different from how `pixi` works and can lead to solver errors when using `pixi-pack`'s compatibility mode since `pixi-pack` doesn't include `pip` by default.\n\u003e You can fix this issue in two ways:\n\u003e\n\u003e - Add `pip` to your `pixi.lock` file using `pixi add pip`.\n\u003e - Configuring `conda` (or `mamba`) to not install `pip` by default by running `conda config --set add_pip_as_python_dependency false` (or by adding `add_pip_as_python_dependency: False` to your `~/.condarc`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantco%2Fpixi-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantco%2Fpixi-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantco%2Fpixi-pack/lists"}