본문 바로가기
C.W.K.
Stream
Lesson 03 of 05 · published

매일 치는 pixi 명령

~12 min · pixi, commands, workflow

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

pixi 명령은 Cargo, npm, uv와 닮아 있어서 기존 사용 습관을 대부분 그대로 옮길 수 있어.

pixi init <dir>은 pixi.toml과 .gitignore를 가진 프로젝트를 만들어. pixi add <pkg>는 conda-forge 패키지를 추가하고, pixi add --pypi <pkg>는 uv를 통해 PyPI 패키지를 추가해. pixi add --feature dev <pkg>는 pixi에서 개발 의존성에 해당하는 dev feature에 넣고, pixi remove <pkg>는 제거해.

pixi run <cmd>은 별도 활성화 없이 프로젝트 환경에서 명령을 실행해. pixi run python script.py, pixi run pytest, pixi run jupyter lab이 모두 바로 작동해. 환경이 활성화된 대화형 셸이 필요하면 pixi shell을 써.

pixi global install <tool>은 각자 격리된 의존성을 가진 CLI 도구를 전역 설치해. 평소 Homebrew로 설치할 여러 명령 도구를 대신할 수 있어. pixi global list는 목록을 보여 주고 pixi global remove <tool>는 제거해.

pixi list는 프로젝트에 설치된 패키지를, pixi tree는 의존성 트리를 보여 줘. pixi search <name>으로 패키지를 찾을 수 있어.

Code

새 프로젝트를 위한 현대 pixi 작업 흐름·bash
# 부트스트랩
pixi init myproject && cd myproject

# conda-forge 패키지 추가
pixi add python=3.12 numpy pandas matplotlib jupyterlab

# PyPI 패키지 추가 (내부적으로 uv 통해 resolve)
pixi add --pypi flask requests

# dev-only deps 를 feature 그룹에
pixi add --feature dev pytest ruff mypy

# 실행 — activate 안 필요
pixi run python -c "import numpy; print(numpy.__version__)"
pixi run pytest
pixi run jupyter lab

# 또는 인터랙티브 shell 로
pixi shell
Makefile을 대신하는 tasks·toml
# pixi.toml — 보통 작업을 task 로 정의
[tasks]
train = "python train.py"
test = "pytest -v"
lint = "ruff check ."
fmt = "ruff format ."
start = { cmd = "python serve.py", depends_on = ["train"] }

# 그 다음:
#   pixi run train
#   pixi run test
#   pixi run start    ← train 먼저 (depends_on), 그 다음 start
Homebrew CLI 도구를 대신하는 pixi global·bash
# isolated deps 와 CLI 도구 글로벌 install
pixi global install ripgrep bat fd gh
pixi global install --pypi httpie

# 각 도구가 자기 private env 받음 — 절대 충돌 없음
pixi global list
pixi global upgrade --all

External links

Exercise

'pixi init test && cd test && pixi add python pytorch -c pytorch && pixi run python -c "import torch; print(torch.__version__)"'으로 프로젝트를 시작해. pixi.toml과 pixi.lock을 읽고 CUDA까지 확장할 수 있는 환경의 재현성 구성을 살펴봐.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.