Skip to content

Commit d2ce094

Browse files
Merge branch 'master' into fix-updating-best-sol
2 parents e19851e + 6ac699a commit d2ce094

30 files changed

+2090
-239
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ omit =
55
tests
66
__init__.py
77
scip.pyx
8+
patch = subprocess

.github/workflows/build_wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: pypa/[email protected]
4545
env:
4646
CIBW_ARCHS: ${{ matrix.arch }}
47-
CIBW_TEST_REQUIRES: pytest
47+
CIBW_TEST_GROUPS: test
4848
CIBW_TEST_COMMAND: "pytest {project}/tests"
4949
CIBW_MANYLINUX_*_IMAGE: manylinux_2_28
5050

.github/workflows/coverage.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,27 @@ jobs:
3636
- name: Prepare python environment
3737
run: |
3838
python -m pip install --upgrade pip
39-
python -m pip install networkx cython pytest-cov numpy
39+
if python -m pip help install | grep -q -- '--group'; then
40+
python -m pip install --group coverage
41+
else
42+
python -m pip install networkx cython pytest-cov numpy
43+
fi
4044
4145
- name: Install PySCIPOpt
4246
run: |
43-
export CFLAGS="-O0 -ggdb" # disable compiler optimizations for faster builds
44-
python -m pip install .
47+
export CFLAGS="-O0 -ggdb -Wall -Wextra -Werror" # Debug mode. More warnings. Warnings as errors.
48+
python -m pip install . -v 2>&1 | tee build.log
49+
grep -i "warning" build.log || true
4550
4651
- name: Run pyscipopt tests
4752
run: |
4853
sudo apt-get install tzdata locales -y && sudo locale-gen pt_PT && sudo update-locale # add pt_PT locale that is used in tests
49-
coverage run -m pytest
54+
if python -m pip help install | grep -q -- '--group'; then
55+
coverage run -m pytest -nauto
56+
coverage combine
57+
else
58+
coverage run -m pytest
59+
fi
5060
coverage report -m
5161
coverage xml
5262

.github/workflows/integration-test.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,22 @@ jobs:
3434
- name: Prepare python environment
3535
run: |
3636
python -m pip install --upgrade pip
37-
python -m pip install networkx pytest-cov numpy
37+
if python -m pip help install | grep -q -- '--group'; then
38+
python -m pip install --group test-full
39+
else
40+
python -m pip install networkx pytest-cov numpy
41+
fi
3842
3943
- name: Install PySCIPOpt
4044
run: python -m pip install .
4145

4246
- name: Run pyscipopt tests
4347
run: |
44-
py.test
48+
if python -m pip help install | grep -q -- '--group'; then
49+
py.test -nauto
50+
else
51+
py.test
52+
fi
4553
4654
Windows-test:
4755
env:
@@ -69,8 +77,13 @@ jobs:
6977
- name: Prepare python environment
7078
shell: powershell
7179
run: |
72-
python -m pip install --upgrade pip
73-
python -m pip install networkx pytest-cov numpy
80+
$pipHelp = python -m pip help install
81+
if ($pipHelp -match '--group') {
82+
python -m pip install --group test-full
83+
}
84+
else {
85+
python -m pip install wheel cython networkx pytest-cov
86+
}
7487
7588
- name: Install PySCIPOpt
7689
shell: powershell
@@ -81,7 +94,12 @@ jobs:
8194
- name: Run pyscipopt tests
8295
shell: powershell
8396
run: |
84-
py.test
97+
$pipHelp = python -m pip help install
98+
if ($pipHelp -match '--group') {
99+
py.test -nauto
100+
} else {
101+
py.test
102+
}
85103
86104
MacOS-test:
87105
runs-on: macos-latest
@@ -107,7 +125,11 @@ jobs:
107125
- name: Prepare python environment
108126
run: |
109127
python -m pip install --upgrade pip
110-
python -m pip install networkx pytest-cov pytest numpy
128+
if python -m pip help install | grep -q -- '--group'; then
129+
python -m pip install --group test-full
130+
else
131+
python -m pip install networkx pytest-cov pytest numpy
132+
fi
111133
112134
- name: Install PySCIPOpt
113135
run: |

.github/workflows/test-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Prepare python environment
2929
run: |
3030
python -m pip install --upgrade pip
31-
python -m pip install wheel cython networkx pytest-cov build
31+
python -m pip install wheel cython build
3232
3333
- name: Build package
3434
run: |

.github/workflows/update-packages-and-documentation.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,22 @@ jobs:
4949
- name: Prepare python environment
5050
run: |
5151
python -m pip install --upgrade pip
52-
python -m pip install wheel cython networkx pytest-cov
52+
if python -m pip help install | grep -q -- '--group'; then
53+
python -m pip install --group test-full
54+
else
55+
python -m pip install wheel cython networkx pytest-cov
56+
fi
5357
5458
- name: Install PySCIPOpt
5559
run: python -m pip install .
5660

