[Feature]: use __all__
for modules
#1686
Labels
category: enhancement
improvements of code or code behavior
help wanted: good first issue
request for community contributions that are good for new contributors
priority: medium
non-critical problem and/or affecting only a small set of NWB users
Milestone
What would you like to see added to PyNWB?
Python allows you to use
__all__
to indicate the public interface of a module. This is commonly used for thefrom x import *
pattern, where it limits the returned classes to those listed in the__all__
list.While I don't necessarily recommend using that import pattern, I still think
__all__
would be useful, because it informs the user what public classes are defined in that module. I have a current situation where I would like to import all of the neurodata types implemented in a module. Simply using thedir()
command, I get all of the neurodata types that are imported into the module, as well as a bunch of double underscore functions, which I do not want.__all__
lists are used on many popular packages, such as sci-kit learn: https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/feature_extraction/image.pyThe
__all__
list could be used in a number of ways, for instance to determine coverage of tests, mock classes, and tutorials.Is your feature request related to a problem?
No response
What solution would you like?
see above
Do you have any interest in helping implement the feature?
Yes.
Code of Conduct
The text was updated successfully, but these errors were encountered: