From 7c2e50d565bf498cf8547561a834e9be3f1d54de Mon Sep 17 00:00:00 2001 From: Jonathan Berthias Date: Fri, 24 Oct 2025 21:41:48 +0200 Subject: [PATCH 1/4] Use optional dependencies instead of dependency groups --- .github/workflows/coverage.yml | 16 +++------ .github/workflows/integration-test.yml | 34 ++++--------------- .../update-packages-and-documentation.yml | 25 +++----------- CHANGELOG.md | 2 +- INSTALL.md | 4 +-- docs/build.rst | 4 +-- pyproject.toml | 9 +++-- 7 files changed, 24 insertions(+), 70 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f76b23162..769780ed6 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -36,11 +36,7 @@ jobs: - name: Prepare python environment run: | python -m pip install --upgrade pip - if python -m pip help install | grep -q -- '--group'; then - python -m pip install --group coverage - else - python -m pip install networkx cython pytest-cov numpy - fi + python -m pip install ".[coverage]" - name: Install PySCIPOpt run: | @@ -51,15 +47,11 @@ jobs: - name: Run pyscipopt tests run: | sudo apt-get install tzdata locales -y && sudo locale-gen pt_PT && sudo update-locale # add pt_PT locale that is used in tests - if python -m pip help install | grep -q -- '--group'; then - coverage run -m pytest -nauto - coverage combine - else - coverage run -m pytest - fi + coverage run -m pytest -nauto + coverage combine coverage report -m coverage xml - + - name: Upload to codecov.io uses: codecov/codecov-action@v2 with: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index c80db0a85..c3d948d7e 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -34,22 +34,14 @@ jobs: - name: Prepare python environment run: | python -m pip install --upgrade pip - if python -m pip help install | grep -q -- '--group'; then - python -m pip install --group test-full - else - python -m pip install networkx pytest-cov numpy - fi + python -m pip install ".[test]" - name: Install PySCIPOpt run: python -m pip install . - name: Run pyscipopt tests run: | - if python -m pip help install | grep -q -- '--group'; then - py.test -nauto - else - py.test - fi + py.test -nauto Windows-test: env: @@ -77,13 +69,8 @@ jobs: - name: Prepare python environment shell: powershell run: | - $pipHelp = python -m pip help install - if ($pipHelp -match '--group') { - python -m pip install --group test-full - } - else { - python -m pip install wheel cython networkx pytest-cov - } + python -m pip install --upgrade pip + python -m pip install ".[test]" - name: Install PySCIPOpt shell: powershell @@ -94,12 +81,7 @@ jobs: - name: Run pyscipopt tests shell: powershell run: | - $pipHelp = python -m pip help install - if ($pipHelp -match '--group') { - py.test -nauto - } else { - py.test - } + py.test -nauto MacOS-test: runs-on: macos-latest @@ -125,11 +107,7 @@ jobs: - name: Prepare python environment run: | python -m pip install --upgrade pip - if python -m pip help install | grep -q -- '--group'; then - python -m pip install --group test-full - else - python -m pip install networkx pytest-cov pytest numpy - fi + python -m pip install ".[test]" - name: Install PySCIPOpt run: | diff --git a/.github/workflows/update-packages-and-documentation.yml b/.github/workflows/update-packages-and-documentation.yml index 7164ba3d5..00fdd4b20 100644 --- a/.github/workflows/update-packages-and-documentation.yml +++ b/.github/workflows/update-packages-and-documentation.yml @@ -49,22 +49,14 @@ jobs: - name: Prepare python environment run: | python -m pip install --upgrade pip - if python -m pip help install | grep -q -- '--group'; then - python -m pip install --group test-full - else - python -m pip install wheel cython networkx pytest-cov - fi + python -m pip install ".[test]" - name: Install PySCIPOpt run: python -m pip install . - name: Run pyscipopt tests run: | - if python -m pip help install | grep -q -- '--group'; then - py.test -nauto - else - py.test - fi + py.test -nauto windows-test: needs: release-integration-test @@ -94,11 +86,8 @@ jobs: shell: powershell run: | python -m pip install --upgrade pip - if python -m pip help install | grep -q -- '--group'; then - python -m pip install --group test-full - else - python -m pip install wheel cython networkx pytest-cov - fi + python -m pip install ".[test]" + - name: Install PySCIPOpt shell: powershell run: | @@ -107,11 +96,7 @@ jobs: - name: Run pyscipopt tests shell: powershell run: | - if python -m pip help install | grep -q -- '--group'; then - py.test -nauto - else - py.test - fi + py.test -nauto deploy-packages-and-generate-documentation: diff --git a/CHANGELOG.md b/CHANGELOG.md index b4d64a6d1..2555e455d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - Implemented all binary operations between MatrixExpr and GenExpr - Fixed the type of @ matrix operation result from MatrixVariable to MatrixExpr. ### Changed -- Add a PEP 735 dependency group for test dependencies in `pyproject.toml` +- Add package extras for test dependencies in `pyproject.toml` - Speed up MatrixVariable.sum(axis=None) via quicksum - MatrixVariable now supports comparison with Expr ### Removed diff --git a/INSTALL.md b/INSTALL.md index ca8b1a66f..9ea5f1803 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -117,9 +117,9 @@ Testing new installation To test your brand-new installation of PySCIPOpt you need some dependencies which can be installed via pip. The testing -dependencies are in the `test` dependency group. +dependencies are in the `test` extra. - pip install --group test + pip install ".[test]" Tests can be run in the `PySCIPOpt` directory with: : diff --git a/docs/build.rst b/docs/build.rst index 062c636cc..6e44e4881 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -179,11 +179,11 @@ Testing the Installation To test your brand-new installation of PySCIPOpt you need to install some dependencies via pip. The testing dependencies are in -the `test` dependency group. +the `test` extra. .. code-block:: bash - pip install --group test + pip install ".[test]" Tests can be run in the PySCIPOpt directory with the commands: diff --git a/pyproject.toml b/pyproject.toml index e56a4b6df..1661fae90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,17 +26,16 @@ dynamic = ["version"] [project.urls] Homepage = "https://github.com/SCIP-Interfaces/PySCIPOpt" -[dependency-groups] +[project.optional-dependencies] test = [ "pytest", "pytest-xdist", -] -test-full = [ - {"include-group" = "test" }, "networkx", # only needed for a few tests ] coverage = [ - { "include-group" = "test-full" }, + "pytest", + "pytest-xdist", + "networkx", "coverage", "cython", ] From a7b1fba9dd4a26934f2949fcef3f964a3d668619 Mon Sep 17 00:00:00 2001 From: Jonathan Berthias Date: Fri, 24 Oct 2025 21:44:43 +0200 Subject: [PATCH 2/4] Fix release pipeline --- .github/workflows/update-packages-and-documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-packages-and-documentation.yml b/.github/workflows/update-packages-and-documentation.yml index 00fdd4b20..73121b7e3 100644 --- a/.github/workflows/update-packages-and-documentation.yml +++ b/.github/workflows/update-packages-and-documentation.yml @@ -100,7 +100,7 @@ jobs: deploy-packages-and-generate-documentation: - needs: Windows-test + needs: windows-test runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -135,4 +135,4 @@ jobs: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} verbose: true - packages_dir: dist/ \ No newline at end of file + packages_dir: dist/ From 42ead97ea861ab2b3510c0ab99d8e0f1b35fedb6 Mon Sep 17 00:00:00 2001 From: Jonathan Berthias Date: Fri, 24 Oct 2025 21:45:00 +0200 Subject: [PATCH 3/4] Force run integration tests --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index c3d948d7e..13588331d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -6,8 +6,8 @@ env: # runs on branches and pull requests; doesn't run on tags. on: push: - branches: - - 'master' + # branches: + # - 'master' jobs: From 1ffddf3a821a80dd447fb13f47d7612d477fc6e7 Mon Sep 17 00:00:00 2001 From: Jonathan Berthias Date: Fri, 24 Oct 2025 21:46:02 +0200 Subject: [PATCH 4/4] Revert "Force run integration tests" This reverts commit 42ead97ea861ab2b3510c0ab99d8e0f1b35fedb6. --- .github/workflows/integration-test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 13588331d..88481db7b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -3,11 +3,10 @@ name: Integration test env: version: 9.2.0 -# runs on branches and pull requests; doesn't run on tags. on: push: - # branches: - # - 'master' + branches: + - 'master' jobs: