1. 설치

curl -LsSf https://astral.sh/uv/install.sh | sh

2. 시작

# init python project
uv init --python ${PYTHON_VERSION}

# project structure
ls -a -1
.
..
.git
.gitignore
.python-version
.venv
main.py
pyproject.toml
README.md
uv.lock

3. 주요 명령어

# add python dependency
uv add {package_name}

# add python dependency for develop (e.g., black, isort, ruff)
uv add --dev {package_name}

# remove python dependency
uv remove {package_name}

# sync existing python project
uv sync

# sync existing python project without updating uv.lock
uv sync --frozen

# run python or runnable package
uv run python
uv run uvicorn api:app --port 5000
uv run jupyter lab

# uv run package without installation
uv run --with jupyterlab jupyter lab

# activate venv
source .venv/bin/activate

# deactivate venv
deactivate

Todo

  • uv 환경 container로 띄우기
  • uvx 사용 방법
  • 주요 트러블슈팅 (예: pip install -e ., torch 설치)