Skip to content

Commit 2bdb590

Browse files
Use optional dependencies instead of dependency groups (#1093)
* Use optional dependencies instead of dependency groups * Fix release pipeline * Force run integration tests * Revert "Force run integration tests" This reverts commit 42ead97.
1 parent 28f2185 commit 2bdb590

File tree

7 files changed

+26
-73
lines changed

7 files changed

+26
-73
lines changed

.github/workflows/coverage.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ jobs:
3636
- name: Prepare python environment
3737
run: |
3838
python -m pip install --upgrade pip
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
39+
python -m pip install ".[coverage]"
4440
4541
- name: Install PySCIPOpt
4642
run: |
@@ -51,15 +47,11 @@ jobs:
5147
- name: Run pyscipopt tests
5248
run: |
5349
sudo apt-get install tzdata locales -y && sudo locale-gen pt_PT && sudo update-locale # add pt_PT locale that is used in tests
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
50+
coverage run -m pytest -nauto
51+
coverage combine
6052
coverage report -m
6153
coverage xml
62-
54+
6355
- name: Upload to codecov.io
6456
uses: codecov/codecov-action@v2
6557
with:

.github/workflows/integration-test.yml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Integration test
33
env:
44
version: 9.2.0
55

6-
# runs on branches and pull requests; doesn't run on tags.
76
on:
87
push:
98
branches:
@@ -34,22 +33,14 @@ jobs:
3433
- name: Prepare python environment
3534
run: |
3635
python -m pip install --upgrade pip
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
36+
python -m pip install ".[test]"
4237
4338
- name: Install PySCIPOpt
4439
run: python -m pip install .
4540

4641
- name: Run pyscipopt tests
4742
run: |
48-
if python -m pip help install | grep -q -- '--group'; then
49-
py.test -nauto
50-
else
51-
py.test
52-
fi
43+
py.test -nauto
5344
5445
Windows-test:
5546
env:
@@ -77,13 +68,8 @@ jobs:
7768
- name: Prepare python environment
7869
shell: powershell
7970
run: |
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-
}
71+
python -m pip install --upgrade pip
72+
python -m pip install ".[test]"
8773
8874
- name: Install PySCIPOpt
8975
shell: powershell
@@ -94,12 +80,7 @@ jobs:
9480
- name: Run pyscipopt tests
9581
shell: powershell
9682
run: |
97-
$pipHelp = python -m pip help install
98-
if ($pipHelp -match '--group') {
99-
py.test -nauto
100-
} else {
101-
py.test
102-
}
83+
py.test -nauto
10384
10485
MacOS-test:
10586
runs-on: macos-latest
@@ -125,11 +106,7 @@ jobs:
125106
- name: Prepare python environment
126107
run: |
127108
python -m pip install --upgrade pip
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
109+
python -m pip install ".[test]"
133110
134111
- name: Install PySCIPOpt
135112
run: |

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,14 @@ jobs:
4949
- name: Prepare python environment
5050
run: |
5151
python -m pip install --upgrade pip
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
52+
python -m pip install ".[test]"
5753
5854
- name: Install PySCIPOpt
5955
run: python -m pip install .
6056

6157
- name: Run pyscipopt tests
6258
run: |
63-
if python -m pip help install | grep -q -- '--group'; then
64-
py.test -nauto
65-
else
66-
py.test
67-
fi
59+
py.test -nauto
6860
6961
windows-test:
7062
needs: release-integration-test
@@ -94,11 +86,8 @@ jobs:
9486
shell: powershell
9587
run: |
9688
python -m pip install --upgrade pip
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
89+
python -m pip install ".[test]"
90+
10291
- name: Install PySCIPOpt
10392
shell: powershell
10493
run: |
@@ -107,15 +96,11 @@ jobs:
10796
- name: Run pyscipopt tests
10897
shell: powershell
10998
run: |
110-
if python -m pip help install | grep -q -- '--group'; then
111-
py.test -nauto
112-
else
113-
py.test
114-
fi
99+
py.test -nauto
115100
116101
117102
deploy-packages-and-generate-documentation:
118-
needs: Windows-test
103+
needs: windows-test
119104
runs-on: ubuntu-22.04
120105
steps:
121106
- uses: actions/checkout@v3
@@ -150,4 +135,4 @@ jobs:
150135
user: __token__
151136
password: ${{ secrets.PYPI_API_TOKEN }}
152137
verbose: true
153-
packages_dir: dist/
138+
packages_dir: dist/

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Implemented all binary operations between MatrixExpr and GenExpr
99
- Fixed the type of @ matrix operation result from MatrixVariable to MatrixExpr.
1010
### Changed
11-
- Add a PEP 735 dependency group for test dependencies in `pyproject.toml`
11+
- Add package extras for test dependencies in `pyproject.toml`
1212
- Speed up MatrixVariable.sum(axis=None) via quicksum
1313
- MatrixVariable now supports comparison with Expr
1414
### Removed

INSTALL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ Testing new installation
117117

118118
To test your brand-new installation of PySCIPOpt you need
119119
some dependencies which can be installed via pip. The testing
120-
dependencies are in the `test` dependency group.
120+
dependencies are in the `test` extra.
121121

122-
pip install --group test
122+
pip install ".[test]"
123123

124124
Tests can be run in the `PySCIPOpt` directory with: :
125125

docs/build.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ Testing the Installation
179179

180180
To test your brand-new installation of PySCIPOpt you need to
181181
install some dependencies via pip. The testing dependencies are in
182-
the `test` dependency group.
182+
the `test` extra.
183183

184184
.. code-block:: bash
185185
186-
pip install --group test
186+
pip install ".[test]"
187187
188188
Tests can be run in the PySCIPOpt directory with the commands:
189189

pyproject.toml

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

29-
[dependency-groups]
29+
[project.optional-dependencies]
3030
test = [
3131
"pytest",
3232
"pytest-xdist",
33-
]
34-
test-full = [
35-
{"include-group" = "test" },
3633
"networkx", # only needed for a few tests
3734
]
3835
coverage = [
39-
{ "include-group" = "test-full" },
36+
"pytest",
37+
"pytest-xdist",
38+
"networkx",
4039
"coverage",
4140
"cython",
4241
]

0 commit comments

Comments
 (0)