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

Only support Python >= 3.5 #43

Merged
merged 16 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 62 additions & 91 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,136 +2,107 @@ language: python

matrix:
include:
- name: "Linux py27"
- name: "sdist and coverage"
sudo: required
language: python
python: 2.7
python: 3.6
services: docker
env:
- PIP=pip
- CIBW_BUILD="cp27-*"
- COVER="off"

- name: "Linux py34"
sudo: required
language: python
python: 3.4
services: docker
env:
- PIP=pip
- CIBW_BUILD="cp34-*"
- COVER="off"
script:
- python -m pip install -U setuptools pytest-cov coveralls
- python -m pip install -U numpy==1.17.3 cython==0.29.14
- python -m pip install -r requirements.txt
- python setup.py sdist -d dist
- python setup.py build_ext --inplace
- python -m pytest --cov gstools --cov-report term-missing -v tests/
- python -m coveralls

- name: "Linux py35"
sudo: required
language: python
python: 3.5
python: 3.6
services: docker
env:
- PIP=pip
- CIBW_BUILD="cp35-*"
- COVER="off"

# py36 for coverage and sdist
env: CIBW_BUILD="cp35-*"
- name: "Linux py36"
sudo: required
language: python
python: 3.6
services: docker
env:
- PIP=pip
- CIBW_BUILD="cp36-*"
- COVER="on"

# https://github.com/travis-ci/travis-ci/issues/9815
env: CIBW_BUILD="cp36-*"
- name: "Linux py37"
sudo: required
language: python
python: 3.7
dist: xenial
python: 3.6
services: docker
env:
- PIP=pip
- CIBW_BUILD="cp37-*"
- COVER="off"
env: CIBW_BUILD="cp37-*"
- name: "Linux py38"
sudo: required
language: python
python: 3.6
services: docker
env: CIBW_BUILD="cp38-*"

- name: "MacOS py27"
- name: "MacOS py35"
os: osx
language: generic
env:
- PIP=pip2
- CIBW_BUILD="cp27-*"
- COVER="off"

- name: "MacOS py34"
env: CIBW_BUILD="cp35-*"
- name: "MacOS py36"
os: osx
language: generic
env:
- PIP=pip2
- CIBW_BUILD="cp34-*"
- COVER="off"

- name: "MacOS py35"
env: CIBW_BUILD="cp36-*"
- name: "MacOS py37"
os: osx
language: generic
env:
- PIP=pip2
- CIBW_BUILD="cp35-*"
- COVER="off"

- name: "MacOS py36"
env: CIBW_BUILD="cp37-*"
- name: "MacOS py38"
os: osx
language: generic
env: CIBW_BUILD="cp38-*"

- name: "Win py35"
os: windows
language: shell
before_install: choco install python3 --version 3.6.8 --no-progress -y
env:
- PIP=pip2
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- CIBW_BUILD="cp35-*"
- name: "Win py36"
os: windows
language: shell
before_install: choco install python3 --version 3.6.8 --no-progress -y
env:
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- CIBW_BUILD="cp36-*"
- COVER="off"

- name: "MacOS py37"
os: osx
language: generic
- name: "Win py37"
os: windows
language: shell
before_install: choco install python3 --version 3.6.8 --no-progress -y
env:
- PIP=pip2
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- CIBW_BUILD="cp37-*"
- COVER="off"
- name: "Win py38"
os: windows
language: shell
before_install: choco install python3 --version 3.6.8 --no-progress -y
env:
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- CIBW_BUILD="cp38-*"

env:
global:
- TWINE_USERNAME=geostatframework
- CIBW_BEFORE_BUILD="pip install numpy==1.14.5 cython==0.28.3"
- CIBW_TEST_REQUIRES=pytest-cov
# inplace cython build and test run
- CIBW_TEST_COMMAND="cd {project} && python setup.py build_ext --inplace && py.test --cov gstools --cov-report term-missing -v {project}/tests"
- CIBW_BEFORE_BUILD="pip install numpy==1.17.3 cython==0.29.14 setuptools"
- CIBW_TEST_REQUIRES=pytest
- CIBW_TEST_COMMAND="python -m pytest -v {project}/tests"

script:
# create wheels
- $PIP install cibuildwheel==0.11.1
- cibuildwheel --output-dir wheelhouse
# create source dist for pypi and create coverage (only once for linux py3.6)
- |
if [[ $COVER == "on" ]]; then
rm -rf dist
python -m pip install -U numpy==1.14.5 cython==0.28.3 setuptools
python -m pip install pytest-cov coveralls
python -m pip install -r docs/requirements.txt
python setup.py sdist
python setup.py build_ext --inplace
python -m pytest --cov gstools --cov-report term-missing -v tests/
python -m coveralls
fi
- python -m pip install cibuildwheel==1.0.0
- python -m cibuildwheel --output-dir dist

