Skip to content

Commit

Permalink
change to "src" layout structure (#21)
Browse files Browse the repository at this point in the history
+ change the package structure to the "src" layout as recommended by standard python packaging practice

+ setup.py: update to the new structure

+ version.py: update date to today for the GitHub release

+ tests: update & comment out the obsolete path setup
  • Loading branch information
yunjunz authored Nov 11, 2021
1 parent c75da2b commit e9bad8e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from numpy.distutils.core import setup, Extension

# specify fortran extensions to build with numpy.f2py
solid_ext = Extension(name='pysolid.solid', sources=['pysolid/solid.for'])
solid_ext = Extension(name='pysolid.solid', sources=['src/pysolid/solid.for'])

setup(
name='pysolid',
Expand All @@ -33,7 +33,8 @@
keywords="solid Eartth tides, deformation, geodesy, geophysics",

# package discovery
packages=setuptools.find_packages(),
packages=setuptools.find_packages("src"), # include all packages under src
package_dir={"": "src"}, # tell distutils packages are under src

# build fortran deps with numpy.f2py
ext_modules=[solid_ext],
Expand All @@ -50,10 +51,7 @@
# data files
include_package_data=True,
package_data={
"pysolid": [
"solid.for",
"solid.cpython*.so",
],
"pysolid": ["solid.for"],
},

project_urls={
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions pysolid/version.py → src/pysolid/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
Tag('0.1.0', '2021-01-22'),
Tag('0.1.1', '2021-02-01'),
Tag('0.1.2', '2021-02-24'),
Tag('0.2.0', '2021-11-09'),

Tag('0.2.0', '2021-11-10'),
)

# latest release
Expand Down
7 changes: 4 additions & 3 deletions tests/test_SET_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import sys
import datetime as dt

# setup path for the package
pysolid_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(pysolid_path)
## setup path for the package
#from pathlib import Path
#pysolid_path = Path(__file__).absolute().parent.parent.joinpath('src')
#sys.path.append(pysolid_path)
import pysolid


Expand Down
7 changes: 4 additions & 3 deletions tests/test_SET_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import sys
import datetime as dt

# setup path for the package
pysolid_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(pysolid_path)
## setup path for the package
#from pathlib import Path
#pysolid_path = Path(__file__).absolute().parent.parent.joinpath('src')
#sys.path.append(pysolid_path)
import pysolid


Expand Down

0 comments on commit e9bad8e

Please sign in to comment.