diff --git a/CHANGELOG.md b/CHANGELOG.md index d5885da8..afc4d08a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to **GSTools** will be documented in this file. ### Enhancements ### Changes +- Python versions 2.7 and 3.4 are no longer supported #40 #43 ### Bugfixes diff --git a/gstools/__init__.py b/gstools/__init__.py index c10c8da3..5cdcf262 100644 --- a/gstools/__init__.py +++ b/gstools/__init__.py @@ -99,8 +99,6 @@ vario_estimate_unstructured """ -from __future__ import absolute_import - import sys from gstools._version import __version__ diff --git a/gstools/covmodel/__init__.py b/gstools/covmodel/__init__.py index cf30d3ff..7417f817 100644 --- a/gstools/covmodel/__init__.py +++ b/gstools/covmodel/__init__.py @@ -48,7 +48,6 @@ TPLExponential TPLStable """ -from __future__ import absolute_import from gstools.covmodel.base import CovModel from gstools.covmodel.models import ( diff --git a/gstools/covmodel/base.py b/gstools/covmodel/base.py index 45d2362e..2c301914 100644 --- a/gstools/covmodel/base.py +++ b/gstools/covmodel/base.py @@ -10,9 +10,7 @@ CovModel """ # pylint: disable=C0103, R0201 -from __future__ import print_function, division, absolute_import -import six import numpy as np from scipy.integrate import quad as integral from scipy.optimize import curve_fit, root @@ -41,7 +39,7 @@ # The CovModel Base-Class ##################################################### -class CovModel(six.with_metaclass(InitSubclassMeta)): +class CovModel(metaclass=InitSubclassMeta): r"""Base class for the GSTools covariance models. Parameters diff --git a/gstools/covmodel/models.py b/gstools/covmodel/models.py index 6a748ba6..ae44daaf 100644 --- a/gstools/covmodel/models.py +++ b/gstools/covmodel/models.py @@ -18,7 +18,6 @@ Intersection """ # pylint: disable=C0103, E1101, E1137 -from __future__ import print_function, division, absolute_import import warnings import numpy as np diff --git a/gstools/covmodel/plot.py b/gstools/covmodel/plot.py index 1695c88a..865f71e6 100644 --- a/gstools/covmodel/plot.py +++ b/gstools/covmodel/plot.py @@ -18,7 +18,6 @@ plot_spectral_rad_pdf """ # pylint: disable=C0103 -from __future__ import print_function, division, absolute_import import numpy as np import gstools diff --git a/gstools/covmodel/tools.py b/gstools/covmodel/tools.py index 1a1e15c7..e954e164 100644 --- a/gstools/covmodel/tools.py +++ b/gstools/covmodel/tools.py @@ -15,9 +15,8 @@ exp_int inc_beta """ -# pylint: disable=C0103 -from __future__ import print_function, division, absolute_import +# pylint: disable=C0103 import numpy as np from scipy import special as sps diff --git a/gstools/covmodel/tpl_models.py b/gstools/covmodel/tpl_models.py index 4eae9aa9..182e142d 100644 --- a/gstools/covmodel/tpl_models.py +++ b/gstools/covmodel/tpl_models.py @@ -12,7 +12,6 @@ TPLStable """ # pylint: disable=C0103, E1101 -from __future__ import print_function, division, absolute_import import warnings import numpy as np diff --git a/gstools/field/__init__.py b/gstools/field/__init__.py index aa7eaf02..6884e377 100644 --- a/gstools/field/__init__.py +++ b/gstools/field/__init__.py @@ -20,7 +20,6 @@ ---- """ -from __future__ import absolute_import from gstools.field.srf import SRF diff --git a/gstools/field/base.py b/gstools/field/base.py index 76777237..9e2ff36e 100755 --- a/gstools/field/base.py +++ b/gstools/field/base.py @@ -10,7 +10,6 @@ Field """ # pylint: disable=C0103 -from __future__ import division, absolute_import, print_function from functools import partial @@ -23,7 +22,7 @@ __all__ = ["Field"] -class Field(object): +class Field: """A field base class for random and kriging fields ect. Parameters diff --git a/gstools/field/generator.py b/gstools/field/generator.py index 048485c5..3bbe7a58 100644 --- a/gstools/field/generator.py +++ b/gstools/field/generator.py @@ -11,7 +11,6 @@ IncomprRandMeth """ # pylint: disable=C0103 -from __future__ import division, absolute_import, print_function from copy import deepcopy as dcp import numpy as np @@ -27,7 +26,7 @@ __all__ = ["RandMeth", "IncomprRandMeth"] -class RandMeth(object): +class RandMeth: r"""Randomization method for calculating isotropic spatial random fields. Parameters @@ -363,9 +362,7 @@ def __init__( "Only 2- and 3-dimensional incompressible fields " + "can be generated." ) - super(IncomprRandMeth, self).__init__( - model, mode_no, seed, verbose, **kwargs - ) + super().__init__(model, mode_no, seed, verbose, **kwargs) self.mean_u = mean_velocity self._value_type = "vector" diff --git a/gstools/field/plot.py b/gstools/field/plot.py index acaf15da..23bcf3b8 100644 --- a/gstools/field/plot.py +++ b/gstools/field/plot.py @@ -11,7 +11,6 @@ plot_vec_field """ # pylint: disable=C0103 -from __future__ import print_function, division, absolute_import import numpy as np from scipy import interpolate as inter import matplotlib.pyplot as plt diff --git a/gstools/field/srf.py b/gstools/field/srf.py index df5fdf85..bbd7e320 100644 --- a/gstools/field/srf.py +++ b/gstools/field/srf.py @@ -10,7 +10,6 @@ SRF """ # pylint: disable=C0103 -from __future__ import division, absolute_import, print_function import numpy as np from gstools.field.generator import RandMeth, IncomprRandMeth @@ -90,7 +89,7 @@ def __init__( generator="RandMeth", **generator_kwargs ): - super(SRF, self).__init__(model, mean) + super().__init__(model, mean) # initialize private attributes self._generator = None self._upscaling = None diff --git a/gstools/field/tools.py b/gstools/field/tools.py index 58249fb3..9c041048 100644 --- a/gstools/field/tools.py +++ b/gstools/field/tools.py @@ -17,7 +17,6 @@ reshape_field_from_unstruct_to_struct """ # pylint: disable=C0103 -from __future__ import print_function, division, absolute_import import numpy as np from gstools.tools.geometric import r3d_x, r3d_y, r3d_z diff --git a/gstools/field/upscaling.py b/gstools/field/upscaling.py index 912f8b03..d52df39b 100644 --- a/gstools/field/upscaling.py +++ b/gstools/field/upscaling.py @@ -10,7 +10,6 @@ var_coarse_graining var_no_scaling """ -from __future__ import print_function, division, absolute_import import warnings import numpy as np diff --git a/gstools/krige/__init__.py b/gstools/krige/__init__.py index 4c6d24d6..3ed0ac0f 100644 --- a/gstools/krige/__init__.py +++ b/gstools/krige/__init__.py @@ -13,7 +13,6 @@ ---- """ -from __future__ import absolute_import from gstools.krige.simple import Simple from gstools.krige.ordinary import Ordinary diff --git a/gstools/krige/ordinary.py b/gstools/krige/ordinary.py index cd8a6b94..5e3ff3d2 100644 --- a/gstools/krige/ordinary.py +++ b/gstools/krige/ordinary.py @@ -10,7 +10,6 @@ Ordinary """ # pylint: disable=C0103 -from __future__ import division, absolute_import, print_function import numpy as np from scipy.linalg import inv @@ -46,7 +45,7 @@ class Ordinary(Field): """ def __init__(self, model, cond_pos, cond_val): - super(Ordinary, self).__init__(model, mean=0.0) + super().__init__(model, mean=0.0) self.krige_var = None # initialize private attributes self._value_type = "scalar" diff --git a/gstools/krige/simple.py b/gstools/krige/simple.py index ca1ba7f5..2a62eedf 100644 --- a/gstools/krige/simple.py +++ b/gstools/krige/simple.py @@ -10,8 +10,6 @@ Simple """ # pylint: disable=C0103 -from __future__ import division, absolute_import, print_function - import numpy as np from scipy.linalg import inv @@ -49,7 +47,7 @@ class Simple(Field): """ def __init__(self, model, mean, cond_pos, cond_val): - super(Simple, self).__init__(model, mean) + super().__init__(model, mean) self.krige_var = None # initialize private attributes self._value_type = "scalar" diff --git a/gstools/krige/tools.py b/gstools/krige/tools.py index d316269b..1c1565d2 100644 --- a/gstools/krige/tools.py +++ b/gstools/krige/tools.py @@ -10,7 +10,6 @@ set_condition """ # pylint: disable=C0103 -from __future__ import print_function, division, absolute_import import numpy as np from gstools.tools.geometric import pos2xyz, xyz2pos diff --git a/gstools/random/__init__.py b/gstools/random/__init__.py index 375a9b55..ec78b43c 100644 --- a/gstools/random/__init__.py +++ b/gstools/random/__init__.py @@ -24,7 +24,6 @@ ---- """ -from __future__ import absolute_import from gstools.random.rng import RNG from gstools.random.tools import MasterRNG, dist_gen diff --git a/gstools/random/rng.py b/gstools/random/rng.py index 9b37f8c9..e2915f6f 100644 --- a/gstools/random/rng.py +++ b/gstools/random/rng.py @@ -10,7 +10,6 @@ RNG """ # pylint: disable=no-member -from __future__ import division, absolute_import, print_function import numpy as np import numpy.random as rand @@ -21,7 +20,7 @@ __all__ = ["RNG"] -class RNG(object): +class RNG: """ A random number generator for different distributions and multiple streams. diff --git a/gstools/random/tools.py b/gstools/random/tools.py index 6f445e7c..c4799ee4 100644 --- a/gstools/random/tools.py +++ b/gstools/random/tools.py @@ -10,7 +10,6 @@ MasterRNG dist_gen """ -from __future__ import division, absolute_import, print_function from scipy.stats import rv_continuous import numpy.random as rand @@ -18,7 +17,7 @@ __all__ = ["MasterRNG", "dist_gen"] -class MasterRNG(object): +class MasterRNG: """Master random number generator for generating seeds. Parameters @@ -108,7 +107,7 @@ class DistPdf(rv_continuous): def __init__(self, pdf_in, **kwargs): self.pdf_in = pdf_in - super(DistPdf, self).__init__(**kwargs) + super().__init__(**kwargs) def _pdf(self, x, *args): return self.pdf_in(x) @@ -119,7 +118,7 @@ class DistCdf(rv_continuous): def __init__(self, cdf_in, **kwargs): self.cdf_in = cdf_in - super(DistCdf, self).__init__(**kwargs) + super().__init__(**kwargs) def _cdf(self, x, *args): return self.cdf_in(x) @@ -131,7 +130,7 @@ class DistPdfCdf(rv_continuous): def __init__(self, pdf_in, cdf_in, **kwargs): self.pdf_in = pdf_in self.cdf_in = cdf_in - super(DistPdfCdf, self).__init__(**kwargs) + super().__init__(**kwargs) def _pdf(self, x, *args): return self.pdf_in(x) @@ -146,7 +145,7 @@ class DistPdfPpf(rv_continuous): def __init__(self, pdf_in, ppf_in, **kwargs): self.pdf_in = pdf_in self.ppf_in = ppf_in - super(DistPdfPpf, self).__init__(**kwargs) + super().__init__(**kwargs) def _pdf(self, x, *args): return self.pdf_in(x) @@ -161,7 +160,7 @@ class DistCdfPpf(rv_continuous): def __init__(self, cdf_in, ppf_in, **kwargs): self.cdf_in = cdf_in self.ppf_in = ppf_in - super(DistCdfPpf, self).__init__(**kwargs) + super().__init__(**kwargs) def _cdf(self, x, *args): return self.cdf_in(x) @@ -177,7 +176,7 @@ def __init__(self, pdf_in, cdf_in, ppf_in, **kwargs): self.pdf_in = pdf_in self.cdf_in = cdf_in self.ppf_in = ppf_in - super(DistPdfCdfPpf, self).__init__(**kwargs) + super().__init__(**kwargs) def _pdf(self, x, *args): return self.pdf_in(x) diff --git a/gstools/tools/__init__.py b/gstools/tools/__init__.py index 3f430c9a..5aa4b6d3 100644 --- a/gstools/tools/__init__.py +++ b/gstools/tools/__init__.py @@ -36,7 +36,6 @@ ---- """ -from __future__ import absolute_import from gstools.tools.export import ( vtk_export_structured, diff --git a/gstools/tools/export.py b/gstools/tools/export.py index 65fc9989..94210b51 100644 --- a/gstools/tools/export.py +++ b/gstools/tools/export.py @@ -15,7 +15,6 @@ vtk_export """ # pylint: disable=C0103, E1101 -from __future__ import print_function, division, absolute_import import numpy as np from pyevtk.hl import gridToVTK, pointsToVTK diff --git a/gstools/tools/geometric.py b/gstools/tools/geometric.py index de297a4e..8e2a0dd3 100644 --- a/gstools/tools/geometric.py +++ b/gstools/tools/geometric.py @@ -14,7 +14,6 @@ xyz2pos """ # pylint: disable=C0103 -from __future__ import print_function, division, absolute_import import numpy as np diff --git a/gstools/tools/special.py b/gstools/tools/special.py index 5100fae9..22185c33 100644 --- a/gstools/tools/special.py +++ b/gstools/tools/special.py @@ -13,7 +13,6 @@ tplstable_cor """ # pylint: disable=C0103, E1101 -from __future__ import print_function, division, absolute_import import numpy as np from scipy import special as sps diff --git a/gstools/transform/__init__.py b/gstools/transform/__init__.py index b54db482..8a5a84c8 100644 --- a/gstools/transform/__init__.py +++ b/gstools/transform/__init__.py @@ -19,7 +19,6 @@ ---- """ -from __future__ import absolute_import from gstools.transform.field import ( binary, diff --git a/gstools/transform/field.py b/gstools/transform/field.py index 0d0b4b3e..c3a90e43 100644 --- a/gstools/transform/field.py +++ b/gstools/transform/field.py @@ -17,7 +17,6 @@ normal_to_uquad """ # pylint: disable=C0103, E1101 -from __future__ import print_function, division, absolute_import from warnings import warn diff --git a/gstools/variogram/__init__.py b/gstools/variogram/__init__.py index 264888a7..c5735c52 100644 --- a/gstools/variogram/__init__.py +++ b/gstools/variogram/__init__.py @@ -13,7 +13,6 @@ ---- """ -from __future__ import absolute_import from gstools.variogram.variogram import ( vario_estimate_structured, diff --git a/gstools/variogram/variogram.py b/gstools/variogram/variogram.py index b2800fed..07dab9e0 100644 --- a/gstools/variogram/variogram.py +++ b/gstools/variogram/variogram.py @@ -11,7 +11,6 @@ vario_estimate_structured """ # pylint: disable=C0103 -from __future__ import division, absolute_import, print_function import numpy as np diff --git a/requirements.txt b/requirements.txt index da14c557..7b3d799b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ scipy>=1.1.0 hankel>=0.3.6 emcee>=3.0.0 pyevtk -six diff --git a/setup.py b/setup.py index e755f698..82e79c4e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- """GSTools: A geostatistical toolbox.""" -from __future__ import division, absolute_import, print_function -import sys, os, codecs, re, tempfile, glob, subprocess, shutil +import sys, os, codecs, re, tempfile, glob, subprocess from distutils.errors import CompileError, LinkError from distutils.ccompiler import new_compiler @@ -41,20 +40,6 @@ def find_version(*file_paths): # https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/_build_utils/openmp_helpers.py -# TemporaryDirectory not avialable in python2 -class _TemporaryDirectory(object): - def __enter__(self): - self.dir_name = tempfile.mkdtemp() - return self.dir_name - - def __exit__(self, exc_type, exc_value, traceback): - shutil.rmtree(self.dir_name) - - -TemporaryDirectory = getattr( - tempfile, "TemporaryDirectory", _TemporaryDirectory -) - CCODE = """ #include #include @@ -101,7 +86,7 @@ def check_openmp_support(): ccompiler = new_compiler() customize_compiler(ccompiler) - with TemporaryDirectory() as tmp_dir: + with tempfile.TemporaryDirectory() as tmp_dir: try: os.chdir(tmp_dir) # Write test program @@ -237,8 +222,12 @@ class MPDistribution(Distribution): "Natural Language :: English", "Operating System :: Unix", "Programming Language :: Python", - "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3 :: Only", "Topic :: Scientific/Engineering", "Topic :: Utilities", ] @@ -258,6 +247,7 @@ class MPDistribution(Distribution): classifiers=CLASSIFIERS, platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], include_package_data=True, + python_requires=">=3.5", setup_requires=["numpy>=1.14.5", "cython>=0.28.3", "setuptools>=41.0.1"], install_requires=[ "numpy>=1.14.5", @@ -265,7 +255,6 @@ class MPDistribution(Distribution): "hankel>=0.3.6", "emcee>=3.0.0", "pyevtk", - "six", ], extras_require={"plotting": ["pyvista", "matplotlib"]}, packages=find_packages(exclude=["tests*", "docs*"]), diff --git a/tests/test_condition.py b/tests/test_condition.py index e04a89cb..e7c58879 100644 --- a/tests/test_condition.py +++ b/tests/test_condition.py @@ -2,7 +2,6 @@ """ This is the unittest of CovModel class. """ -from __future__ import division, absolute_import, print_function import numpy as np import unittest diff --git a/tests/test_covmodel.py b/tests/test_covmodel.py index 9c8345ce..bd1434d9 100644 --- a/tests/test_covmodel.py +++ b/tests/test_covmodel.py @@ -2,7 +2,6 @@ """ This is the unittest of CovModel class. """ -from __future__ import division, absolute_import, print_function import unittest from gstools import ( diff --git a/tests/test_incomprrandmeth.py b/tests/test_incomprrandmeth.py index ea31bd2e..f6557e2e 100644 --- a/tests/test_incomprrandmeth.py +++ b/tests/test_incomprrandmeth.py @@ -2,7 +2,6 @@ """ This is the unittest of the RandMeth class. """ -from __future__ import division, absolute_import, print_function import copy import unittest diff --git a/tests/test_krige.py b/tests/test_krige.py index 370b7b02..335084e4 100644 --- a/tests/test_krige.py +++ b/tests/test_krige.py @@ -2,7 +2,6 @@ """ This is the unittest of CovModel class. """ -from __future__ import division, absolute_import, print_function import numpy as np import unittest diff --git a/tests/test_randmeth.py b/tests/test_randmeth.py index 4846585a..7998a04f 100644 --- a/tests/test_randmeth.py +++ b/tests/test_randmeth.py @@ -2,7 +2,6 @@ """ This is the unittest of the RandMeth class. """ -from __future__ import division, absolute_import, print_function import copy import unittest diff --git a/tests/test_rng.py b/tests/test_rng.py index 9f4736a0..2c00b1ea 100644 --- a/tests/test_rng.py +++ b/tests/test_rng.py @@ -2,7 +2,6 @@ """ This is the unittest of the RNG class. """ -from __future__ import division, absolute_import, print_function import unittest import numpy as np diff --git a/tests/test_srf.py b/tests/test_srf.py index a362d3e1..a30e30bd 100644 --- a/tests/test_srf.py +++ b/tests/test_srf.py @@ -3,7 +3,6 @@ """ This is the unittest of SRF class. """ -from __future__ import division, absolute_import, print_function import unittest import numpy as np diff --git a/tests/test_variogram_structured.py b/tests/test_variogram_structured.py index 05debc6c..803b2aeb 100644 --- a/tests/test_variogram_structured.py +++ b/tests/test_variogram_structured.py @@ -2,7 +2,6 @@ """ This is a unittest of the variogram module. """ -from __future__ import division, absolute_import, print_function import sys import unittest diff --git a/tests/test_variogram_unstructured.py b/tests/test_variogram_unstructured.py index 4901e462..0cff6eed 100644 --- a/tests/test_variogram_unstructured.py +++ b/tests/test_variogram_unstructured.py @@ -3,7 +3,6 @@ """ This is a unittest of the variogram module. """ -from __future__ import division, absolute_import, print_function import sys import unittest