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

Drop Python 3.7 Support #632

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.7", "3.8", "3.9"]
python: ["3.8", "3.9"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: jupyter-tutorials-env
channels:
- conda-forge
dependencies:
- python>=3.7
- python>=3.8
- pip
- pip:
- -r docs/notebook-requirements.txt
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
#
# If you make changes here, make sure to edit setup.cfg as well!
# =============================================================================
cached_property; python_version<"3.8"
numpy>=1.20
scipy>=1.4
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ classifiers =
Development Status :: 4 - Beta
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

Expand All @@ -34,13 +33,12 @@ package_dir =
=src
# Dependencies of the project (semicolon/line-separated):
install_requires =
cached_property; python_version<"3.8"
numpy>=1.20
scipy>=1.4
# The usage of test_requires is discouraged, see `Dependency Management` docs
# tests_require = pytest; pytest-cov
# Require a specific Python version, e.g. Python 2.7 or >= 3.6
python_requires = >=3.7
python_requires = >=3.8

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
solution or the matrix inverse and any associated hyperparameters.
"""

from functools import cached_property
from typing import Mapping, Optional

from probnum import randvars

try:
# functools.cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property

# pylint: disable="invalid-name"


Expand Down
13 changes: 4 additions & 9 deletions src/probnum/randprocs/markov/integrator/_ioup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
"""Integrated Ornstein-Uhlenbeck processes."""
import warnings
from functools import cached_property

import numpy as np

try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property

from probnum import randvars
from probnum.randprocs.markov import _markov_process, continuous
from probnum.randprocs.markov.integrator import _integrator, _preconditioner
Expand Down Expand Up @@ -140,18 +135,18 @@ def __init__(
)

@cached_property
def _drift_matrix(self):
def _drift_matrix(self): # pylint: disable=method-hidden
drift_matrix_1d = np.diag(np.ones(self.num_derivatives), 1)
drift_matrix_1d[-1, -1] = -self.driftspeed
return np.kron(np.eye(self.wiener_process_dimension), drift_matrix_1d)

@cached_property
def _force_vector(self):
def _force_vector(self): # pylint: disable=method-hidden
force_1d = np.zeros(self.num_derivatives + 1)
return np.kron(np.ones(self.wiener_process_dimension), force_1d)

@cached_property
def _dispersion_matrix(self):
def _dispersion_matrix(self): # pylint: disable=method-hidden
dispersion_matrix_1d = np.zeros(self.num_derivatives + 1)
dispersion_matrix_1d[-1] = 1.0 # Unit Diffusion
return np.kron(np.eye(self.wiener_process_dimension), dispersion_matrix_1d).T
Expand Down
13 changes: 4 additions & 9 deletions src/probnum/randprocs/markov/integrator/_iwp.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
"""Integrated Brownian motion."""

try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property

import warnings
from functools import cached_property

import numpy as np
import scipy.special
Expand Down Expand Up @@ -135,7 +130,7 @@ def __init__(
)

@cached_property
def _drift_matrix(self):
def _drift_matrix(self): # pylint: disable=method-hidden
drift_matrix_1d = np.diag(np.ones(self.num_derivatives), 1)
if config.matrix_free:
return linops.IdentityKronecker(
Expand All @@ -145,11 +140,11 @@ def _drift_matrix(self):
return np.kron(np.eye(self.wiener_process_dimension), drift_matrix_1d)

@cached_property
def _force_vector(self):
def _force_vector(self): # pylint: disable=method-hidden
return np.zeros((self.wiener_process_dimension * (self.num_derivatives + 1)))

@cached_property
def _dispersion_matrix(self):
def _dispersion_matrix(self): # pylint: disable=method-hidden
dispersion_matrix_1d = np.zeros(self.num_derivatives + 1)
dispersion_matrix_1d[-1] = 1.0 # Unit diffusion

Expand Down
13 changes: 4 additions & 9 deletions src/probnum/randprocs/markov/integrator/_matern.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
"""Matern processes."""
import warnings
from functools import cached_property

import numpy as np
import scipy.special

try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property

from probnum import randvars
from probnum.randprocs.markov import _markov_process, continuous
from probnum.randprocs.markov.integrator import _integrator, _preconditioner
Expand Down Expand Up @@ -140,7 +135,7 @@ def __init__(
)

@cached_property
def _drift_matrix(self):
def _drift_matrix(self): # pylint: disable=method-hidden
drift_matrix = np.diag(np.ones(self.num_derivatives), 1)
nu = self.num_derivatives + 0.5
D, lam = self.num_derivatives + 1, np.sqrt(2 * nu) / self.lengthscale
Expand All @@ -150,12 +145,12 @@ def _drift_matrix(self):
return np.kron(np.eye(self.wiener_process_dimension), drift_matrix)

@cached_property
def _force_vector(self):
def _force_vector(self): # pylint: disable=method-hidden
force_1d = np.zeros(self.num_derivatives + 1)
return np.kron(np.ones(self.wiener_process_dimension), force_1d)

@cached_property
def _dispersion_matrix(self):
def _dispersion_matrix(self): # pylint: disable=method-hidden
dispersion_matrix_1d = np.zeros(self.num_derivatives + 1)
dispersion_matrix_1d[-1] = 1.0 # Unit diffusion
return np.kron(np.eye(self.wiener_process_dimension), dispersion_matrix_1d).T
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
"""Coordinate changes in state space models."""

import abc

try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property
from functools import cached_property

import numpy as np
import scipy.special # for vectorised factorial
Expand Down
8 changes: 1 addition & 7 deletions src/probnum/randvars/_constant.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""(Almost surely) constant random variables."""

from functools import cached_property
from typing import Callable, TypeVar

import numpy as np
Expand All @@ -10,13 +11,6 @@

from . import _random_variable

try:
# functools.cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property


_ValueType = TypeVar("ValueType")


Expand Down
8 changes: 1 addition & 7 deletions src/probnum/randvars/_normal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Normally distributed / Gaussian random variables."""

from functools import cached_property
from typing import Callable, Optional, Union

import numpy as np
Expand All @@ -12,13 +13,6 @@

from . import _random_variable

try:
# functools.cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property


_ValueType = Union[np.floating, np.ndarray, linops.LinearOperator]


Expand Down
8 changes: 1 addition & 7 deletions src/probnum/randvars/_random_variable.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
"""Random Variables."""

from functools import cached_property
from typing import Any, Callable, Dict, Generic, Optional, Tuple, TypeVar, Union

import numpy as np

from probnum import utils as _utils
from probnum.typing import ArrayIndicesLike, DTypeLike, FloatLike, ShapeLike, ShapeType

try:
# functools.cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property


_ValueType = TypeVar("ValueType")

# pylint: disable="too-many-lines"
Expand Down
7 changes: 1 addition & 6 deletions src/probnum/randvars/_randomvariablelist.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"""List of random variables."""

from functools import cached_property
from typing import Union

import numpy as np

from probnum import randvars

try:
# functools.cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property


class _RandomVariableList(list):
"""List of RandomVariables with convenient access to means, covariances, etc.
Expand Down