-
Notifications
You must be signed in to change notification settings - Fork 123
/
pyproject.toml
133 lines (119 loc) · 2.9 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
# ╔═══════╗
# ║ tests ║
# ╚═══════╝
[tool.pytest.ini_options]
minversion = "6.0"
# Since `--doctest-modules` requires specifying `dapper`,
# it means pytest won't discover `test` dir on its own.
# So to run all tests, do `pytest tests`.
addopts = """
--ignore=tests/test_plotting.py
--ignore=tests/test_demos.py
--doctest-modules dapper
--ignore-glob=**/QG/*
--ignore-glob=**/magic.py
--ignore-glob=**/autoscaler.py
--ignore-glob=**/demo.py
--ignore-glob=**/illust_*.py
--ignore-glob=dapper/mods/KS/compare_schemes.py
--ignore=dapper/mods/explore_props.py
"""
# mpl uses distutils (deprecated in python>=3.10).
# The warning only prints via pytest.
# Silence until mpl is upgraded (when Colab does so).
filterwarnings = [
'ignore:distutils:DeprecationWarning',
]
[tool.coverage.run]
branch = true # stricter
source = ["dapper"]
#omit = ["bad_file.py"]
[tool.coverage.report]
ignore_errors = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:"
]
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py3{7,8,9}
toxworkdir={homedir}/.tox
[testenv]
platform = linux|darwindeps
deps = {toxinidir}
extras = test
setenv =
IS_TOX = true
commands =
pytest {posargs}
"""
# ╔══════╗
# ║ ruff ║
# ╚══════╝
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
"scripts",
".git",
".ipynb_checkpoints",
".pyenv",
".pytest_cache",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"build",
"dist",
"site-packages",
"venv",
".*", "README.*", "docs/examples/*", "autoscaler.py",
]
# Same as Black.
line-length = 88
indent-width = 4
# Assume Python 3.9
target-version = "py39"
[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
# "SIM", # flake8-simplify
"I", # isort
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
ignore = [
"B905", # zip w/o explicit `strict=` (active if target-version>=3.10)
]
[tool.ruff.lint.per-file-ignores]
"dapper/da_methods/{ensemble,variational}.py" = [
"B023" # Function definition does not bind loop variable
]
"tests/test_{example_2,data}.py" = [
"E501", # "line too long"
"W291", # "trailing whitespace"
]
"**/__init__.py" = [
"F401", # "imported but unused"
"E402", # "module level import not at top of file"
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"