Python 포맷팅과 pre-commit 설정

맥락:
- Python 코드만 대상으로 Ruff 기반 format/lint와 pre-commit hook을 도입한다.
- Cython game.pyx는 Ruff 대상에서 제외해 포맷터 충돌을 피한다.

변경:
- ruff와 pre-commit dev dependency 및 Ruff 설정을 추가했다.
- pre-commit config와 Python format/check 스크립트를 추가했다.
- Ruff format/check --fix 결과로 Python import 정렬과 포맷을 적용했다.

확인:
- uv sync --extra gui
- uv run pre-commit run --all-files
- scripts/check-python.sh
- uv run lost-cities-classic
This commit is contained in:
2026-05-06 19:59:07 +09:00
parent b43bb5917f
commit 12b59211b2
14 changed files with 282 additions and 123 deletions
+13
View File
@@ -23,7 +23,9 @@ lost-cities-classic = "coolrl_lost_cities.games.classic:main"
[dependency-groups]
dev = [
"cython>=3.0",
"pre-commit>=4.0.0",
"pytest>=9.0.3",
"ruff>=0.8.0",
]
[build-system]
@@ -40,3 +42,14 @@ include = ["coolrl_lost_cities*"]
"fixtures/*.json",
"docs/*.md",
]
[tool.ruff]
line-length = 100
target-version = "py311"
extend-exclude = [
"src/coolrl_lost_cities/games/classic/game.pyx",
]
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B"]
ignore = ["E501"]