5761
- name: Run pyscipopt tests
5862
run: |
59-
py.test
63+
if python -m pip help install | grep -q -- '--group'; then
64+
py.test -nauto
65+
else
66+
py.test
67+
fi
6068
6169
windows-test:
6270
needs: release-integration-test
@@ -86,7 +94,11 @@ jobs:
8694
shell: powershell
8795
run: |
8896
python -m pip install --upgrade pip
89-
python -m pip install wheel cython networkx pytest-cov
97+
if python -m pip help install | grep -q -- '--group'; then
98+
python -m pip install --group test-full
99+
else
100+
python -m pip install wheel cython networkx pytest-cov
101+
fi
90102
- name: Install PySCIPOpt
91103
shell: powershell
92104
run: |
@@ -95,7 +107,11 @@ jobs:
95107
- name: Run pyscipopt tests
96108
shell: powershell
97109
run: |
98-
py.test
110+
if python -m pip help install | grep -q -- '--group'; then
111+
py.test -nauto
112+
else
113+
py.test
114+
fi
99115
100116
101117
deploy-packages-and-generate-documentation:
@@ -117,7 +133,7 @@ jobs:
117133
- name: Prepare python environment
118134
run: |
119135
python -m pip install --upgrade pip
120-
python -m pip install wheel cython networkx pytest-cov build
136+
python -m pip install wheel cython build
121137
122138
- name: Build package
123139
run: |

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## Unreleased
44
### Added
5+
- Added basic type stubs to help with IDE autocompletion and type checking.
6+
### Fixed
7+
- Implemented all binary operations between MatrixExpr and GenExpr
8+
- Fixed the type of @ matrix operation result from MatrixVariable to MatrixExpr.
9+
### Changed
10+
- Add a PEP 735 dependency group for test dependencies in `pyproject.toml`
11+
- Speed up MatrixVariable.sum(axis=None) via quicksum
12+
- MatrixVariable now supports comparison with Expr
13+
### Removed
14+
15+
## 5.6.0 - 2025.08.26
16+
### Added
517
- More support for AND-Constraints
618
- Added support for knapsack constraints
719
- Added isPositive(), isNegative(), isFeasLE(), isFeasLT(), isFeasGE(), isFeasGT(), isHugeValue(), and tests
@@ -11,10 +23,16 @@
1123
- Wrapped SCIPgetNLPBranchCands
1224
- Added getConsVals() to get coefficients of any linear type constraint
1325
- Generalized getLhs() and getRhs() to additionally support any linear type constraint
26+
- Added recipe for getting local constraints
27+
- Added enableDebugSol() and disableDebugSol() for controlling the debug solution mechanism if DEBUGSOL=true
28+
- Added getVarPseudocostScore() and getVarPseudocost()
29+
- Added getNBranchings() and getNBranchingsCurrentRun()
1430
### Fixed
1531
- Raised an error when an expression is used when a variable is required
32+
- Fixed some compile warnings
1633
### Changed
17-
- MatrixExpr.sum() now supports axis arguments and can return either a scalar or MatrixExpr depending on the result dimensions
34+
- MatrixExpr.sum() now supports axis arguments and can return either a scalar or MatrixExpr, depending on the result dimensions.
35+
- AddMatrixCons() also accepts ExprCons.
1836
### Removed
1937

2038
## 5.5.0 - 2025.05.06

INSTALL.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,16 @@ Testing new installation
116116
========================
117117

118118
To test your brand-new installation of PySCIPOpt you need
119-
[pytest](https://pytest.org/) on your system.
119+
some dependencies which can be installed via pip. The testing
120+
dependencies are in the `test` dependency group.
120121

121-
pip install pytest
122-
123-
Here is the complete [installation
124-
procedure](https://docs.pytest.org/en/latest/getting-started.html).
122+
pip install --group test
125123

126124
Tests can be run in the `PySCIPOpt` directory with: :
127125

128126
py.test # all the available tests
129127
py.test tests/test_name.py # a specific tests/test_name.py (Unix)
128+
py.test -nauto # run tests in parallel using all available cores
130129

131130
Ideally, the status of your tests must be passed or skipped. Running
132131
tests with pytest creates the `__pycache__` directory in `tests` and,

docs/build.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,28 +168,30 @@ Build with Debug
168168
To use debug information in PySCIPOpt you need to build it with the following command:
169169

170170
.. code-block::
171-
172-
python -m pip install --install-option="--debug" .
171+
export PYSCIPOPT_DEBUG=True # With Windows CMD: set PYSCIPOPT_DEBUG=True
172+
python -m pip install .
173173
174174
.. note:: Be aware that you will need the debug library of the SCIP Optimization Suite for this to work
175175
(cmake .. -DCMAKE_BUILD_TYPE=Debug).
176176

177177
Testing the Installation
178178
==========================
179179

180-
To test your brand-new installation of PySCIPOpt you need `pytest <https://docs.pytest.org/en/stable/>`_
181-
on your system. To get pytest simply run the command:
180+
To test your brand-new installation of PySCIPOpt you need to
181+
install some dependencies via pip. The testing dependencies are in
182+
the `test` dependency group.
182183

183184
.. code-block:: bash
184185
185-
pip install pytest
186+
pip install --group test
186187
187188
Tests can be run in the PySCIPOpt directory with the commands:
188189

189190
.. code-block:: bash
190191
191192
pytest # Will run all the available tests
192193
pytest tests/test_name.py # Will run a specific tests/test_name.py (Unix)
194+
pytest -nauto # Will run tests in parallel using all available cores
193195
194196
Ideally, the status of your tests must be passed or skipped.
195197
Running tests with pytest creates the __pycache__ directory in tests and, occasionally,

pyproject.toml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ dynamic = ["version"]
2626
[project.urls]
2727
Homepage = "https://github.com/SCIP-Interfaces/PySCIPOpt"
2828

29+
[dependency-groups]
30+
test = [
31+
"pytest",
32+
"pytest-xdist",
33+
]
34+
test-full = [
35+
{"include-group" = "test" },
36+
"networkx", # only needed for a few tests
37+
]
38+
coverage = [
39+
{ "include-group" = "test-full" },
40+
"coverage",
41+
"cython",
42+
]
43+
2944
[tool.pytest.ini_options]
3045
norecursedirs = ["check"]
3146
testpaths = ["tests"]
@@ -39,16 +54,25 @@ version = {attr = "pyscipopt._version.__version__"}
3954
[tool.cibuildwheel]
4055
skip="pp*" # currently doesn't work with PyPy
4156
manylinux-x86_64-image = "manylinux_2_28"
57+
manylinux-aarch64-image = "manylinux_2_28"
4258

4359

4460
[tool.cibuildwheel.linux]
4561
skip="pp* cp36* cp37* *musllinux*"
46-
before-all = [
47-
"(apt-get update && apt-get install --yes wget) || yum install -y wget zlib libgfortran || brew install wget",
48-
"wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-linux.zip -O scip.zip",
49-
"unzip scip.zip",
50-
"mv scip_install scip"
51-
]
62+
before-all = '''
63+
#!/bin/bash
64+
(apt-get update && apt-get install --yes wget) || yum install -y wget zlib libgfortran || brew install wget
65+
AARCH=$(uname -m)
66+
echo "------"
67+
echo $AARCH
68+
if [[ $AARCH == "aarch64" ]]; then
69+
wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-linux-arm.zip -O scip.zip
70+
else
71+
wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-linux.zip -O scip.zip
72+
fi
73+
unzip scip.zip
74+
mv scip_install scip
75+
'''
5276
environment = { SCIPOPTDIR="$(pwd)/scip", LD_LIBRARY_PATH="$(pwd)/scip/lib:$LD_LIBRARY_PATH", DYLD_LIBRARY_PATH="$(pwd)/scip/lib:$DYLD_LIBRARY_PATH", PATH="$(pwd)/scip/bin:$PATH", PKG_CONFIG_PATH="$(pwd)/scip/lib/pkgconfig:$PKG_CONFIG_PATH", RELEASE="true"}
5377

5478

@@ -58,10 +82,10 @@ before-all = '''
5882
#!/bin/bash
5983
brew install wget zlib gcc
6084
if [[ $CIBW_ARCHS == *"arm"* ]]; then
61-
wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-macos-arm.zip -O scip.zip
85+
wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-macos-arm.zip -O scip.zip
6286
export MACOSX_DEPLOYMENT_TARGET=14.0
6387
else
64-
wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-macos-intel.zip -O scip.zip
88+
wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-macos-intel.zip -O scip.zip
6589
export MACOSX_DEPLOYMENT_TARGET=13.0
6690
fi
6791
unzip scip.zip
@@ -87,7 +111,7 @@ repair-wheel-command = '''
87111
skip="pp* cp36* cp37*"
88112
before-all = [
89113
"choco install 7zip wget",
90-
"wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-windows.zip -O scip.zip",
114+
"wget https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-windows.zip -O scip.zip",
91115
"\"C:\\Program Files\\7-Zip\\7z.exe\" x \"scip.zip\" -o\"scip-test\"",
92116
"mv .\\scip-test\\scip_install .\\test",
93117
"mv .\\test .\\scip"

0 commit comments

Comments
 (0)