oocgcm icon indicating copy to clipboard operation
oocgcm copied to clipboard

Add imports of sub-packages to top-level __init__.py

Open spencerahill opened this issue 8 years ago • 2 comments

Without import statements of the subpackages, it's harder to play around with/experiment with oocgcm as a new user, since you can't access any of the subpackages

In [1]: import oocgcm

In [2]: dir(oocgcm)
Out[2]:
['__all__',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 '__version__',
 'version']

In [3]: oocgcm.core
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-4aa17fd422c5> in <module>()
----> 1 oocgcm.core

AttributeError: module 'oocgcm' has no attribute 'core'

In [4]: import oocgcm.core

In [5]: oocgcm.core
Out[5]: <module 'oocgcm.core' from '/Users/spencer/miniconda3/lib/python3.5/site-packages/oocgcm-0.1.0-py3.5.egg/oocgcm/core/__init__.py'>

So simply adding e.g. from . import core etc. to the top-level __init__.py would help. I'm happy to do this as a PR...are there any of the subpackages that you don't want in the public API? Otherwise I can just add them all.

spencerahill avatar Nov 06 '16 16:11 spencerahill