PEP 518 이 빌드 시스템 선언에 pyproject.toml 도입; PEP 621 이 [project] 메타데이터 표준화. 오늘 거의 모든 Python 도구 — Poetry, Hatch, PDM, ruff, black, mypy, pytest, pytest-asyncio, coverage — 가 [tool.<name>] 에서 config 읽음. 한 파일이 setup.py + setup.cfg + requirements.txt + tox.ini + .flake8 대체.
Cargo.toml — Rust 의 매니페스트
모든 Rust crate 가 가짐. [package], [dependencies], [dev-dependencies], [features], [[bin]], [[bench]]. Cargo 의 도구 (build, test, publish, doc) 가 이 단일 파일에서 읽음. Workspace 가 root-level coordinator 로 [workspace] 추가.
hugo.toml / config.toml — Hugo 정적 사이트
Hugo 가 config 에 TOML 선호 (YAML 과 JSON 도 지원). 사이트 전체 설정, 메뉴 정의 (array of table — lesson 7 봐), taxonomy config, 출력 포맷 — 다 프로젝트 루트의 한 TOML 파일.
원칙: 새 도구의 config 포맷 고를 때, 청중이 이미 유지하는 거 봐. Python 개발자가 매일 pyproject.toml 만짐; Rust dev 가 매일 Cargo.toml 만짐. 근육 기억 일치가 마찰 줄임. 그 ecosystem 의 TOML 승리는 문법만큼이나 익숙함 덕.
[package]
name = "pippa-cli"
version = "0.1.0"
edition = "2021"
authors = ["C.W.K.", "Pippa"]
license = "MIT"
[dependencies]
clap = { version = "4", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
[dev-dependencies]
pretty_assertions = "1"
[[bin]]
name = "pippa"
path = "src/main.rs"
hugo.toml — 정적 사이트 config·toml
baseURL = "https://example.com"
languageCode = "en-us"
title = "My Hugo Site"
theme = "papermod"
[params]
author = "C.W.K."
description = "Where words live in markdown."
[[menu.main]]
name = "Posts"
url = "/posts/"
weight = 1
[[menu.main]]
name = "About"
url = "/about/"
weight = 2
Python 에서 pyproject.toml 읽기·python
import tomllib
with open('pyproject.toml', 'rb') as f:
cfg = tomllib.load(f)
print(cfg['project']['name']) # 'pippa'
print(cfg['tool']['ruff']['line-length']) # 100
for dep in cfg['project']['dependencies']:
print(' -', dep)
프로젝트의 pyproject.toml 열어 (또는 인기 있는 거 — Pydantic, FastAPI, ruff 골라). 모든 [tool.*] 섹션 식별. 현재 안 쓰는 도구 (mypy, ruff-isort, coverage) 하나 골라서 docs 읽고 현명한 [tool.<name>] block 작성. '모든 거 한 config 파일' 워크플로우가 TOML 이 가능하게 하는 거.
Progress
Progress is local-only — sign in to sync across devices.