-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add all to init #2021
base: dev
Are you sure you want to change the base?
Add all to init #2021
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2021 +/- ##
==========================================
+ Coverage 91.73% 91.78% +0.04%
==========================================
Files 27 27
Lines 2722 2738 +16
Branches 710 710
==========================================
+ Hits 2497 2513 +16
Misses 149 149
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Could you add a CHANGELOG update?
And then I think adding the __all__
definitions has caused some issues with the Sphinx documentation:
/home/runner/work/pynwb/pynwb/docs/source/pynwb.testing.icephys_testutils.rst:2: WARNING: more than one target found for cross-reference 'NWBFile': pynwb.NWBFile, pynwb.file.NWBFile [ref.python]
I think one solution would be to update the references to use the more specific path. Could you address those warnings?
…r class references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were still some warnings in the link checker. I took a closer look and I think since the deprecated or private classes (e.g. SweepTable, BaseStorageOverride) were not included in the __all__
definitions, they were no longer being found by sphinx autodoc and so were not being documented:
/home/runner/work/pynwb/pynwb/src/pynwb/file.py:docstring of pynwb.file.NWBFile:78: WARNING: py:class reference target not found: pynwb.icephys.SweepTable [ref.class]
I found this option that we can add to the docs/source/conf.py
to solve these warnings, since I believe we still want the documentation for these classes to be accessible on readthedocs even if they are not included in the public interface:
autodoc_default_options = {
'ignore-module-all': True,
}
Fix #1686: Add
__all__
to modulesMotivation
Python allows using
__all__
to indicate the public interface of a module. This helps users understand what classes and functions are intended to be imported from each module, improves IDE auto-completion, and prevents accidental usage of internal implementation details. This change follows the pattern used by other major packages like scikit-learn.How to test the behavior?
Checklist
[x] Did you update CHANGELOG.md with your changes?
[x] Have you checked our Contributing document?
[x] Have you ensured the PR clearly describes the problem and the solution?
[x] Is your contribution compliant with our coding style? This can be checked running ruff check . && codespell from the source directory.
[x] Have you checked to ensure that there aren't other open Pull Requests for the same change?
[x] Have you included the relevant issue number using "Fix #1686" notation where XXX is the issue number?