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 GitHub Actions testing #54

Merged
merged 11 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "Bot"
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

name: Tests

on:
pull_request:
push:

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Setup Micromamba
uses: mamba-org/provision-with-micromamba@v14
with:
environment-file: false

- name: Install GFortran macOS
if: contains(matrix.os, 'macos')
# available gfotran are: 8, 9, and 10 (latest)
run: |
ln -s /usr/local/bin/gfortran-10 /usr/local/bin/gfortran
which gfortran

- name: Python ${{ matrix.python-version }}
shell: bash -l {0}
run: >
micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge
&& micromamba activate TEST
&& pip install -e . --no-deps --force-reinstall

- name: Tests
shell: bash -l {0}
run: |
micromamba activate TEST
pytest -s -rxs -v src
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools>=42,<60", "setuptools_scm[toml]>=3.4", "oldest-supported-numpy"]
build-backend = "setuptools.build_meta"
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mpmath
pytest
6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Add your requirements here like:
six
numpy>=1.4
numpy>=1.19
numdifftools>=0.2
scipy>=1.1
scipy>=1.7
matplotlib
mpmath
numba
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
[metadata]
summary = Wave Analysis for Fatigue and Oceanography
author = WAFO-group
author-email = none
author_email = none
license = GPLv3
license_file = LICENSE.txt
home-page = http://www.maths.lth.se/matstat/wafo/
home_page = http://www.maths.lth.se/matstat/wafo/
long_description = file: README.rst, CHANGELOG.rst, LICENSE.txt
long_description_content_type = text/x-rst
# Add here all kinds of additional classifiers as defined under
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers =
Development Status :: 4 - Beta
Programming Language :: Python
Programming Language :: Python :: 3.5
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
Environment :: Console
Intended Audience :: Education
Intended Audience :: Science/Research
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
from numpy.distutils.misc_util import Configuration
from distutils.command.sdist import sdist

pkg_resources.require('setuptools>=39.2') # setuptools >=38.3.0 # version with most `setup.cfg` bugfixes
ROOT = os.path.abspath(os.path.dirname(__file__))
PACKAGE_NAME = 'wafo'

Expand Down
2 changes: 1 addition & 1 deletion src/wafo/covariance/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from ..containers import PlotData
from ..misc import sub_dict_select, nextpow2 # , JITImport
from .. import spectrum as _wafospec
from scipy.sparse.linalg.dsolve.linsolve import spsolve
from scipy.sparse.linalg import spsolve
from scipy.sparse.base import issparse
from scipy.signal.windows import parzen
# _wafospec = JITImport('wafo.spectrum')
Expand Down
8 changes: 6 additions & 2 deletions src/wafo/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
Misc
'''

import collections
try:
from collections.abc import Callable
except ImportError:
from collections import Callable

import fractions
import numbers
import sys
Expand Down Expand Up @@ -244,7 +248,7 @@ def check_shapes(condlist, funclist):
out = np.full(shape, fillvalue, dtype)
for cond, func in zip(condlist, funclist):
if cond.any():
if isinstance(func, collections.Callable):
if isinstance(func, Callable):
temp = tuple(np.extract(cond, arr) for arr in arrays) + args
np.place(out, cond, func(*temp, **kw))
else: # func is a scalar value or a array
Expand Down
4 changes: 2 additions & 2 deletions src/wafo/stats/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#
from copy import copy
from functools import partial
from ._distn_infrastructure import entropy, rv_discrete, rv_continuous, rv_frozen
from ._distn_infrastructure import rv_discrete, rv_continuous, rv_frozen

from scipy.stats import _continuous_distns
from scipy.stats import _continuous_distns, entropy
from scipy.stats import _discrete_distns
from scipy.stats._constants import _EULER
# from scipy.stats._continuous_distns import *
Expand Down
6 changes: 3 additions & 3 deletions src/wafo/stats/estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import scipy.stats as ss
from scipy.stats._distn_infrastructure import rv_frozen as _rv_frozen
from scipy import special
from scipy.linalg import pinv2
from scipy.linalg import pinv
from scipy import optimize
from scipy.special import expm1 # pylint: disable=no-name-in-module
import numpy as np
Expand Down Expand Up @@ -1290,11 +1290,11 @@ def _invert_hessian(self, hessian):
if somefixed:
allfixed = np.all(np.isfinite(self.par_fix))
if not allfixed:
pcov = -pinv2(hessian[self.i_notfixed, :][..., self.i_notfixed])
pcov = -pinv(hessian[self.i_notfixed, :][..., self.i_notfixed])
for row, i in enumerate(list(self.i_notfixed)):
par_cov[i, self.i_notfixed] = pcov[row, :]
else:
par_cov = -pinv2(hessian)
par_cov = -pinv(hessian)
return par_cov

def _compute_cov(self, par):
Expand Down