-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
294 lines (260 loc) · 8.56 KB
/
pyproject.toml
File metadata and controls
294 lines (260 loc) · 8.56 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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "docplex-extensions"
description = "Custom data structures and user-friendly functions for modeling with DOcplex"
readme = "README.md"
license = { file = "LICENSE" }
authors = [{ name = "Samarth Mistry", email = "samarth.mistry@gmail.com" }]
dynamic = ["version"]
requires-python = ">=3.10"
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
]
dependencies = ["typing_extensions>=4.10.0", "docplex>=2.25.236"]
[project.optional-dependencies]
cplex-runtime = ["cplex>=20.1.0.4"]
tests = [
"pytest>=8.1.1",
"coverage>=7.4.4",
"pytest-cov>=4.1.0",
"pytest-randomly>=3.15.0",
"mypy[faster-cache]>=1.13.0",
"pandas>=1.5.0", # for pandas accessor
"pandas-stubs>=1.5.0", # for pandas accessor
]
docs = [
"Sphinx==8.0.2",
"sphinx-autosummary-accessors==2023.4.0",
"numpydoc==1.8.0",
"ansys-sphinx-theme==1.0.3",
"sphinx_design==0.6.1",
"sphinx_gallery==0.17.1",
"matplotlib==3.9.2", # for sphinx_gallery to run py fies
"numpy<2.0", # for compatibility with matplotlib
"pandas>=1.5.0", # for pandas accessor
"pandas-stubs>=1.5.0", # for pandas accessor
]
dev = [
"ruff>=0.7.0",
"pre-commit>=3.8.0",
"tox>=4.14.1",
"docplex-extensions[tests]",
"docplex-extensions[docs]",
]
[project.urls]
Documentation = "https://docplex-extensions.readthedocs.io/en/stable"
"Source code" = "https://github.com/samarthmistry/docplex-extensions"
Changelog = "https://github.com/samarthmistry/docplex-extensions/releases"
[tool.setuptools.dynamic]
version = { attr = "docplex_extensions.__version__" }
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
docplex_extensions = ["py.typed"]
###### ruff ######
[tool.ruff]
line-length = 100
target-version = "py310"
[tool.ruff.lint]
select = ["F", "E", "W", "I", "D", "B", "UP", "FA"]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F403", "D212"]
"setup.py" = ["D"]
"{docs,tests,examples}/**" = ["D"]
"examples/*" = ["E402"]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.format]
quote-style = "single"
docstring-code-format = true
###### numpydoc ######
[tool.numpydoc_validation]
checks = [
"all", # All checks except those below:
"GL01", # Summary should start in the line immediately
"ES01", # Extended summary not found
"SA01", # 'See Also' section not found
"EX01", # 'Examples' section not found
"PR07", # Parameter has no description
"RT03", # Return value has no description
]
exclude = [
"\\.__", # Dunder methods
"._create", # Dunder method impl
"._setitem_idx", # Dunder method impl
"._setitem_slice", # Dunder method impl
"._get_repr_header", # repr
"._repr_pretty_", # repr
"SupportsGetItem", # Protocol
"_RAISE_KEYERROR", # Dummy
".name", # property
".names", # property
".key_name", # property
".key_names", # property
".value_name", # property
]
override_PR01 = [
"^Not supported by ", # _param_dicts.ParamDictBase.update, .fromkeys
# # _var_dicts.VarDictBase.pop, setdefault, .update, .fromkeys
"^Solve a DOcplex model ", # _model_funcs.solve
]
override_PR02 = [
"^Not supported by ", # _param_dicts.ParamDictBase.update, .fromkeys
# # _var_dicts.VarDictBase.pop, setdefault, .update, .fromkeys
"^Solve a DOcplex model ", # _model_funcs.solve
]
override_SS05 = [
"^Preprocess ", # _var_funcs._preprocess_bound
]
###### mypy ######
[tool.mypy]
python_version = "3.10"
strict = true
follow_imports = "normal"
show_error_codes = true
show_error_context = true
pretty = true
[[tool.mypy.overrides]]
module = ["docplex.mp.*"]
ignore_missing_imports = true
###### pytest ######
[tool.pytest.ini_options]
addopts = """
--doctest-modules
--doctest-continue-on-failure
--cov=docplex_extensions
--cov-report term-missing
--randomly-seed=42
"""
doctest_optionflags = "NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL"
testpaths = [
"tests", # unit tests; functional tests; doctests in helper code
"src", # doctests in source code
]
###### Coverage.py ######
[tool.coverage.report]
exclude_also = [
"find_spec", # untestable
"def _get_repr_header", # repr
"def __repr__", # repr
"def _repr_pretty_", # repr
"if TYPE_CHECKING", # typing
"@overload", # typing
"except ImportError", # optional dependency
]
###### tox ######
[tool.tox]
legacy_tox_ini = """
[tox]
min_version = 4.0
env_list = py{310,311,312,313}, mypy, cpx{2010,2210,2211,2212}, pd{15,20,X}
[gh]
python =
3.10 = py310, mypy, cpx{2010,2210,2211,2212}, pd{15,20,X}
3.11 = py311
3.12 = py312
3.13 = py313
[testenv]
description = Run doctests, unit tests, and functional tests
setenv = PY_IGNORE_IMPORTMISMATCH=1
extras =
tests
cplex-runtime
package = wheel
wheel_build_env = .pkg
commands =
pytest --basetemp="{env_tmp_dir}"
[testenv:mypy]
description = Run static type checks and typing tests
setenv = PY_IGNORE_IMPORTMISMATCH=1
extras = tests
package = wheel
commands =
mypy src
mypy tests/typing_tests
[testenv:py313]
# Since CPLEX runtime is not supported beyond python 3.12, we skip all runtime-based tests
description = Run doctests, unit tests ex. model functions, and typing tests
extras = tests
commands =
pytest --basetemp="{env_tmp_dir}" \
--ignore=tests/unit_tests/model_funcs/ \
--ignore=tests/functional_tests/ \
--ignore=src/docplex_extensions/_model_funcs.py
[testenv:cpx2010]
description = Run unit tests for model functions against CPLEX 20.1.0
basepython = 3.10
deps = cplex==20.1.0.4
extras = tests
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
tests/unit_tests/model_funcs/
[testenv:cpx2210]
description = Run unit tests for model functions against CPLEX 22.1.0
basepython = 3.10
deps = cplex==22.1.0.0
extras = tests
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
tests/unit_tests/model_funcs/
[testenv:cpx2211]
description = Run unit tests for model functions against CPLEX 22.1.1
basepython = 3.10
deps = cplex==22.1.1.2
extras = tests
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
tests/unit_tests/model_funcs/
[testenv:cpx2212]
description = Run unit tests for model functions against CPLEX 22.1.2
basepython = 3.10
deps = cplex==22.1.2.0
extras = tests
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
tests/unit_tests/model_funcs/
[testenv:pd15]
description = Run unit tests and doctests for pandas accessors against pandas 1.5
basepython = 3.10
deps =
pandas==1.5.0
numpy<2.0
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
src/docplex_extensions/_pandas_accessors.py \
tests/unit_tests/pandas_accessors \
tests/functional_tests/multicommodity_test.py
[testenv:pd20]
description = Run unit tests and doctests for pandas accessors against pandas 2.0
basepython = 3.10
deps =
pandas==2.0.0
numpy<2.0
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
src/docplex_extensions/_pandas_accessors.py \
tests/unit_tests/pandas_accessors \
tests/functional_tests/multicommodity_test.py
[testenv:pdX]
description = Run unit tests and doctests for pandas accessors against pandas latest
basepython = 3.10
deps = pandas
commands =
pytest --basetemp="{env_tmp_dir}" --no-cov \
src/docplex_extensions/_pandas_accessors.py \
tests/unit_tests/pandas_accessors \
tests/functional_tests/multicommodity_test.py
"""