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

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

Open
spencerahill opened this issue Nov 6, 2016 · 2 comments
Open

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

spencerahill opened this issue Nov 6, 2016 · 2 comments

Comments

@spencerahill
Copy link

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.

@lesommer
Copy link
Owner

thanks spencer for the comment and for proposing the PR.
I think core should not be visible by users.
Any other (non empty) subpackage should be visible.

@spencerahill
Copy link
Author

Thanks Julien. That seems reasonable. I'll try to (eventually) put in a PR for this.

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

No branches or pull requests

2 participants