prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
3.38k stars 192 forks source link
conda conda-environment conda-packages package-management package-manager package-manager-tool python-virtual-environment rust rust-lang

banner

![License][license-badge] [![Project Chat][chat-badge]][chat-url] [![Pixi Badge][pixi-badge]][pixi-url] [license-badge]: https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square [chat-badge]: https://img.shields.io/discord/1082332781146800168.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&style=flat-square [chat-url]: https://discord.gg/kKV8ZxyzY4 [pixi-badge]:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json&style=flat-square [pixi-url]: https://pixi.sh

pixi: Package Management Made Easy

Overview

pixi is a cross-platform, multi-language package manager and workflow tool built on the foundation of the conda ecosystem. It provides developers with an exceptional experience similar to popular package managers like cargo or yarn, but for any language.

Developed with ❤️ at prefix.dev. Real-time pixi_demo

Highlights

Getting Started

Status

Pixi is ready for production! We are working hard to keep file-format changes compatible with the previous versions so that you can rely on pixi with peace of mind.

Some notable features we envision for upcoming releases are:

Installation

pixi can be installed on macOS, Linux, and Windows. The provided scripts will automatically download the latest version of pixi, extract it, and move the pixi binary to ~/.pixi/bin. If this directory does not exist, the script will create it.

macOS and Linux

To install Pixi on macOS and Linux, open a terminal and run the following command:

curl -fsSL https://pixi.sh/install.sh | bash
# or with brew
brew install pixi

The script will also update your ~/.bash_profile to include ~/.pixi/bin in your PATH, allowing you to invoke the pixi command from anywhere. You might need to restart your terminal or source your shell for the changes to take effect.

Starting with macOS Catalina zsh is the default login shell and interactive shell. Therefore, you might want to use zsh instead of bash in the install command:

curl -fsSL https://pixi.sh/install.sh | zsh

The script will also update your ~/.zshrc to include ~/.pixi/bin in your PATH, allowing you to invoke the pixi command from anywhere.

Windows

To install Pixi on Windows, open a PowerShell terminal (you may need to run it as an administrator) and run the following command:

iwr -useb https://pixi.sh/install.ps1 | iex

The script will inform you once the installation is successful and add the ~/.pixi/bin directory to your PATH, which will allow you to run the pixi command from any location. Or with winget

winget install prefix-dev.pixi

Autocompletion

To get autocompletion follow the instructions for your shell. Afterwards, restart the shell or source the shell config file.

Bash (default on most Linux systems)

echo 'eval "$(pixi completion --shell bash)"' >> ~/.bashrc

Zsh (default on macOS)

echo 'eval "$(pixi completion --shell zsh)"' >> ~/.zshrc

PowerShell (pre-installed on all Windows systems)

Add-Content -Path $PROFILE -Value '(& pixi completion --shell powershell) | Out-String | Invoke-Expression'

If this fails with "Failure because no profile file exists", make sure your profile file exists. If not, create it with:

New-Item -Path $PROFILE -ItemType File -Force

Fish

echo 'pixi completion --shell fish | source' >> ~/.config/fish/config.fish

Nushell

Add the following to the end of your Nushell env file (find it by running $nu.env-path in Nushell):

mkdir ~/.cache/pixi
pixi completion --shell nushell | save -f ~/.cache/pixi/completions.nu

And add the following to the end of your Nushell configuration (find it by running $nu.config-path):

use ~/.cache/pixi/completions.nu *

Elvish

echo 'eval (pixi completion --shell elvish | slurp)' >> ~/.elvish/rc.elv

Distro Packages

Packaging status

Arch Linux

You can install pixi from the extra repository using pacman:

pacman -S pixi

Alpine Linux

pixi is available for Alpine Edge. It can be installed via apk after enabling the testing repository.

apk add pixi

Build/install from source

pixi is 100% written in Rust and therefore it can be installed, built and tested with cargo. To start using pixi from a source build run:

cargo install --locked --git https://github.com/prefix-dev/pixi.git pixi

We don't publish to crates.io anymore, so you need to install it from the repository. The reason for this is that we depend on some unpublished crates which disallows us to publish to crates.io.

or when you want to make changes use:

cargo build
cargo test

If you have any issues building because of the dependency on rattler checkout it's compile steps

Uninstall

To uninstall the pixi binary should be removed. Delete pixi from the $PIXI_DIR which is default to ~/.pixi/bin/pixi

So on Linux its:

rm ~/.pixi/bin/pixi

and on Windows:

$PIXI_BIN = "$Env:LocalAppData\pixi\bin\pixi"; Remove-Item -Path $PIXI_BIN

After this command you can still use the tools you installed with pixi. To remove these as well just remove the whole ~/.pixi directory and remove the directory from your path.

Usage

The cli looks as follows:

➜ pixi
A package management and workflow tool

Usage: pixi [OPTIONS] <COMMAND>

Commands:
  completion  Generates a completion script for a shell
  init        Creates a new project
  add         Adds a dependency to the project
  run         Runs task in project
  shell       Start a shell in the pixi environment of the project
  global      Global is the main entry point for the part of pixi that executes on the global(system) level
  auth        Login to prefix.dev or anaconda.org servers to access private channels
  install     Install all dependencies
  task        Command management in project
  info        Information about the system and project
  upload      Upload a package to a prefix.dev channel
  search      Search a package, output will list the latest version of package
  project
  help        Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose...     More output per occurrence
  -q, --quiet...       Less output per occurrence
      --color <COLOR>  Whether the log needs to be colored [default: auto] [possible values: always, never, auto]
  -h, --help           Print help
  -V, --version        Print version

Creating a pixi project

Initialize a new project and navigate to the project directory

pixi init myproject
cd myproject

Add the dependencies you want to use

pixi add cowpy

Run the installed package in its environment

pixi run cowpy "Thanks for using pixi"

Activate a shell in the environment

pixi shell
cowpy "Thanks for using pixi"
exit

Installing a conda package globally

You can also globally install conda packages into their own environment. This behavior is similar to pipx or condax.

pixi global install cowpy

Use in GitHub Actions

You can use pixi in GitHub Actions to install dependencies and run commands. It supports automatic caching of your environments.

- uses: prefix-dev/setup-pixi@v0.8.1
- run: pixi exec cowpy "Thanks for using pixi"

See the documentation for more details.

Contributing 😍

We would absolutely love for you to contribute to pixi! Whether you want to start an issue, fix a bug you encountered, or suggest an improvement, every contribution is greatly appreciated.

If you're just getting started with our project or stepping into the Rust ecosystem for the first time, we've got your back! We recommend beginning with issues labeled as good first issue. These are carefully chosen tasks that provide a smooth entry point into contributing.These issues are typically more straightforward and are a great way to get familiar with the project.

Got questions or ideas, or just want to chat? Join our lively conversations on Discord. We're very active and would be happy to welcome you to our community. [Join our discord server today!][chat-url]

Built using pixi

To see what's being built with pixi check out the Community page.