after_success:
# pypi upload ("test" allways and "official" on TAG)
- python -m pip install twine
- python -m twine upload --verbose --skip-existing --repository-url https://test.pypi.org/legacy/ wheelhouse/*.whl
- python -m twine upload --verbose --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*.tar.gz
- |
if [[ $TRAVIS_TAG ]]; then
python -m twine upload --verbose --skip-existing wheelhouse/*.whl
python -m twine upload --verbose --skip-existing dist/*.tar.gz
fi

- python -m twine upload --verbose --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*
- if [[ $TRAVIS_TAG ]]; then python -m twine upload --verbose dist/*; fi
notifications:
email:
recipients:
- [email protected]
- [email protected]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions gstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
vario_estimate_unstructured
"""

from __future__ import absolute_import

import sys

from gstools._version import __version__
Expand Down
1 change: 0 additions & 1 deletion gstools/covmodel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
TPLExponential
TPLStable
"""
from __future__ import absolute_import

from gstools.covmodel.base import CovModel
from gstools.covmodel.models import (
Expand Down
5 changes: 1 addition & 4 deletions gstools/covmodel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
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
from hankel import SymmetricFourierTransform as SFT
from gstools.field.tools import make_isotropic, unrotate_mesh
from gstools.tools.geometric import pos2xyz
from gstools.covmodel.tools import (
InitSubclassMeta,
rad_fac,
set_len_anis,
set_angles,
Expand All @@ -41,7 +38,7 @@
# The CovModel Base-Class #####################################################


class CovModel(six.with_metaclass(InitSubclassMeta)):
class CovModel:
r"""Base class for the GSTools covariance models.

Parameters
Expand Down
1 change: 0 additions & 1 deletion gstools/covmodel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
Intersection
"""
# pylint: disable=C0103, E1101, E1137
from __future__ import print_function, division, absolute_import

import warnings
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion gstools/covmodel/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 1 addition & 38 deletions gstools/covmodel/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
The following classes and functions are provided

.. autosummary::
InitSubclassMeta
rad_fac
set_len_anis
check_bounds
Expand All @@ -16,47 +15,11 @@
inc_beta
"""
# pylint: disable=C0103
from __future__ import print_function, division, absolute_import

import numpy as np
from scipy import special as sps

__all__ = ["InitSubclassMeta", "rad_fac", "set_len_anis", "check_bounds"]


# __init_subclass__ hack ######################################################

if hasattr(object, "__init_subclass__"):
InitSubclassMeta = type
else:

class InitSubclassMeta(type): # pragma: no cover
"""Metaclass that implements PEP 487 protocol.

Notes
-----
See :
https://www.python.org/dev/peps/pep-0487

taken from :
https://github.com/graphql-python/graphene/blob/master/graphene/pyutils/init_subclass.py
"""

def __new__(cls, name, bases, ns, **kwargs):
"""Create a new subclass."""
__init_subclass__ = ns.pop("__init_subclass__", None)
if __init_subclass__:
__init_subclass__ = classmethod(__init_subclass__)
ns["__init_subclass__"] = __init_subclass__
return super(InitSubclassMeta, cls).__new__(
cls, name, bases, ns, **kwargs
)

def __init__(cls, name, bases, ns, **kwargs):
super(InitSubclassMeta, cls).__init__(name, bases, ns)
super_class = super(cls, cls)
if hasattr(super_class, "__init_subclass__"):
super_class.__init_subclass__.__func__(cls, **kwargs)
__all__ = ["rad_fac", "set_len_anis", "check_bounds"]


# Helping functions ###########################################################
Expand Down
1 change: 0 additions & 1 deletion gstools/covmodel/tpl_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
TPLStable
"""
# pylint: disable=C0103, E1101
from __future__ import print_function, division, absolute_import

import warnings
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion gstools/field/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

----
"""
from __future__ import absolute_import

from gstools.field.srf import SRF

Expand Down
3 changes: 1 addition & 2 deletions gstools/field/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Field
"""
# pylint: disable=C0103
from __future__ import division, absolute_import, print_function

from functools import partial

Expand All @@ -23,7 +22,7 @@
__all__ = ["Field"]


class Field(object):
class Field:
"""A field base class for random and kriging fields ect.
Parameters
Expand Down
7 changes: 2 additions & 5 deletions gstools/field/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +26,7 @@
__all__ = ["RandMeth", "IncomprRandMeth"]


class RandMeth(object):
class RandMeth:
r"""Randomization method for calculating isotropic spatial random fields.

Parameters
Expand Down Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion gstools/field/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading