forked from napari/napari
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
224 lines (205 loc) · 6.27 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
[build-system]
requires = [
"setuptools >= 42",
"wheel",
"setuptools_scm[toml]>=3.4"
]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "napari/_version.py"
[tool.briefcase]
project_name = "napari"
bundle = "com.napari"
author = "napari"
url = "https://napari.org/"
license = "BSD license"
# version populated in bundle.py
version = "0.0.1"
[tool.briefcase.app.napari]
formal_name = "napari"
description = "napari: a multi-dimensional image viewer"
sources = ['napari']
icon = "napari/resources/icon"
# populated in bundle.py
requires = []
[tool.black]
target-version = ['py38', 'py39', 'py310']
skip-string-normalization = true
line-length = 79
exclude = '''
(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| examples
| vendored
| _vendor
)/
| napari/resources/qt.py
| tools/minreq.py
)
'''
[tool.check-manifest]
ignore = [
"bundle.py",
".cirrus.yml",
".pre-commit-config.yaml",
"asv.conf.json",
"codecov.yml",
"Makefile",
"napari/_version.py", # added during build by setuptools_scm
"tools/minreq.py",
"tox.ini",
"napari/_qt/qt_resources/_qt_resources_*.py",
"*.pyi", # added by make typestubs
"binder/*",
".env_sample",
".devcontainer/*",
"napari/resources/icons/_themes/*/*.svg"
]
[tool.ruff]
line-length = 79
select = [
"E", "F", "W", #flake8
"UP", # pyupgrade
"I", # isort
"YTT", #flake8-2020
"TCH", # flake8-type-checing
"BLE", # flake8-blind-exception
"B", # flake8-bugbear
"A", # flake8-builtins
"C4", # flake8-comprehensions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PIE", # flake8-pie
"COM", # flake8-commas
"SIM", # flake8-simplify
"INP", # flake8-no-pep420
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"TID", # flake8-tidy-imports # replace absolutify import
"TRY", # tryceratops
"ICN", # flake8-import-conventions
"RUF", # ruff specyfic rules
]
ignore = [
"E501", "UP006", "TCH001", "TCH002", "TCH003",
"A003", # flake8-builtins - we have class attributes violating these rule
"COM812", # flake8-commas - we don't like adding comma on single line of arguments
"SIM117", # flake8-simplify - we some of merged with statements are not looking great with black, reanble after drop python 3.9
"Q000",
"RET504", # not fixed yet https://github.com/charliermarsh/ruff/issues/2950
"TRY003", # require implement multiple exception class
"RUF005", # problem with numpy compatybility, see https://github.com/charliermarsh/ruff/issues/2142#issuecomment-1451038741
"B028", # need to be fixed
"PYI015", # it produces bad looking files (@jni opinion)
]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".mypy_cache",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"*vendored*",
"*_vendor*",
]
target-version = "py38"
fix = true
[tool.ruff.per-file-ignores]
"napari/_vispy/__init__.py" = ["E402"]
"**/_tests/*.py" = ["B011", "INP001", "TRY301", "B018"]
"napari/utils/_testsupport.py" = ["B011"]
"tools/test_strings.py" = ["F401"]
"tools/**" = ["INP001", "T20"]
"examples/**" = ["INP001", "T20"]
"bundle.py" = ["T20"]
"**/vendored/**" = ["TID"]
[tool.ruff.flake8-quotes]
docstring-quotes = "double"
[tool.ruff.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[tool.ruff.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true
[tool.ruff.isort]
known-first-party=['napari']
combine-as-imports = true
[tool.ruff.flake8-import-conventions]
[tool.ruff.flake8-import-conventions.extend-aliases]
# Declare a custom alias for the `matplotlib` module.
"dask.array" = "da"
xarray = "xr"
[tool.pytest.ini_options]
# These follow standard library warnings filters syntax. See more here:
# https://docs.python.org/3/library/warnings.html#describing-warning-filters
addopts = "--maxfail=5 --durations=10 -rXxs"
# NOTE: only put things that will never change in here.
# napari deprecation and future warnings should NOT go in here.
# instead... assert the warning with `pytest.warns()` in the relevant test,
# That way we can clean them up when no longer necessary
filterwarnings = [
"error:::napari", # turn warnings from napari into errors
"error:::test_.*", # turn warnings in our own tests into errors
"default:::napari.+vendored.+", # just print warnings inside vendored modules
"ignore:Restart required for this change:UserWarning:napari", # triggered by a lot of async tests
"ignore::DeprecationWarning:shibokensupport",
"ignore::DeprecationWarning:ipykernel",
"ignore::DeprecationWarning:tensorstore",
"ignore:Accessing zmq Socket:DeprecationWarning:jupyter_client",
"ignore:pythonw executable not found:UserWarning:",
"ignore:data shape .* exceeds GL_MAX_TEXTURE_SIZE:UserWarning",
"ignore:For best performance with Dask arrays in napari:UserWarning:",
"ignore:numpy.ufunc size changed:RuntimeWarning",
"ignore:Multiscale rendering is only supported in 2D. In 3D, only the lowest resolution scale is displayed",
"ignore:Alternative shading modes are only available in 3D, defaulting to none",
"ignore:distutils Version classes are deprecated::",
"ignore:There is no current event loop:DeprecationWarning:",
]
markers = [
"sync_only: Test should only be run synchronously",
"async_only: Test should only be run asynchronously",
"examples: Test of examples",
"disable_qthread_start: Disable thread start in this Test",
"disable_qthread_pool_start: Disable strarting QRunnable using QThreadPool start in this Test",
"disable_qtimer_start: Disable timer start in this Test",
"disable_qanimation_start: Disable animation start in this Test",
]
[tool.mypy]
files = "napari"
ignore_missing_imports = true
exclude = [
"_tests",
]
show_error_codes = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = true
plugins = "numpy.typing.mypy_plugin, pydantic.mypy"
# # maybe someday :)
# disallow_any_generics = true
# no_implicit_reexport = true
# disallow_untyped_defs = true