Skip to content

Conversation

Remi-Gau
Copy link

@Remi-Gau Remi-Gau commented Sep 22, 2025

Closes #943

Changes proposed in this pull request:

  • fix nilearn private imports
  • bump nilearn version and its transitive dependencies

Summary by Sourcery

Ensure compatibility with nilearn>=0.12.1 by updating dependency version bounds and adapting private nilearn imports

Enhancements:

  • Bump nilearn requirement to >=0.12.1 and remove upper bound
  • Upgrade nibabel, numpy, pandas, and scipy minimum versions to match nilearn’s updated dependencies
  • Refactor private imports from nilearn._utils to their new cache_mixin and niimg_conversions modules

Build:

  • Update setup.cfg install_requires with new version constraints for dependencies

Copy link
Contributor

sourcery-ai bot commented Sep 22, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the project’s dependencies to require nilearn>=0.12.1 (along with matching transitive dependencies) and refactors private nilearn import paths to align with the changes in the nilearn 0.12.1 API.

File-Level Changes

Change Details Files
Bump dependency versions in setup.cfg
  • Upgrade nibabel to >=5.2.0
  • Remove nilearn upper bound and require nilearn>=0.12.1
  • Set numpy minimum to >=1.22.4
  • Set pandas minimum to >=2.2.0
  • Set scipy minimum to >=1.8.0
setup.cfg
Refactor nilearn private imports to new module paths
  • Import CacheMixin from nilearn._utils.cache_mixin instead of nilearn._utils
  • Import check_niimg_3d from nilearn._utils.niimg_conversions instead of nilearn._utils
  • Apply corresponding import updates across multiple modules
nimare/base.py
nimare/workflows/misc.py
nimare/annotate/gclda.py
nimare/dataset.py
nimare/decode/continuous.py
nimare/decode/discrete.py
nimare/meta/ibma.py
nimare/nimads.py

Assessment against linked issues

Issue Objective Addressed Explanation
#943 Update code to avoid using private functions from nilearn that are incompatible with nilearn >= 0.12.1.
#943 Update nilearn and related dependencies in the package requirements to be compatible with nilearn >= 0.12.1.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Switching to nilearn’s private modules (cache_mixin, niimg_conversions) risks breakage on future releases—consider using public API functions or providing fallback imports.
  • Removing the upper bound on nilearn (>=0.12.1) may expose you to breaking changes in future major versions—consider adding a conservative max version or verifying compatibility in CI.
  • Bumping nibabel from >=3.x to >=5.x is a significant upgrade; double-check that there are no breaking changes affecting existing I/O workflows.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Switching to nilearn’s private modules (cache_mixin, niimg_conversions) risks breakage on future releases—consider using public API functions or providing fallback imports.
- Removing the upper bound on nilearn (>=0.12.1) may expose you to breaking changes in future major versions—consider adding a conservative max version or verifying compatibility in CI.
- Bumping nibabel from >=3.x to >=5.x is a significant upgrade; double-check that there are no breaking changes affecting existing I/O workflows.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines -14 to -20
try:
# nilearn>0.10.3
from nilearn._utils.niimg_conversions import check_same_fov
except ImportError:
# nilearn < 0.10.3
from nilearn._utils.niimg_conversions import _check_same_fov as check_same_fov

Copy link
Author

Choose a reason for hiding this comment

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

not necessary if you don't want the version bump but only fixing issues related to private functions 'namespace' in 0.12.1

Copy link
Author

Choose a reason for hiding this comment

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

some of those may not be needed if you do not pin to nilearn>=0.12.1

@Remi-Gau
Copy link
Author

test are failing because nilearn 0.12.1 does not support python 3.8 that had gone through EOL almost a year ago

@jdkent
Copy link
Member

jdkent commented Sep 22, 2025

Thanks for the PR!

@Remi-Gau could you rebase against main? that should fix the python 3.8 issue.

I've been operating under the notion to keep NiMARE permissive to several versions of nilearn, but if you think there are critical fixes in version 0.12.1 that are pertinent to how we use nilearn/y'all have a recommended software cycle of deprecating older versions of nilearn, then I would be convinced to bump up the minimum version of nilearn.

Additionally, if we bump up nilearn, there is a minimal dependency section in setup.cfg that would need to be updated:

https://github.com/neurostuff/NiMARE/pull/944/files#diff-fa602a8a75dc9dcc92261bac5f533c2a85e34fcceaff63b3a3a81d9acde2fc52R81-R90

@Remi-Gau
Copy link
Author

could you rebase against main?

done

@Remi-Gau
Copy link
Author

but if you think there are critical fixes in version 0.12.1 that are pertinent to how we use nilearn

hmm... let me double-check how nilearn is used in here...

@Remi-Gau
Copy link
Author

maybe the version bump of nilearn is not so necessary, but you would at least need to change the import changes from _utils to avoid things going "boink" with nilearn >= 0.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using nilearn private functions
2 participants