Skip to content
Snippets Groups Projects
Commit aa96bfc0 authored by Joseph Weston's avatar Joseph Weston
Browse files

merge branch 'bump_versions'

Bump required Python version and library dependencies to the
oldest supported ones. With the release of Debian Stretch
the oldest supported platform is Ubuntu 16.04, which has:

+ Python 3.5
+ numpy 0.11.0
+ scipy 0.17.0
+ matplotlib 1.5.1

We are making these changes now in the expectation that we
will not make a new release before 6 months have elapsed, in
line with our policy to support old platforms for 6 months
after they are supplanted.

Closes #31

See merge request !146
parents f8c12443 7fc080d5
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -29,10 +29,10 @@ Prerequisites
=============
Building Kwant requires
* `Python <https://www.python.org/>`_ 3.4 or above (Kwant 1.1 is the last
* `Python <https://www.python.org/>`_ 3.5 or above (Kwant 1.1 is the last
version to support Python 2),
* `NumPy <http://numpy.org/>`_ 1.8.1 or newer,
* `SciPy <https://scipy.org/>`_ 0.14 or newer,
* `NumPy <http://numpy.org/>`_ 1.11.0 or newer,
* `SciPy <https://scipy.org/>`_ 0.17.0 or newer,
* `LAPACK <http://netlib.org/lapack/>`_ and `BLAS <http://netlib.org/blas/>`_,
(For best performance we recommend the free `OpenBLAS
<http://www.openblas.net/>`_ or the nonfree `MKL
......@@ -43,7 +43,7 @@ a NumPy-like Python package optimized for very small arrays,
C++.
The following software is highly recommended though not strictly required:
* `matplotlib <http://matplotlib.org/>`_ 1.4.2 or newer, for the module `kwant.plotter` and the tutorial,
* `matplotlib <http://matplotlib.org/>`_ 1.5.1 or newer, for the module `kwant.plotter` and the tutorial,
* `SymPy <http://sympy.org/>`_ 0.7.6 or newer, for the subpackage `kwant.continuum`.
* `MUMPS <http://graal.ens-lyon.fr/MUMPS/>`_, a sparse linear algebra library
that will in many cases speed up Kwant several times and reduce the memory
......
......@@ -158,6 +158,7 @@ def make_sparse_full(ham, args, params, CGraph gr, diag,
# hack around a bug in Scipy + Python 3 + memoryviews
# see https://github.com/scipy/scipy/issues/5123 for details
# TODO: remove this once we depend on scipy >= 0.18.
np_data = np.asarray(data)
np_rows_cols = np.asarray(rows_cols)
np_to_off = np.asarray(to_off)
......
......@@ -10,7 +10,6 @@
from math import sin, cos, sqrt, pi, copysign
from collections import namedtuple
import warnings
from itertools import combinations_with_replacement
import numpy as np
import numpy.linalg as npl
......@@ -25,20 +24,6 @@ dot = np.dot
__all__ = ['selfenergy', 'modes', 'PropagatingModes', 'StabilizedModes']
# TODO: Once Kwant depends on numpy >= 1.11, remove the fix
with warnings.catch_warnings():
warnings.simplefilter("ignore")
split_fixed = np.split(np.zeros((0, 2)), 2)[0].shape == (0, 2)
if split_fixed: # skip coverage
split = np.split
else: # skip coverage
def split(array, n, axis=0):
if array.shape[axis] != 0:
return np.split(array, n, axis)
else:
return n * [array]
# TODO: Use scipy block_diag once we depend on scipy>=0.19
try:
# Throws ValueError, but if fixed ensure that works as intended
......@@ -97,7 +82,7 @@ def group_halves(arr_list):
of each array appear first:
`[a b], [c d], [e f] -> [a c e b d f]`
"""
list_ = [split(arr, 2) for arr in arr_list]
list_ = [np.split(arr, 2) for arr in arr_list]
lefts, rights = zip(*list_)
return np.r_[tuple(lefts + rights)]
......@@ -798,9 +783,6 @@ def make_proper_modes(lmbdainv, psi, extract, tol, particle_hole,
order = np.lexsort([TRIM_PHS_sort, velocities,
-np.sign(velocities) * momenta, np.sign(velocities)])
# TODO: Remove the check once we depend on numpy>=1.8.
if not len(order):
order = slice(None)
velocities = velocities[order]
momenta = momenta[order]
full_psi = full_psi[:, order]
......
......@@ -58,24 +58,6 @@ __all__ = ['plot', 'map', 'bands', 'spectrum', 'current',
'sys_leads_hopping_pos', 'mask_interpolate']
# TODO: Remove the following once we depend on matplotlib >= 1.4.1.
def matplotlib_chores():
global pre_1_4_matplotlib
ver = matplotlib.__version__
if ver == "1.4.0":
warnings.warn("Matplotlib 1.4.0 has a bug that makes 3D plotting "
"unusable (2D plotting is not affected). Please "
"consider using a different version of matplotlib.",
RuntimeWarning)
pre_1_4_matplotlib = [int(x) for x in ver.split('.')[:2]] < [1, 4]
if mpl_enabled:
matplotlib_chores()
# Collections that allow for symbols and linewiths to be given in data space
# (not for general use, only implement what's needed for plotter)
def isarray(var):
......@@ -125,13 +107,9 @@ if mpl_enabled:
self.reflen = reflen
self.linewidths_orig = nparray_if_array(self.get_linewidths())
if pre_1_4_matplotlib:
self.transforms = [matplotlib.transforms.Affine2D().scale(x)
for x in sizes]
else:
self.transforms = np.array(
[matplotlib.transforms.Affine2D().scale(x).get_matrix()
for x in sizes])
self.transforms = np.array(
[matplotlib.transforms.Affine2D().scale(x).get_matrix()
for x in sizes])
def get_transforms(self):
return self.transforms
......@@ -252,12 +230,8 @@ if mpl_enabled:
self.edgecolors_orig = nparray_if_array(self.get_edgecolors())
Affine2D = matplotlib.transforms.Affine2D
if pre_1_4_matplotlib:
self.orig_transforms = np.array(
[Affine2D().scale(x) for x in sizes], dtype='object')
else:
self.orig_transforms = np.array(
[Affine2D().scale(x).get_matrix() for x in sizes])
self.orig_transforms = np.array(
[Affine2D().scale(x).get_matrix() for x in sizes])
self.transforms = self.orig_transforms
def set_array(self, array):
......
......@@ -124,6 +124,16 @@ def configure_extensions(exts, aliases=(), build_summary=None):
return exts
def check_python_version(min_version):
installed_version = sys.version_info[:3]
if installed_version < min_version:
print('Error: Python {} required, but {} is installed'.format(
'.'.join(map(str, min_version)),
'.'.join(map(str, installed_version)))
)
sys.exit(1)
def check_versions():
global version, version_is_from_git
......@@ -557,6 +567,7 @@ def maybe_cythonize(exts):
def main():
check_python_version((3, 5))
check_versions()
exts = collections.OrderedDict([
......@@ -643,11 +654,11 @@ def main():
'build_tut': build_tut,
'test': test},
ext_modules=exts,
install_requires=['numpy >= 1.8.1', 'scipy >= 0.14',
install_requires=['numpy >= 1.11.0', 'scipy >= 0.17.0',
'tinyarray >= 1.2'],
extras_require={
'plotting': 'matplotlib >= 1.4.2',
# Ubuntu 16.04 is the oldest supported distro with python3-sympy
# The oldest versions between: Debian stable, Ubuntu LTS
'plotting': 'matplotlib >= 1.5.1',
'continuum': 'sympy >= 0.7.6',
},
classifiers=[c.strip() for c in classifiers.split('\n')])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment