-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpyproject.toml
199 lines (161 loc) · 6.08 KB
/
pyproject.toml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
[tool.poetry]
name = "annofabapi"
version = "0.0.0" # `poetry-dynamic-versioning`を使ってGitHubのバージョンタグを取得している。変更不要
description = "Python Clinet Library of Annofab WebAPI (https://annofab.com/docs/api/)"
authors = ["Kurusugawa Computer Inc."]
license = "MIT"
keywords=["annofab", "api"]
readme="README.md"
repository="https://github.com/kurusugawa-computer/annofab-api-python-client"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Utilities",
"Operating System :: OS Independent",
]
[tool.poetry.dependencies]
python = "^3.9"
requests = "*"
python-dateutil = "*"
backoff="*"
dataclasses-json="*"
more-itertools = "*"
numpy = {version = "*", optional=true}
pillow={version="*", optional=true }
pydantic = "^2"
[tool.poetry.extras]
# 塗りつぶし画像を扱うためのオプション
segmentation = ["numpy", "pillow"]
[tool.poetry.group.test.dependencies]
pytest = "^8"
pytest-xdist = "*"
pytest-cov = "*"
[tool.poetry.group.linter.dependencies]
# pythonバージョンを指定している理由:lintは開発環境と同じPythonバージョンで実行するため。また古いPythonバージョンにサポートしていないライブラリのバージョンがあるため
ruff = {version="^0.9", python = ">=3.12"}
mypy = {version="^1", python = ">=3.12"}
pylint = {version="^3", python = ">=3.12"}
# type stub package
types-requests = "*"
types-python-dateutil = "*"
types-dataclasses = "*"
[tool.poetry.group.documentation.dependencies]
sphinx = {version="^8", python = ">=3.12"}
pydata-sphinx-theme = {version="*", python = ">=3.12"}
[tool.poetry.group.dev]
# 開発するときのみ必要なライブラリ。インストールしなくても開発はできるので、オプショナルにする
optional = true
[tool.poetry.group.dev.dependencies]
ipython = "*"
# wheelファイルをビルドすると時間がかかるため、python3.13のwheelファイルが存在するバージョンを明示する
numpy = {version = ">=2.1", python = ">=3.13"}
[tool.mypy]
# スタブが無いパッケージのエラーは無視させる.サードパーティのライブラリに型情報がないケースもあるため
ignore_missing_imports = true
# 型ヒントが付いていない関数もチェックする
check_untyped_defs = true
plugins = ["numpy.typing.mypy_plugin"]
exclude = [
'annofabapi/pydantic_models/.*\.py',
]
[tool.ruff]
target-version = "py39"
line-length = 150
exclude = [
"annofabapi/__init__.py",
]
[tool.ruff.lint]
exclude = [
'annofabapi/pydantic_models/.*\.py',
]
ignore = [
"FA100", # `future-rewritable-type-annotation` : Python3.8をサポートしている間は無視する。
"PD002", #すでにpandasで`inplace=True`はいろんなところで使っているため
"RUF001", # 全角記号など`ambiguous unicode character`も使いたいため
"RUF002",# 全角記号など`ambiguous unicode character`も使いたいため
"RUF003",# 全角記号など`ambiguous unicode character`も使いたいため
"PLC1901", # compare-to-empty-string : `if a == "`のように空文字列で直接比較したいときがあるため
"PLR2004", # magic-value-comparison: listのサイズで判定するときがよくあるため
"ANN002", # missing-type-args
"ANN003", # missing-type-kwargs
"ERA", # : 役立つこともあるが、コメントアウトしていないコードも警告されるので無視する
"TD", # flake8-todos
"FIX", # flake8-fixme
"SIM108", # if-else-block-instead-of-if-exp, 三項演算子が読みにくい場合もあるので無視する
# 以下のルールはコードに合っていないので無効化した
"RSE", # flake8-raise
"D", # pydocstyle, Docstringを中途半端にしか書いていないので、除外する
"C90", # mccabe
"T20", # flake8-print
"SLF", # flake8-self
"BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"TRY", # tryceratops
"COM", # flake8-commas
"S", # flake8-bandit
"EM",#flake8-errmsg
"EXE", # flake8-executable
"ICN", # flake8-import-conventions
"RET", #flake8-return
"TCH", # flake8-type-checking
"PTH", #pathlibを使わないコードが多いので、除外する
"ISC", #flake8-implicit-str-concat
"N", # pep8-naming
"PT", # flake8-pytest-style
]
select = [
"ALL"
]
[tool.ruff.lint.per-file-ignores]
# テストコードはチェックを緩和する
"tests/**.py" = [
"PGH", # pygrep-hooks
"DTZ", # flake8-datetimez
"ANN", # flake8-annotations
"E501", # line-too-long
"RUF100", # unused-noqa
"G004", # logging-f-string
"SIM", #flake8-simplify
"PLC2401", # non-ascii-name, メソッド名に日本語を利用するため
]
# 以下のファイルは自動生成されるので、いくかのルールを無視する
"annofabapi/generated*.py" = [
"A002", # builtin-argument-shadowing
"ANN401", # any-type
"E501", # line-too-long
"W293", # blank-line-with-whitespace
"W291", # trailing-whitespace
]
"annofabapi/models.py" = [
"A002", # builtin-argument-shadowing
"ANN401", # any-type
"E501", # line-too-long
"W293", # blank-line-with-whitespace
"W291", # trailing-whitespace
]
# "annofabapi/pydantic_models/*.py" = ["ALL"]
"annofabapi/pydantic_models/*.py" = [
"A", # flake8-builtins
"E501", # line-too-long
# "W293", # blank-line-with-whitespace
# "W291", # trailing-whitespace
"UP007", # non-pep604-annotation-union
"UP006", # non-pep585-annotation
"UP035", # deprecated-import
"E402", # module-level-imports
"C4", # nnecessary-literal-set
"F841",
"ANN", # flake8-annotations
"PLR", # Pylint Refactor
"PERF", # Perflint
"F811", # redefined-while-unused
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 10
[tool.poetry-dynamic-versioning]
enable = true
[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"