diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 5ee5477..3bd6a9d 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -14,12 +14,10 @@ jobs: steps: - name: apt install - uses: awalsh128/cache-apt-pkgs-action@latest - with: - packages: - make libfftw3-dev libfftw3-mpi-dev libhdf5-openmpi-dev openmpi-bin libopenmpi-dev libopenblas-dev - version: 1.0 - execute_install_scripts: true + run: | + sudo apt make install -y libfftw3-dev libfftw3-mpi-dev \ + libhdf5-openmpi-dev openmpi-bin libopenmpi-dev \ + libopenblas-dev - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 10835d6..4058acf 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -28,4 +28,4 @@ jobs: pip install -e . -v --no-build-isolation --no-deps - name: Tests run: | - pytest -v + pytest -v tests diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 94ccf59..4ac26be 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -33,4 +33,4 @@ jobs: pip install -e . -v --no-build-isolation --no-deps - name: Tests run: | - pytest -v + pytest -v tests diff --git a/doc/ipynb/tuto_fft2d_seq.md b/doc/ipynb/tuto_fft2d_seq.md index 4719f6e..c24959f 100644 --- a/doc/ipynb/tuto_fft2d_seq.md +++ b/doc/ipynb/tuto_fft2d_seq.md @@ -21,12 +21,11 @@ If you really want performance, first benchmark the different methods for an arr ```{code-cell} ipython3 import numpy as np -from fluidfft.fft2d import methods_seq -from fluidfft import import_fft_class +from fluidfft import get_methods, import_fft_class ``` ```{code-cell} ipython3 -print(methods_seq) +print(get_methods(ndim=2, sequential=True)) ``` We import a class and instantiate it: diff --git a/doc/ipynb/tuto_fft3d_seq.md b/doc/ipynb/tuto_fft3d_seq.md index 645e6e9..869b5f6 100644 --- a/doc/ipynb/tuto_fft3d_seq.md +++ b/doc/ipynb/tuto_fft3d_seq.md @@ -17,12 +17,11 @@ In this tutorial, we present how to use fluidfft to perform 3D fft in sequential ```{code-cell} ipython3 import numpy as np -from fluidfft.fft3d import methods_seq -from fluidfft import import_fft_class +from fluidfft import get_methods, import_fft_class ``` ```{code-cell} ipython3 -print(methods_seq) +print(get_methods(ndim=3, sequential=True)) ``` We import a class and instantiate it: diff --git a/src/fluidfft/__init__.py b/src/fluidfft/__init__.py index d1e966c..447d4b1 100644 --- a/src/fluidfft/__init__.py +++ b/src/fluidfft/__init__.py @@ -88,6 +88,7 @@ def byte_align(values, *args): "empty_aligned", "get_module_fullname_from_method", "get_plugins", + "get_methods", "import_fft_class", ] @@ -126,6 +127,12 @@ def get_plugins(reload=False, ndim=None, sequential=None): ) +def get_methods(ndim=None, sequential=None): + """Get available methods""" + plugins = get_plugins(ndim=ndim, sequential=sequential) + return set(plug.name for plug in plugins) + + def get_module_fullname_from_method(method): """Get the module name from a method string diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 21235a0..7077e01 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -1,6 +1,5 @@ -from importlib_metadata import entry_points -from fluidfft import get_plugins +from fluidfft import get_plugins, get_methods methodss = { @@ -37,23 +36,15 @@ } -def _methods_from_plugins(plugins): - return set(plug.name for plug in plugins) - - -def _get_methods(ndim=None, sequential=None): - return _methods_from_plugins(get_plugins(ndim=ndim, sequential=sequential)) - - def test_plugins(): plugins = get_plugins() assert plugins for ndim in (2, 3): - assert _get_methods(ndim=ndim) == methodss[(ndim, True)].union( + assert get_methods(ndim=ndim) == methodss[(ndim, True)].union( methodss[(ndim, False)] ) for sequential in (True, False): - assert methodss[(ndim, sequential)] == _get_methods( + assert methodss[(ndim, sequential)] == get_methods( ndim=ndim, sequential=sequential )