C.W.K.
Stream
Lesson 01 of 13 · published

Python CI

~13 min · python, pytest, setup-python

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

2026 의 default Python pipeline

2026 Python 생태계는 5 년 전과 달라. uv (Astral) 가 대부분 workflow 에서 pip + virtualenv 대체. ruff 가 flake8/isort/black 대체. Type 은 pyrightmypy. Test runner 는 pytest 가 표준. pyproject.toml 이 config 중앙화.

Default Python CI 모양:

  1. Checkout.
  2. uv 설치 (빠르고 단일 binary).
  3. uv syncpyproject.toml + lockfile 에서 deps 설치.
  4. ruff check + ruff format --check — lint + format gate.
  5. mypy 또는 pyright — type-check.
  6. pytest — coverage 와 함께 test.

편의보다 pin 이 중요

Python 항상 pin: python-version: '3.12', '3.x' 나 공백 안 됨. uv 도 pin: astral-sh/setup-uv@v3 특정 버전. 밑 tool 이 새 release ship 할 때마다 drift 하는 CI 는 금요일 오후에 신뢰 못 해.

Code

uv 기반 Python CI (2026 표준)·yaml
name: ci
on: { pull_request: {}, push: { branches: [main] } }
permissions: read-all
concurrency: { group: ci-${{ github.ref }}, cancel-in-progress: true }

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v3
        with:
          version: '0.5.x'
          enable-cache: true
      - name: Install Python
        run: uv python install 3.12
      - name: Sync deps
        run: uv sync --all-extras --dev
      - name: Lint
        run: uv run ruff check .
      - name: Format check
        run: uv run ruff format --check .
      - name: Type check
        run: uv run mypy src
      - name: Test
        run: uv run pytest -q --cov=src --cov-report=xml

External links

Exercise

프로젝트가 아직 CI 에 pip 쓰면 uv 로 바꿔. 마이그레이션 전후 시간 재. ~50 deps 프로젝트 에서 차이는 보통 run 당 30-60 초.

Progress

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

댓글 0

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

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