C.W.K.
Stream
Lesson 03 of 05 · published

Daily pixi Commands

~12 min · pixi, commands, workflow

Level 0Newbie
0 XP0/55 lessons0/16 achievements
0/80 XP to next level80 XP to go0% complete

pixi's CLI mirrors Cargo / npm / uv. Most muscle memory transfers.

pixi init <dir> creates a project (pixi.toml + .gitignore). pixi add <pkg> adds a conda-forge package. pixi add --pypi <pkg> adds a PyPI package (resolved via uv). pixi add --feature dev <pkg> adds to a feature group (pixi's equivalent of dev deps). pixi remove <pkg> removes one.

pixi run <cmd> runs a command in the project's environment — no manual activation. pixi run python script.py, pixi run pytest, pixi run jupyter lab all just work. pixi shell opens an interactive shell with the env active.

pixi global install <tool> installs a CLI tool globally with isolated deps — replaces Homebrew for many CLI tools you'd otherwise install via brew. pixi global list shows them. pixi global remove <tool> uninstalls.

pixi list shows packages installed in this project. pixi tree shows the dependency tree. pixi search <name> finds packages.

Code

Modern pixi workflow — new project·bash
# Bootstrap
pixi init myproject && cd myproject

# Add conda-forge packages
pixi add python=3.12 numpy pandas matplotlib jupyterlab

# Add PyPI packages (resolved via uv internally)
pixi add --pypi flask requests

# Add dev-only deps to a feature group
pixi add --feature dev pytest ruff mypy

# Run things — no activate needed
pixi run python -c "import numpy; print(numpy.__version__)"
pixi run pytest
pixi run jupyter lab

# Or pop into an interactive shell
pixi shell
Tasks — replaces Makefile·toml
# pixi.toml — define common operations as tasks
[tasks]
train = "python train.py"
test = "pytest -v"
lint = "ruff check ."
fmt = "ruff format ."
start = { cmd = "python serve.py", depends_on = ["train"] }

# Then:
#   pixi run train
#   pixi run test
#   pixi run start    ← runs train first (depends_on), then start
pixi global — replace Homebrew CLI tools·bash
# Install CLI tools globally with isolated deps
pixi global install ripgrep bat fd gh
pixi global install --pypi httpie

# Each tool gets its own private env — never conflicts with anything
pixi global list
pixi global upgrade --all

External links

Exercise

Bootstrap a project with pixi: 'pixi init test && cd test && pixi add python pytorch -c pytorch && pixi run python -c "import torch; print(torch.__version__)"'. Look at pixi.toml and pixi.lock — that's the full reproducibility story for a CUDA-capable env.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.