-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyproject.toml
200 lines (181 loc) · 5.08 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]
build-backend = "hatchling.build"
requires = ["hatchling", "hatch-vcs"]
[project]
name = "cvxpy-gurobi"
dynamic = ["version"]
description = "Translate CVXPY problems into gurobipy models"
readme = "README.md"
keywords = [
"cvxpy",
"gurobi",
"gurobipy",
"optimization",
]
license = "Apache-2.0"
authors = [
{ name = "Jonathan Berthias", email = "[email protected]" },
]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Mathematics",
]
dependencies = [
# "cvxpy" must be available but we don't list it
# as a dependency because cvxpy-base is sufficient
"gurobipy",
"numpy>=1.23.0",
"scipy>=1.4.0",
]
[project.urls]
Documentation = "https://github.com/jonathanberthias/cvxpy-gurobi#readme"
Issues = "https://github.com/jonathanberthias/cvxpy-gurobi/issues"
Source = "https://github.com/jonathanberthias/cvxpy-gurobi"
[tool.hatch]
version.source = "vcs"
version.raw-options = { local_scheme = "no-local-version" }
build.hooks.vcs.version-file = "src/cvxpy_gurobi/_version.py"
[tool.hatch.envs.default]
description = "Base environment for other envs to inherit from"
dependencies = [
"pytest==7.4.4",
"pytest-insta==0.2.0",
"pytest-xdist==3.6.1",
]
installer = "uv"
[tool.hatch.envs.default.scripts]
tests = [
"versions",
"pytest {args:tests}",
]
versions = [
"python --version",
"{env:HATCH_UV} pip freeze",
]
# convenience script to update the snapshots, it actually runs inside the snapshots env
update-snapshots = "hatch run snapshots:update {args}"
[tool.hatch.envs.latest]
description = "Dependencies at their most up-to-date versions"
python = "3.12"
extra-dependencies = [
"cvxpy-base==1.6.0",
"gurobipy==12.0.0",
"numpy==2.2.2",
"scipy==1.15.1",
]
[tool.hatch.envs.snapshots]
description = "The environment used to generate the snapshot LP files"
template = "latest"
scripts = { update = "pytest --insta update {args} tests/test_all.py::test_lp" }
[tool.hatch.envs.oldest]
description = "The oldest supported set of dependencies, for testing purposes"
env-vars = { UV_RESOLUTION = "lowest-direct" }
python = "3.8"
extra-dependencies = [
# we have to set a version here since cvxpy is not listed as a dependency
# we use cvxpy-base to avoid installing unnecessary dependencies
"cvxpy-base>=1.2.0",
# bundled license is expired on older versions of gurobipy
"gurobipy>=11",
]
[tool.hatch.envs.hatch-test]
extra-dependencies = [
"cvxpy-base=={matrix:cvxpy}.*",
"gurobipy=={matrix:gurobipy}.*",
"numpy{matrix:numpy:}",
"scipy{matrix:scipy:}",
"pytest-insta",
]
matrix-name-format = "{variable}{value}"
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.8"]
gurobipy = ["10"]
cvxpy = ["1.3"]
numpy = ["<2"]
scipy = ["<1.14"] # cvxpy 1.3 uses scipy features (.A) removed in 1.14
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.9"]
gurobipy = ["11"]
cvxpy = ["1.4"]
numpy = ["<2"]
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.10", "3.11", "3.12"]
gurobipy = ["11"]
cvxpy = ["1.5"]
[tool.hatch.envs.types]
description = "Type checking environment"
template = "latest"
extra-dependencies = ["mypy"]
[tool.hatch.envs.types.scripts]
check = "mypy {args:src tests}"
[tool.mypy]
strict = true
untyped_calls_exclude = ["cvxpy"]
[[tool.mypy.overrides]]
module = "scipy.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "cvxpy.*"
implicit_reexport = true
[tool.hatch.envs.hatch-static-analysis]
# https://hatch.pypa.io/latest/config/static-analysis/
config-path = "ruff_defaults.toml"
[tool.ruff]
extend = "ruff_defaults.toml"
line-length = 88
preview = true
show-fixes = true
unsafe-fixes = true
[tool.ruff.lint]
extend-ignore = [
"S101", # asserts used for type narrowing
]
extend-select = [
"NPY",
]
exclude = [
"src/cvxpy_gurobi/_version.py", # autogenerated by hatch-vcs
]
[tool.ruff.lint.extend-per-file-ignores]
"src/cvxpy_gurobi/translation.py" = [
"N802", # visitor uses uppercase letters in method names
"PLR2004", # 'magic' constants are not that annoying
]
"tests/*" = [
"FBT001", # bool positional arguments are necessary with parametrized tests
"INP001", # no __init__.py in tests
"N806", # uppercase letters for matrices
]
[tool.ruff.lint.isort]
force-single-line = true
known-first-party = ["cvxpy_gurobi", "test_problems"]
[tool.ruff.format]
skip-magic-trailing-comma = true
[tool.pytest.ini_options]
pythonpath = "tests"
[tool.coverage.run]
source_pkgs = ["cvxpy_gurobi"]
branch = true
dynamic_context = "test_function"
omit = [
"*/_version.py", # autogenerated by hatch-vcs
]
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
"@overload",
]
show_missing = true
[tool.coverage.html]
show_contexts = true