GEMScienceTools / gmpe-smtk

Python and OpenQuake-based Toolkit for Analysis of Strong Motions and Interpretation of GMPEs
GNU Affero General Public License v3.0
43 stars 33 forks source link

moves load_database into sm_database #118

Closed rizac closed 3 years ago

rizac commented 3 years ago

Fixes a problem whereby numpy had to be installed before the program could be installed. This is fine if OpenQuake is already installed, but it breaks third-party installations like eGSIM, making their installation still feasible but cumbersome.

What happens is that setup.py needs numpy because smtk/__init__.py implements a load_database function. After inspection, that function:

  1. has no essential rationale to be imported during installation (from smtk import load_database is handy, not essential)
  2. regardless of this issue, it really looks like being in the wrong place now, in account of the fact that it refers to only one of the two "databases" implemented in smtk

This PR then moves load_database into the sm_database module, removes unnecessary imports in smtk/__init__.py (avoiding numpy import), and fixed tests

rizac commented 3 years ago

Looks good to me

wtf that was fast. Thanks 👍