Skip to content

Test only changed subpackages - #8103

Merged
stefanv merged 35 commits into
scikit-image:mainfrom
blink1073:test-only-changed-modules
May 14, 2026
Merged

stefanv merged 35 commits into
scikit-image:mainfrom
blink1073:test-only-changed-modules

Conversation

@blink1073

@blink1073 blink1073 commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Simplified version of #7749 that only tests directly changed subpackage(s).

Credit for this feature goes to @mdhaber.

The purpose of the change is to vastly accelerate CI.
The method is to detect which subpackages are touched by a PR, and to only test them.
A side benefit is that if we merge a change that passes with this flag but produces error(s) in test for dependent modules on merge, we will get auto-generated issues that can identify any gaps in the test suite for a given module.

We also make sure that changes in one top level module trigger unit and doctests in the mirrored module (e.g. a change in src/skimage1/morphology triggers tests.skimage2.morphology.

This PR aims to measure the speed-up that can be achieved, consider the robustness of the approach, and identify any oversights.

I addressed the open comments on the modified files from #7749.

First I verified that there are no tests run in 6d7bf9a when there was no diff. "No modified skimage modules detected.".

Then I verified that only the expected docs/pytest are run in fa0303e: "python -P -m pytest --doctest-plus --config-file /Users/runner/work/scikit-image/scikit-image/pyproject.toml tests/skimage/morphology src/skimage/morphology tests/skimage2/morphology src/_skimage2/morphology". Both the pytest and doctests were run for both packages. The total test time step was 20s vs 4m31s for the equivalent platform and python version.

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

...

@greptile-apps

greptile-apps Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Reviews (8): Last reviewed commit: "fix handling of the base_ref" | Re-trigger Greptile

Comment thread .spin/cmds.py Resolved
Comment thread .spin/cmds.py Resolved
Comment thread .github/workflows/test-autodepends.yaml Resolved
Comment thread .github/workflows/test-autodepends.yaml Resolved
@blink1073

Copy link
Copy Markdown
Contributor Author

Question: Should we be also including the test/doc module from the other version (e.g. if something changes in skimage1, also run the doctest/test module for skimage2, and vice versa).

@blink1073

Copy link
Copy Markdown
Contributor Author

Kicking the build to see if the single MacOS intel error was a fluke.

@blink1073 blink1073 closed this Mar 27, 2026
@blink1073 blink1073 reopened this Mar 27, 2026
@blink1073 blink1073 changed the title Test only changed modules Test only changed subpackages Mar 27, 2026
@blink1073 blink1073 closed this Mar 30, 2026
@blink1073 blink1073 reopened this Mar 30, 2026
Comment thread .github/workflows/test-autodepends.yaml Resolved
@blink1073

blink1073 commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Suggested way to operationalize this:

Add the --test-modified flag if the trigger is a pull_request and the commit message does not start with "test-all". Another option is to apply a label to the PR for testing all submodules.

Comment thread .spin/cmds.py Resolved
@greptile-apps

greptile-apps Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

Reviews (11): Last reviewed commit: "Merge branch 'main' into test-only-chang..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (19): Last reviewed commit: "address review" | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (20): Last reviewed commit: "fix handling of git base ref" | Re-trigger Greptile

@blink1073
blink1073 marked this pull request as ready for review May 9, 2026 14:31

@stefanv stefanv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, again :)

Comment thread src/skimage/morphology/_flood_fill.py Resolved
@stefanv

stefanv commented May 14, 2026

Copy link
Copy Markdown
Member

