diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a1bf7e35..716cb6fd 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -49,7 +49,7 @@ jobs: - python-version: "3.10" name: full os: ubuntu - conda: "numba 'matplotlib>=3.3' scipy scooby pytest-mpl" + conda: "numba 'matplotlib>=3.3' scipy pytest-mpl" test: "--mpl" - python-version: "3.11" name: plain @@ -59,7 +59,7 @@ jobs: - python-version: "3.11" name: full os: ubuntu - conda: "numba 'matplotlib>=3.3' scipy scooby pytest-mpl" + conda: "numba 'matplotlib>=3.3' scipy pytest-mpl" test: "--mpl" - python-version: "3.12" name: plain @@ -69,7 +69,7 @@ jobs: - python-version: "3.12" name: full os: ubuntu - conda: "numba 'matplotlib' scipy scooby pytest-mpl" + conda: "numba 'matplotlib' scipy pytest-mpl" test: "--mpl" env: diff --git a/.github/workflows/macos_windows.yml b/.github/workflows/macos_windows.yml index 348e10f6..9049989c 100644 --- a/.github/workflows/macos_windows.yml +++ b/.github/workflows/macos_windows.yml @@ -72,7 +72,7 @@ jobs: conda config --show-sources conda config --show conda info -a - conda install numba "scipy!=1.9.0" pytest pytest-console-scripts scooby setuptools-scm + conda install numba "scipy!=1.9.0" pytest pytest-console-scripts setuptools-scm - name: Conda list shell: bash -l {0} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bf4c5b12..b7fae1af 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,11 +6,23 @@ Version 2 ~~~~~~~~~ -v2.2.x +v2.3.x """""" -latest ------- + +v2.3.0: libdlf and scooby +------------------------- + +**2024-03-01** + +The digital linear filters are outsourced to libdlf, reducing the lines of code +of empymod by over 50%. In addition to the new requirement libdlf, scooby is +added as a requirement. Most user questions can be adressed much better if they +provide the output of ``empymod.Report()`` - however, most users do not have +scooby installed. Having it as a requirement will make support smoother. Both +new requirements are very lightweight modules, having at most numpy as a +dependency. + - Filters: @@ -31,6 +43,7 @@ latest - SciPy 1.9 - Numba 0.53 - libdlf (NEW requirement) + - scooby (NEW requirement) - Testing: added Python 3.12, dropped Python 3.8. @@ -40,6 +53,10 @@ latest +v2.2.x +"""""" + + v2.2.2: Flexible dipole coordinates ----------------------------------- diff --git a/empymod/utils.py b/empymod/utils.py index fd58e14c..a3bc3d21 100644 --- a/empymod/utils.py +++ b/empymod/utils.py @@ -34,15 +34,7 @@ # Relative imports from empymod import filters, transform - -# scooby is a soft dependency for empymod -try: - from scooby import Report as ScoobyReport -except ImportError: - class ScoobyReport: - def __init__(self, additional, core, optional, ncol, text_width, sort): - print("\n* WARNING :: `empymod.Report` requires `scooby`." - "\n Install it via `pip install scooby`.\n") +from scooby import Report as ScoobyReport # Version: We take care of it here instead of in __init__, so we can use it # within the package itself (logs). diff --git a/requirements-dev.txt b/requirements-dev.txt index c727291a..24c8a00b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,7 +2,6 @@ -r requirements.txt # SOFT DEPENDENCIES -scooby matplotlib # SETUP RELATED diff --git a/setup.py b/setup.py index 69560b61..97f0bbb7 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ "scipy>=1.9", "numba>=0.53", "libdlf", + "scooby", ], use_scm_version={ "root": ".", diff --git a/tests/test_utils.py b/tests/test_utils.py index c58f51a5..77b81571 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,15 +1,10 @@ import sys import pytest +import scooby import subprocess import numpy as np from numpy.testing import assert_allclose -# Optional import -try: - import scooby -except ImportError: - scooby = False - from empymod import utils, filters @@ -1196,20 +1191,14 @@ def test_report(capsys): # Reporting is now done by the external package scooby. # We just ensure the shown packages do not change (core and optional). - if scooby: - out1 = scooby.Report( - core=['numpy', 'scipy', 'numba', 'empymod'], - optional=['IPython', 'matplotlib'], - ncol=3) - out2 = utils.Report() - - # Ensure they're the same; exclude time to avoid errors. - assert out1.__repr__()[115:] == out2.__repr__()[115:] - - else: # soft dependency - _ = utils.Report() - out, _ = capsys.readouterr() # Empty capsys - assert 'WARNING :: `empymod.Report` requires `scooby`' in out + out1 = scooby.Report( + core=['numpy', 'scipy', 'numba', 'empymod'], + optional=['IPython', 'matplotlib'], + ncol=3) + out2 = utils.Report() + + # Ensure they're the same; exclude time to avoid errors. + assert out1.__repr__()[115:] == out2.__repr__()[115:] @pytest.mark.skipif(not sys.platform.startswith('linux'), reason="Not Linux.")