diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0742e29..95b0c5d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,7 +35,7 @@ jobs: python: "3.9" os: ubuntu-latest toxenv: format - - name: Linting with flake8 + - name: Linting with flake8 + ruff python: "3.9" os: ubuntu-latest toxenv: lint diff --git a/doc/_static/make_logo.py b/doc/_static/make_logo.py index 79212a8..da20ac1 100644 --- a/doc/_static/make_logo.py +++ b/doc/_static/make_logo.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from numpy import meshgrid, linspace +from numpy import linspace, meshgrid fig, ax = plt.subplots(figsize=(27, 9)) x, y = meshgrid((0, 100), linspace(0, 0.1, 1000)) diff --git a/pyproject.toml b/pyproject.toml index cdf611c..6ba0519 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ 'Intended Audience :: Science/Research', "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", + "Typing :: Typed", ] [project.urls] diff --git a/src/spei/__init__.py b/src/spei/__init__.py index 2c59221..1b4672e 100644 --- a/src/spei/__init__.py +++ b/src/spei/__init__.py @@ -1,4 +1,4 @@ # flake8: noqa from . import plot, si, utils -from ._version import __version__ +from ._version import __version__, show_versions from .si import sgi, spei, spi, ssfi diff --git a/src/spei/_version.py b/src/spei/_version.py index e19434e..058111b 100644 --- a/src/spei/_version.py +++ b/src/spei/_version.py @@ -1 +1,16 @@ -__version__ = "0.3.3" +from importlib import metadata +from platform import python_version + +__version__ = "0.3.4" + + +def show_versions() -> None: + msg = f"Versions\npython: {python_version()}\nspei: {__version__}\n" + + requirements = metadata.requires("spei") + if requirements: + deps = [x for x in requirements if "extra" not in x] + for dep in deps: + msg += f"{dep}: {metadata.version(dep)}\n" + + print(msg) diff --git a/tests/fixtures.py b/tests/conftest.py similarity index 100% rename from tests/fixtures.py rename to tests/conftest.py diff --git a/tests/test_dist_utils.py b/tests/test_dist_utils.py index 2e98317..b318086 100644 --- a/tests/test_dist_utils.py +++ b/tests/test_dist_utils.py @@ -1,7 +1,7 @@ -from spei.utils import dists_test +from pandas import Series -from .fixtures import head +from spei.utils import dists_test -def test_dists_test(head) -> None: +def test_dists_test(head: Series) -> None: _ = dists_test(head) diff --git a/tests/test_plots.py b/tests/test_plots.py index a817e10..bbe24f9 100644 --- a/tests/test_plots.py +++ b/tests/test_plots.py @@ -5,8 +5,6 @@ from spei.plot import dist, monthly_density from spei.plot import si as plot_si -from .fixtures import prec, si - mpl.use("Agg") # prevent _tkinter.TclError: Can't find a usable tk.tcl error diff --git a/tests/test_si.py b/tests/test_si.py index b9d9333..e4a20f9 100644 --- a/tests/test_si.py +++ b/tests/test_si.py @@ -2,8 +2,6 @@ from spei import sgi, spei, spi, ssfi -from .fixtures import evap, head, prec - def test_spi(prec: Series) -> None: spi(prec.rolling("30D", min_periods=30).sum().dropna(), prob_zero=True) diff --git a/tests/test_validate.py b/tests/test_validate.py index 1c7432e..537466d 100644 --- a/tests/test_validate.py +++ b/tests/test_validate.py @@ -1,5 +1,6 @@ -import pytest import logging + +import pytest from pandas import DataFrame, Series, to_datetime from spei.utils import validate_index, validate_series diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 0000000..0520036 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,10 @@ +import spei as si + + +def test_version() -> None: + assert isinstance(si.__version__, str) + assert si.__version__.count(".") == 2 + + +def test_show_versions(): + si.show_versions()