Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] make __all__ and API doc more consistent #4157

Merged
merged 5 commits into from Dec 13, 2023

Conversation

Remi-Gau
Copy link
Collaborator

@Remi-Gau Remi-Gau commented Dec 13, 2023

Modules should explicitly declare the names in their public API using the __all__ attribute but that we have some things in the __all__ that is not in the API doc.

This PR fixes some issues:

  • removes functions that are in the public API of some modules but not in the doc
  • orders __all__ alphabetically to make this comparison easier in the future

Copy link
Contributor

👋 @Remi-Gau Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

@@ -2,7 +2,6 @@
check_design_matrix,
make_first_level_design_matrix,
)
from nilearn.glm.first_level.experimental_paradigm import check_events
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

check_events not in API doc

Comment on lines 5 to 9
# TODO move copy_img out of nilearn._utils..niimg
from .._utils.niimg import copy_img

# TODO move concat_niimgs out of nilearn._utils.niimg_conversions
from .._utils.niimg_conversions import concat_niimgs as concat_imgs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tempted to say that things that are part of the user facing API should NOT be in a part of the package that is private.

@@ -1,6 +1,5 @@
"""The :mod:`nilearn.maskers` contains masker objects."""

from ._utils import compute_middle_image
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

compute_middle_image not in the API doc

Comment on lines 8 to 9
# TODO consider making _get_clusters_table module public?
from nilearn.reporting._get_clusters_table import get_clusters_table
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

User facing function comes from a private module

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (af37456) 91.71% compared to head (f9f2ee0) 91.92%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4157      +/-   ##
==========================================
+ Coverage   91.71%   91.92%   +0.20%     
==========================================
  Files         145      145              
  Lines       16337    16337              
  Branches     3407     3407              
==========================================
+ Hits        14983    15017      +34     
+ Misses        810      777      -33     
+ Partials      544      543       -1     
Flag Coverage Δ
macos-latest_3.10_test_plotting 91.69% <100.00%> (ø)
macos-latest_3.11_test_plotting 91.69% <100.00%> (ø)
macos-latest_3.12_test_plotting 91.69% <100.00%> (ø)
macos-latest_3.8_test_plotting 91.66% <100.00%> (ø)
macos-latest_3.9_test_plotting 91.66% <100.00%> (ø)
ubuntu-latest_3.10_test_plotting 91.69% <100.00%> (ø)
ubuntu-latest_3.11_test_plotting 91.69% <100.00%> (ø)
ubuntu-latest_3.12_test_plotting 91.69% <100.00%> (ø)
ubuntu-latest_3.12_test_pre 91.69% <100.00%> (ø)
ubuntu-latest_3.8_test_min 68.86% <100.00%> (?)
ubuntu-latest_3.8_test_plot_min 91.42% <100.00%> (?)
ubuntu-latest_3.8_test_plotting 91.66% <100.00%> (ø)
ubuntu-latest_3.9_test_plotting 91.66% <100.00%> (ø)
windows-latest_3.10_test_plotting 91.67% <100.00%> (ø)
windows-latest_3.11_test_plotting 91.67% <100.00%> (ø)
windows-latest_3.12_test_plotting 91.67% <100.00%> (ø)
windows-latest_3.8_test_plotting 91.63% <100.00%> (ø)
windows-latest_3.9_test_plotting 91.64% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

]


class _MaskWarning(UserWarning):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Warning not used outside of this module

Comment on lines -27 to -28
"first_level",
"second_level",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note that those were duplicated.

@Remi-Gau Remi-Gau changed the title [WIP] DO NOT REVIEW - make __all__ and API doc consistent [MAINT] make __all__ and API doc more consistent Dec 13, 2023
@Remi-Gau Remi-Gau marked this pull request as ready for review December 13, 2023 10:45
Copy link
Member

@ymzayek ymzayek left a comment

Choose a reason for hiding this comment

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

I think you just need to adjust the number in test_number_public_classes

@Remi-Gau
Copy link
Collaborator Author

I think you just need to adjust the number in test_number_public_classes

thanks!!! 🤗

should be fixed now

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

LGTM, thx

@Remi-Gau Remi-Gau merged commit 9362f97 into nilearn:main Dec 13, 2023
32 checks passed
@Remi-Gau Remi-Gau deleted the public_al_init branch December 13, 2023 16:53
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.

None yet

3 participants