-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
190 lines (168 loc) · 5.58 KB
/
Copy pathpyproject.toml
File metadata and controls
190 lines (168 loc) · 5.58 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
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
[build-system]
requires = ["uv_build>=0.12.5,<0.13"]
build-backend = "uv_build"
[project]
name = "optimal-classification-cutoffs"
version = "2.0.1"
description = "Utilities for computing optimal classification cutoffs for binary and multiclass classification"
readme = "README.md"
license = "MIT"
license-files = ["LICENSE"]
dependencies = [
"numpy>=1.20.0",
"scipy",
"scikit-learn",
]
authors = [
{name = "Gaurav Sood", email = "contact@gsood.com"}
]
requires-python = ">=3.12"
keywords = [
"classification",
"threshold",
"cutoff",
"f1-score",
"cost-sensitive-learning",
"machine-learning",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Mathematics",
]
[project.urls]
Homepage = "https://github.com/finite-sample/optimal-classification-cutoffs"
Documentation = "https://finite-sample.github.io/optimal-classification-cutoffs/"
Repository = "https://github.com/finite-sample/optimal-classification-cutoffs"
Changelog = "https://github.com/finite-sample/optimal-classification-cutoffs/blob/master/CHANGELOG.md"
[tool.uv.build-backend]
module-name = "optimal_cutoffs"
module-root = "."
[tool.ruff]
line-length = 88
target-version = "py312"
exclude = [
"docs/",
"*.ipynb", # Exclude Jupyter notebooks
]
[tool.ruff.lint]
external = ["DOC"]
select = [
"E", "W", "F", "I", "B", "C4", "UP", "N", "D", "S", "SIM", "T20", "PT", "RUF",
"PTH", "RET", "PIE", "FURB", "PERF", "DTZ", "LOG", "G", "TC", "FLY",
"RSE", "SLOT", "FA", "A", "EXE", "ICN", "PGH", "PLE", "ARG", "SLF",
]
# D203/D213: the google convention the fleet standard picks. W191/D206/D300:
# ruff's own docs list these as always incompatible with `ruff format`, which
# the standard also runs.
ignore = ["D203", "D213", "W191", "D206", "D300"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
# Unused fixture arguments and private-member access are how tests are written.
# N802/N806: test names and locals carry the same maths notation as the code
# under test (D for the utility denominator, P for a probability matrix).
# T201: several suites print diagnostics; pytest captures them.
"tests/**" = ["S101", "D", "ARG", "SLF", "B007", "N802", "N803", "N806", "T201", "PT017"]
"docs/**" = ["D"]
# The single-letter names here are the notation the surrounding docstrings and
# error messages use: A/B/D for the Bayes utility differences, P for a
# probability matrix, P/N for total positive and negative weight.
"optimal_cutoffs/bayes_core.py" = ["N806"]
"optimal_cutoffs/expected.py" = ["N806"]
"optimal_cutoffs/metrics_core.py" = ["N806", "ARG001"]
# Every metric in the registry is called with the same (tp, tn, fp, fn)
# signature whether or not it reads all four; the numba stand-ins mirror
# numba's own decorator signature; y_true and n_samples are part of published
# signatures and documented as unused (see their docstrings).
"optimal_cutoffs/binary.py" = ["ARG001"]
"optimal_cutoffs/core.py" = ["ARG001"]
"optimal_cutoffs/numba_utils.py" = ["ARG001"]
"optimal_cutoffs/optimize.py" = ["ARG001"]
[tool.pytest.ini_options]
filterwarnings = [
# Suppress specific expected warnings in tests
"ignore:Multiclass probabilities don't sum to 1.0:UserWarning",
"ignore:unique_scan with micro averaging uses independent:UserWarning",
"ignore:invalid value encountered in divide:RuntimeWarning",
]
[tool.coverage.run]
source = ["optimal_cutoffs"]
[tool.pyright]
include = ["optimal_cutoffs"]
typeCheckingMode = "standard"
[dependency-groups]
# For examples and visualizations
examples = ["matplotlib", "pandas", "ipywidgets"]
# For performance optimization
performance = ["numba>=0.57.0"]
# For adaptive optimization methods
adaptive = ["scikit-optimize>=0.9.0"]
# For documentation generation
docs = [
"sphinx>=8",
"py-canon @ git+https://github.com/gojiplus/py-canon@v1",
"furo",
# myst-nb pulls myst-parser in and renders docs/examples/*.ipynb without
# the pandoc binary nbsphinx required.
"myst-nb>=1.1",
"sphinx-copybutton",
"matplotlib",
"pandas",
"ipywidgets",
]
dev = [
"ruff>=0.14",
"pyright>=1.1.390",
"pre-commit>=4",
"pydoclint>=0.5.0",
{ include-group = "test" },
]
# numba stays out: it is exercised through the optional 'performance' group.
test = [
"pytest>=8",
"pytest-cov>=6",
"hypothesis>=6.0",
"psutil>=5.0",
"matplotlib>=3.10.7",
"pandas>=2.3.3",
]
# All optional dependencies
all = [
"matplotlib",
"pandas",
"numba>=0.57.0",
"scikit-optimize>=0.9.0",
"psutil>=5.0"
]
[tool.pydoclint]
style = "google"
arg-type-hints-in-docstring = false
check-return-types = false
check-class-attributes = false
allow-init-docstring = true
exclude = '\.venv|tests|docs'
check-arg-order = true
should-document-star-arguments = true
ignore-underscore-args = true
ignore-private-args = false
show-filenames-in-every-violation-message = true
[tool.deptry]
# Exclude specific paths from analysis
exclude = [".venv", "build", "dist", ".*\\.ipynb$"]
extend_exclude = ["tests", "examples", "docs"]
known_first_party = ["optimal_cutoffs"]
# Package name to module name mappings
[tool.deptry.package_module_name_map]
scikit-optimize = "skopt"
ipywidgets = "ipywidgets"
psutil = "psutil"
[tool.deptry.per_rule_ignores]
# DEP004: Allow optional performance dependency in specific file
DEP004 = ["numba"]
# DEP003: Allow transitive dependencies in examples/notebooks
DEP003 = ["IPython"]