forked from cog-imperial/OMLT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
200 lines (181 loc) · 3.65 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
[build-system]
requires = ["setuptools", "setuptools_scm"]
build-backend = "setuptools.build_meta"
[project]
name = "omlt"
authors = [
{ name = "The OMLT Developers", email = "[email protected]" },
]
dependencies = [
"networkx",
"numpy",
# Pyomo release that included #3262 fix and has transformations for linear trees
"pyomo>=6.7.3",
"onnx",
"onnxruntime",
]
requires-python = ">=3.9"
dynamic = ["version"]
readme = "README.rst"
license = { file = "LICENSE.rst" }
description = "OMLT is a Python package for representing machine learning models (such as neural networks) within the Pyomo optimization environment."
[project.optional-dependencies]
linear-tree = ["linear-tree"]
keras = ["tensorflow", "keras"]
keras-gpu = ["tensorflow[and-cuda]", "keras"]
torch = ["torch", "torch-geometric"]
dev-tools = [
"ruff",
"mypy",
"pytest",
"pytest-cov",
"sphinx",
"sphinx-copybutton",
"build",
"twine",
"furo",
"testbook",
"notebook",
"pandas",
"matplotlib",
"gurobipy",
"torchvision",
"tf2onnx",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
"tensorflow",
"linear-tree",
]
dev = [
"omlt[dev-tools,keras,torch,linear-tree,docs]",
]
dev-gpu = [
"omlt[dev-tools,keras-gpu,torch,linear-tree,docs]",
]
[project.urls]
github = "https://github.com/cog-imperial/OMLT"
x = "https://x.com/cogimperial"
documentation = "https://omlt.readthedocs.io"
[tool.setuptools_scm]
write_to = "src/omlt/_version.py"
[tool.ruff]
line-length = 88
extend-exclude = ["src/omlt/_version.py"]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN101",
"ANN401",
"COM812",
"ISC001",
"SLF001",
"ARG001",
"N803",
"N806",
# Remove these after issue https://github.com/cog-imperial/OMLT/issues/153 is fixed.
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
# TODO: Remove these eventually
"ANN001",
"ANN002",
"ANN201",
"ANN202",
"ANN204",
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"S101",
"INP001",
]
"examples/*" = [
"INP001",
]
"docs/conf.py" = ["D100", "INP001"]
"src/omlt/neuralnet/layer.py" = ["N802"]
"docs/notebooks/data/build_sin_quadratic_csv.py" = ["INP001"]
"docs/notebooks/*" = [
"T201",
"F811",
"E402",
"ICN001",
"E501",
"PD901",
"E731",
"F841",
"FBT002",
"PTH123",
"S311",
"N812",
"A001",
"E741",
"N802",
"PERF401",
"PLR2004",
]
[tool.mypy]
show_error_codes = true
implicit_optional = false
warn_no_return = true
strict_optional = true
# TODO: Enable eventually
# disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
warn_unreachable = true
disallow_any_generics = true
[[tool.mypy.overrides]]
module = [
"pandas.*",
"networkx.*",
"tf2onnx.*",
"onnxruntime.*",
"lineartree.*",
"sklearn.*",
"testbook.*",
"pyomo.*",
"keras.*",
"tensorflow.*",
"torch_geometric.*",
]
ignore_missing_imports = true
[tool.pytest.ini_options]
addopts = "--cov omlt --cov-report term-missing --cov-config pyproject.toml --verbose"
[tool.coverage.run]
branch = true
[tool.coverage.paths]
source = [
"src/",
"*/site-packages/",
]
[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if __name__ == .__main__.:",
]