Skip to content

Commit

Permalink
modernize repo
Browse files Browse the repository at this point in the history
  • Loading branch information
keurfonluu committed Jun 5, 2023
1 parent 04b6fa1 commit 69db22d
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build documentation

on:
push:
branches:
- master
pull_request:

jobs:
docs:

runs-on: ubuntu-latest
steps:
- uses: nschloe/action-cached-lfs-checkout@v1
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install toughio
run: |
git lfs pull
pip install -e .[full]
- name: Install dependencies
run: |
pip install -r doc/requirements.txt
- name: Sphinx build
run: |
sphinx-build -b html doc/source doc/build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/build/
force_orphan: true
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esbonio.sphinx.confDir": ""
}
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sphinx-argparse
sphinx-gallery
pydata-sphinx-theme
sphinxcontrib-bibtex
-e git://github.com/Naeka/pybtex-apa-style.git#egg=pybtex-apa-style
pybtex-apa-style
1 change: 1 addition & 0 deletions evodcinv/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
16 changes: 8 additions & 8 deletions evodcinv/__about__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
try:
from importlib import metadata
except ImportError:
import importlib_metadata as metadata
import pathlib

try:
__version__ = metadata.version("evodcinv")
except Exception:
__version__ = "unknown"
__all__ = [
"__version__",
]


with open(f"{pathlib.Path(__file__).parent}/VERSION") as f:
__version__ = f.readline().strip()
8 changes: 6 additions & 2 deletions evodcinv/_io/h5/_h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def write(filename, result, compression_opts=4):
with h5py.File(filename, "w") as f:
for k, v in result.items():
if np.ndim(v) == 0:
f.create_dataset(k, data=(v,), compression="gzip", compression_opts=compression_opts)
f.create_dataset(

Check warning on line 45 in evodcinv/_io/h5/_h5.py

View check run for this annotation

Codecov / codecov/patch

evodcinv/_io/h5/_h5.py#L45

Added line #L45 was not covered by tests
k, data=(v,), compression="gzip", compression_opts=compression_opts
)

else:
f.create_dataset(k, data=v, compression="gzip", compression_opts=compression_opts)
f.create_dataset(

Check warning on line 50 in evodcinv/_io/h5/_h5.py

View check run for this annotation

Codecov / codecov/patch

evodcinv/_io/h5/_h5.py#L50

Added line #L50 was not covered by tests
k, data=v, compression="gzip", compression_opts=compression_opts
)
6 changes: 5 additions & 1 deletion evodcinv/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,11 @@ def _misfit_function(self, x, curves):

else:
ell = Ellipticity(
thickness, velocity_p, velocity_s, density, dc=dc,
thickness,
velocity_p,
velocity_s,
density,
dc=dc,
)
rel = ell(curve.period, mode=curve.mode)
dcalc = np.abs(rel.ellipticity)
Expand Down
7 changes: 6 additions & 1 deletion evodcinv/_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,12 @@ def get_y(thickness, velocity_p, velocity_s, density):

def get_y(thickness, velocity_p, velocity_s, density):
ell = Ellipticity(
thickness, velocity_p, velocity_s, density, "dunkin", dc,
thickness,
velocity_p,
velocity_s,
density,
"dunkin",
dc,
)
rel = ell(period, mode)

Expand Down
1 change: 0 additions & 1 deletion github_deploy_key_keurfonluu_evodcinv.enc

This file was deleted.

4 changes: 3 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
black
build
docformatter
invoke
isort
pytest
pytest-cov
pytest-cov
twine
15 changes: 10 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = evodcinv
version = 2.0.1
version = file: evodcinv/VERSION
author = Keurfon Luu
email = keurfonluu@outlook.com
description = Inversion of dispersion curves using Evolutionary Algorithms
Expand All @@ -19,10 +19,11 @@ classifiers =
Intended Audience :: Science/Research
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Physics
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11

[options]
packages = find:
Expand All @@ -34,8 +35,12 @@ install_requires =
h5py
progress
disba >= 0.6.1
stochopy >= 2.2.0
python_requires = >= 3.6
stochopy >= 2.3.0
python_requires = >= 3.7
setup_requires =
setuptools >= 42
wheel
wheel

[options.package_data]
evodcinv =
VERSION
13 changes: 10 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def build(c):
c.run("python -m build --sdist --wheel .")


@task
def html(c):
c.run("sphinx-build -b html doc/source doc/build")


@task
def tag(c):
c.run("git tag v{}".format(evodcinv.__version__))
Expand All @@ -30,6 +35,8 @@ def clean(c, bytecode=False):
"build",
"dist",
"evodcinv.egg-info",
"doc/build",
"doc/source/examples",
]

if bytecode:
Expand All @@ -45,8 +52,8 @@ def clean(c, bytecode=False):

@task
def black(c):
c.run("black -t py36 evodcinv")
c.run("black -t py36 test")
c.run("black -t py38 evodcinv")
c.run("black -t py38 tests")


@task
Expand All @@ -57,7 +64,7 @@ def docstring(c):
@task
def isort(c):
c.run("isort evodcinv")
c.run("isort test")
c.run("isort tests")


@task
Expand Down
6 changes: 5 additions & 1 deletion test/helpers.py → tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@
optimizer="cpso",
misfit="rmse",
density="nafe-drake",
optimizer_args={"popsize": 5, "maxiter": 5, "seed": 0,},
optimizer_args={
"popsize": 5,
"maxiter": 5,
"seed": 0,
},
)
File renamed without changes.

0 comments on commit 69db22d

Please sign in to comment.