-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
53 lines (47 loc) · 3.07 KB
/
Copy pathpyproject.toml
File metadata and controls
53 lines (47 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 開発ツールの設定だけを置く。配布物のメタデータ(`[project]`)は持たない ——
# Chiezo は pip で配るライブラリではなく、2 つのイメージ(chiezo-app / chiezo-ingest)
# として動くアプリケーションで、依存もイメージごとに別だから(app に osmium を入れない)。
# 依存は app/requirements.in・ingest/requirements.in が正で、実際に入るバージョンは
# それをコンパイルした requirements.txt に固定してある。
[tool.pytest.ini_options]
testpaths = ["tests"]
# app/ と ingest/ を import 可能にする。以前は tests/conftest.py が sys.path を
# 書き換えていたが、それは「pytest の設定を書く場所が無い」ことの回避策だった。
# bridge/ は CLI ブリッジ(別イメージ)。CLI を起動しない部分 —— プロンプトの組み立てと
# 起動コマンドの組み方 —— はここでテストする。
# "." はテストどうしの import(`from tests.test_mcp import rpc`)のため。
# 素の `pytest` は CWD を sys.path に入れないので、これが無いと
# `python -m pytest`(CI の叩き方)でしか通らない。
pythonpath = [".", "ingest", "bridge"]
[tool.ruff]
target-version = "py312"
# 既定の 88 は、日本語のコメントが多いこのリポジトリには短すぎる(全角は 1 文字で
# 2 桁ぶんの幅を取るため)。実際の行に合わせて 120 に置く。
line-length = 120
[tool.ruff.lint]
select = ["E", "W", "F", "I", "UP", "B", "C4", "SIM", "RUF"]
ignore = [
# 全角の括弧・ダッシュ・句読点を「紛らわしい Unicode」として全部拾ってしまう。
# 日本語で書く方針(CLAUDE.md)と正面から衝突するため落とす。
"RUF001",
"RUF002",
"RUF003",
]
[tool.ruff.lint.flake8-bugbear]
# FastAPI は「引数の既定値に宣言を書く」作りなので、B008(既定値で関数を呼ぶな)が
# そのまま当たる。これは回避策の余地がある間違いではなくフレームワークの書き方
# なので、指摘のほうを外す。
#
# ruff は**型注釈が不変なら B008 を出さない**ので、`str | None = Body(...)` は
# 並べなくても通る。並べる必要があるのは注釈が可変型のとき —— JSON をそのまま
# 受ける `dict | None = Body(...)` や、multipart を受ける File / Form が当たる。
extend-immutable-calls = ["fastapi.Body", "fastapi.File", "fastapi.Form"]
[tool.ruff.lint.per-file-ignores]
# 自動生成のカタログ(scripts/gen_osm_regions.py / gen_wikipedia_editions.py が作る)。
# 行が長いのは国名・言語名がそのまま入るからで、手で折り返す対象ではない。
"ingest/sources/osm_regions.py" = ["E501"]
"ingest/sources/wikipedia_editions.py" = ["E501"]
[tool.ruff.lint.isort]
# app はパッケージ(リポジトリ直下)、ingest は単一モジュール(core / sources / lookup)。
# 指定しないと第三者パッケージ扱いになり、並びが実態と食い違う。
known-first-party = ["app", "core", "lookup", "server", "sources"]