Skip to content

Commit

Permalink
Added support for pandas 2, dropped support for python 3.8 (#50)
Browse files Browse the repository at this point in the history
* added pandas 2, bumped min python to 3.9

* bumped version

* black reformat

* exclude ellipsis coverage

* add python 3.11 tests

* fixed ellipsis exclusion, don't fail fast on tests
  • Loading branch information
georgebv authored Apr 9, 2023
1 parent ca4f368 commit 898f132
Show file tree
Hide file tree
Showing 8 changed files with 826 additions and 693 deletions.
9 changes: 6 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[flake8]
ignore =
E501, # line too long (we have to break this to preserve long links)
E203, # whitespace before ':' (ignore to stay compatible with black)
W503, # line break before binary operator
# line too long (we have to break this to preserve long links)
E501,
# whitespace before ':' (ignore to stay compatible with black)
E203,
# line break before binary operator
W503,
max-line-length = 88
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ jobs:
name: Test on linux and generate coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -47,8 +48,9 @@ jobs:
name: Test on windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -10,11 +10,11 @@ repos:
- id: mixed-line-ending
args: [--fix=lf]
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: ["--check", "."]
Expand Down
1,402 changes: 763 additions & 639 deletions poetry.lock

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyextremes"
version = "2.2.7"
version = "2.3.0"
description = "Extreme Value Analysis (EVA) in Python"
license = "MIT"
authors = ["George Bocharov <[email protected]>"]
Expand All @@ -24,8 +24,8 @@ classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Hydrology",
"Topic :: Scientific/Engineering :: Mathematics",
Expand All @@ -40,10 +40,10 @@ include = [
]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
numpy = "^1.19.0"
scipy = "^1.5.0"
pandas = "^1.0.0"
pandas = ">=1.0.0,<3.0.0"
emcee = "^3.0.3"
matplotlib = "^3.3.0"
tqdm = { version = "^4.0.0", optional = true }
Expand All @@ -52,24 +52,24 @@ tqdm = { version = "^4.0.0", optional = true }
full = ["tqdm"]

[tool.poetry.group.dev.dependencies]
pre-commit = "^2.20.0"
pre-commit = "^3.2.2"

[tool.poetry.group.lint.dependencies]
black = "^22.8.0"
pylint = "^2.15.3"
flake8 = "^5.0.4"
mypy = "^0.981"
isort = "^5.10.1"
black = "^23.0.0"
pylint = "^2.0.0"
flake8 = "^6.0.0"
mypy = "^1.0.0"
isort = "^5.0.0"

[tool.poetry.group.test.dependencies]
pytest = "^7.1.3"
pytest = "^7.0.0"
pytest-cov = "^4.0.0"

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.4.0"
mkdocs-material = "^8.5.3"
mkdocs-material-extensions = "^1.0.3"
mkdocstrings = { version = "^0.19.1", extras = ["python"]}
mkdocs = "^1.4.2"
mkdocs-material = "^9.1.6"
mkdocs-material-extensions = "^1.1.1"
mkdocstrings = { version = "^0.20.0", extras = ["python"]}

[build-system]
requires = ["poetry-core"]
Expand Down Expand Up @@ -118,6 +118,7 @@ exclude_lines = [
'raise NotImplementedError',
'if __name__ == .__main__.:',
'def __repr__',
' ...',
]
fail_under = 90
precision = 1
Expand Down
2 changes: 1 addition & 1 deletion src/pyextremes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.2.7"
__version__ = "2.3.0"
__all__ = [
"EVA",
"get_extremes",
Expand Down
1 change: 0 additions & 1 deletion src/pyextremes/models/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Distribution:

__slots__ = [
"extremes",
"distribution",
Expand Down
62 changes: 33 additions & 29 deletions src/pyextremes/tuning/threshold_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,21 @@ def plot_parameter_stability(
# List of unique seeds - ensures same seed is not reused across sub-processes
seeds: typing.List[int] = []

def _input_generator() -> typing.Generator[
typing.Tuple[
pd.Series, # ts (time series)
str, # extremes_type
float, # threshold
typing.Union[str, pd.Timedelta], # r
typing.Optional[float], # alpha
int, # n_samples
int, # seed
],
None,
None,
]:
def _input_generator() -> (
typing.Generator[
typing.Tuple[
pd.Series, # ts (time series)
str, # extremes_type
float, # threshold
typing.Union[str, pd.Timedelta], # r
typing.Optional[float], # alpha
int, # n_samples
int, # seed
],
None,
None,
]
):
for threshold in thresholds:
seed = np.random.randint(low=0, high=1e6, size=None)
while seed in seeds:
Expand Down Expand Up @@ -618,22 +620,24 @@ def plot_return_value_stability(
else:
distribution_names.append(distribution.name)

def _input_generator() -> typing.Generator[
typing.Tuple[
pd.Series, # ts (time series)
float, # return_period
typing.Union[str, pd.Timedelta], # return_period_size
float, # threshold
typing.Union[str, pd.Timedelta], # r
str, # extremes_type
typing.Union[str, scipy.stats.rv_continuous], # distribution
str, # distribution_name
typing.Optional[float], # alpha
int, # n_samples
],
None,
None,
]:
def _input_generator() -> (
typing.Generator[
typing.Tuple[
pd.Series, # ts (time series)
float, # return_period
typing.Union[str, pd.Timedelta], # return_period_size
float, # threshold
typing.Union[str, pd.Timedelta], # r
str, # extremes_type
typing.Union[str, scipy.stats.rv_continuous], # distribution
str, # distribution_name
typing.Optional[float], # alpha
int, # n_samples
],
None,
None,
]
):
for distribution, distribution_name in zip(distributions, distribution_names):
for threshold in thresholds:
yield (
Expand Down

0 comments on commit 898f132

Please sign in to comment.