(I don't think the emoji should affect run-all-tests being recognized, but worth checking.)

@stefanv

stefanv commented May 14, 2026

Copy link
Copy Markdown
Member

Linux tests: ~1m
MacOS tests: 7m, 3m (that 7m expected?)
Windows tests: ~14m 👀 <-- BUT it did only run the requested tests

Installing clang took 8m! Can we avoid that?

@blink1073

Copy link
Copy Markdown
Contributor Author

Installing clang took 8m! Can we avoid that?

I believe we should be able to, I'll follow up on that.

@blink1073 blink1073 added the 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR label May 14, 2026
@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (21): Last reviewed commit: "address review" | Re-trigger Greptile

Comment thread .github/workflows/test-windows.yaml Resolved
@blink1073 blink1073 added 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR and removed 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR labels May 14, 2026
@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (22): Last reviewed commit: "fix handling of label" | Re-trigger Greptile

@blink1073

Copy link
Copy Markdown
Contributor Author

I made the following updates:

  • Fixed the handling of the label and verified that it works
  • Addressed the greptile concern about out-of-tree builds
  • Removed the trigger comments

It should be good to go now

@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (23): Last reviewed commit: "remove debug comments" | Re-trigger Greptile

Comment on lines +87 to +88
- name: Install spin
run: pip install spin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unpinned spin version will diverge from macOS/Windows

pip install spin installs whatever the latest published version is. macOS and Windows both receive spin==0.13 via setup-build-env.sh → requirements/build.txt. If a future spin release changes any of the internal APIs used in .spin/cmds.py (e.g. spin.cmds.meson._set_pythonpath, spin.util.extend_command), Linux CI will fail or behave differently from the other platforms with no clear signal as to why. Pin the version to match requirements/build.txt.

Suggested change
- name: Install spin
run: pip install spin
- name: Install spin
run: pip install "$(grep '^spin' requirements/build.txt)"

@stefanv
stefanv merged commit bf5a46f into scikit-image:main May 14, 2026
27 checks passed
@stefanv

stefanv commented May 14, 2026

Copy link
Copy Markdown
Member

Awesome, let's give it a try!

@stefanv stefanv added this to the 0.27 milestone May 14, 2026
matthew-brett added a commit that referenced this pull request May 19, 2026
* origin/main:
  Use standard C99 static inline instead of `__inline` (#8159)
  Fix structural_similarity win_size / gaussian_weights conflict (#8162)
  Unwrap seed refactor (#8142)
  ci: Remove llvm build and add ccache support on windows (#8164)
  Document warn_external in contributing guide (#8163)
  CI: Fix emscripten dependencies and clean up wheel test commands (#8147)
  Test only changed subpackages (#8103)
  Fix nightlies: update deprecated scipy call, fix underdetermined test
  Fix minkowski distanced invocation for SciPy >= 1.18 (#8157)
  Port `structural_similarly` to ski2 (#8104)
  make spin build requirement a lower bound (#8158)
matthew-brett added a commit to matthew-brett/scikit-image that referenced this pull request May 21, 2026
* origin/main: (254 commits)
  Refactor, document migration utilities (scikit-image#8184)
  ci: improve handling of pr labels (scikit-image#8169)
  Doctest migration in PRs & on all platforms (scikit-image#8141)
  Update SKIP 4 (import hierarchy, backporting, testing) (scikit-image#8097)
  One page per function / class in HTML docs for skimage2 (scikit-image#8154)
  Pin minimum pytest to 9 (scikit-image#8174)
  docs: make source install instructions more discoverable and add build requirements to top level requirements file (scikit-image#8165)
  Drop `--maxfail=5` from local pytest config (scikit-image#8170)
  Use standard C99 static inline instead of `__inline` (scikit-image#8159)
  Fix structural_similarity win_size / gaussian_weights conflict (scikit-image#8162)
  Unwrap seed refactor (scikit-image#8142)
  ci: Remove llvm build and add ccache support on windows (scikit-image#8164)
  Document warn_external in contributing guide (scikit-image#8163)
  CI: Fix emscripten dependencies and clean up wheel test commands (scikit-image#8147)
  Test only changed subpackages (scikit-image#8103)
  Fix nightlies: update deprecated scipy call, fix underdetermined test
  Fix minkowski distanced invocation for SciPy >= 1.18 (scikit-image#8157)
  Port `structural_similarly` to ski2 (scikit-image#8104)
  make spin build requirement a lower bound (scikit-image#8158)
  Drop Python 3.11 Support (scikit-image#8153)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants