convexengineering / gplibrary

Useful subsystem models
MIT License
10 stars 11 forks source link

subpackages not included in gpkitmodels import #108

Closed whoburg closed 6 years ago

whoburg commented 7 years ago

It looks like the subpackages of gpkitmodels aren't included when importing gpkitmodels. Is this what we want? I'm guessing it could be changed by tweaking setup.py. Best illustrated in this interactive session:

In [1]: import gpkitmodels

In [2]: dir(gpkitmodels)
Out[2]: ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']

In [3]: gpkitmodels.GP
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-915047163da3> in <module>()
----> 1 gpkitmodels.GP

AttributeError: 'module' object has no attribute 'GP'

In [4]: import gpkitmodels.GP

In [5]: dir(gpkitmodels.GP)
Out[5]: ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']

In [6]: gpkitmodels.GP.aircraft
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-e9f598e6705e> in <module>()
----> 1 gpkitmodels.GP.aircraft

AttributeError: 'module' object has no attribute 'aircraft'

In [7]: import gpkitmodels.GP.aircraft

Note that this behavior appears to be the same whether gpkitmodels is installed using python setup.py install or using pip install -e gpkitmodels.

@edfan any suggestions on best practices here?

bqpd commented 7 years ago

We're use find_packages to automatically scan right now, and it works when called in that directory. My guess is that the setup script needs to be re-run, debugging.

bqpd commented 7 years ago

find_packages() works when I run it, but not when pip does...

bqpd commented 6 years ago

This is working now.