[yt-svn] commit/yt: 10 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon May 15 11:20:29 PDT 2017


10 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/ce9abf01dad0/
Changeset:   ce9abf01dad0
User:        ngoldbaum
Date:        2017-05-15 15:14:21+00:00
Summary:     Remove unnecessary __hg_version__.py logic
Affected #:  2 files

diff -r 31f9175e8d8bce23bc870fd6c092011e2acf3964 -r ce9abf01dad0433089bc016ba5f75f315f57e9ef setup.py
--- a/setup.py
+++ b/setup.py
@@ -6,10 +6,11 @@
 from setuptools.extension import Extension
 from setuptools.command.build_ext import build_ext as _build_ext
 from setuptools.command.sdist import sdist as _sdist
-from setuptools.command.build_py import build_py as _build_py
 from setupext import \
-    check_for_openmp, check_for_pyembree, read_embree_location, \
-    get_mercurial_changeset_id, in_conda_env
+    check_for_openmp, \
+    check_for_pyembree, \
+    read_embree_location, \
+    in_conda_env
 from distutils.version import LooseVersion
 import pkg_resources
 
@@ -284,27 +285,6 @@
                   library_dirs=[ldir],
                   include_dirs=[idir]))
 
-class build_py(_build_py):
-    def run(self):
-        # honor the --dry-run flag
-        if not self.dry_run:
-            target_dir = os.path.join(self.build_lib, 'yt')
-            src_dir = os.getcwd()
-            changeset = get_mercurial_changeset_id(src_dir)
-            self.mkpath(target_dir)
-            with open(os.path.join(target_dir, '__hg_version__.py'), 'w') as fobj:
-                fobj.write("hg_version = '%s'\n" % changeset)
-        _build_py.run(self)
-
-    def get_outputs(self):
-        # http://bitbucket.org/yt_analysis/yt/issues/1296
-        outputs = _build_py.get_outputs(self)
-        outputs.append(
-            os.path.join(self.build_lib, 'yt', '__hg_version__.py')
-        )
-        return outputs
-
-
 class build_ext(_build_ext):
     # subclass setuptools extension builder to avoid importing cython and numpy
     # at top level in setup.py. See http://stackoverflow.com/a/21621689/1382869
@@ -380,7 +360,7 @@
     extras_require = {
         'hub':  ["girder_client"]
     },
-    cmdclass={'sdist': sdist, 'build_ext': build_ext, 'build_py': build_py},
+    cmdclass={'sdist': sdist, 'build_ext': build_ext},
     author="The yt project",
     author_email="yt-dev at lists.spacepope.org",
     url="http://yt-project.org/",

diff -r 31f9175e8d8bce23bc870fd6c092011e2acf3964 -r ce9abf01dad0433089bc016ba5f75f315f57e9ef setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -142,20 +142,3 @@
         shutil.rmtree(tmpdir)
 
     return rd
-
-
-def get_mercurial_changeset_id(target_dir):
-    '''
-    Returns changeset and branch using hglib
-    '''
-    try:
-        import hglib
-    except ImportError:
-        return None
-    try:
-        with hglib.open(target_dir) as repo:
-            changeset = repo.identify(
-                id=True, branch=True).strip().decode('utf8')
-    except hglib.error.ServerError:
-        return None
-    return changeset


https://bitbucket.org/yt_analysis/yt/commits/d527e758fb0a/
Changeset:   d527e758fb0a
User:        ngoldbaum
Date:        2017-05-15 15:14:43+00:00
Summary:     Bail setup.py for unsupported python3 versions
Affected #:  1 file

diff -r ce9abf01dad0433089bc016ba5f75f315f57e9ef -r d527e758fb0a58f1763b6b7d3a4a28bb9e05e67e setup.py
--- a/setup.py
+++ b/setup.py
@@ -15,9 +15,10 @@
 import pkg_resources
 
 
-if sys.version_info < (2, 7):
-    print("yt currently requires Python version 2.7")
-    print("certain features may fail unexpectedly and silently with older versions.")
+if sys.version_info < (2, 7) or (3, 0) < sys.version_info < (3, 3):
+    print("yt currently supports Python 2.7 or versions newer than Python 3.4")
+    print("certain features may fail unexpectedly and silently with older "
+          "versions.")
     sys.exit(1)
 
 try:


https://bitbucket.org/yt_analysis/yt/commits/57302b0b05b0/
Changeset:   57302b0b05b0
User:        ngoldbaum
Date:        2017-05-15 15:15:12+00:00
Summary:     Bail when cython and numpy aren't installed and building from source

This eliminates usage of the problematic `setup_requires` option, which will
always install dependencies as eggs using easy_install in a .eggs folder in the
yt source distribution. Unfortunately that means yt users who want to build from
source but do not have cython or numpy installed will need to wait to build
these two libraries from source and will not get the wheels or conda packages
they would otherwise get if they used pip or conda to install these
dependencies.

Rather than relying on a poor solution from setuptools, let's instead simply
bail from the setup.py script with an error message, telling people to install
our build dependencies using a package manager.
Affected #:  1 file

diff -r d527e758fb0a58f1763b6b7d3a4a28bb9e05e67e -r 57302b0b05b0c0362c766754544b5797eaa92bf7 setup.py
--- a/setup.py
+++ b/setup.py
@@ -290,6 +290,24 @@
     # subclass setuptools extension builder to avoid importing cython and numpy
     # at top level in setup.py. See http://stackoverflow.com/a/21621689/1382869
     def finalize_options(self):
+        try:
+            import cython
+            import numpy
+        except ImportError:
+            raise ImportError(
+                'Building yt from source requires cython and numpy to be '
+                'installed. Please install these packages using the '
+                'appropriate package manager for your python environment.')
+        if LooseVersion(cython.__version__) < LooseVersion('0.24'):
+            raise RuntimeError(
+                'Building yt from source requires Cython 0.24 or newer. Please '
+                'update Cython using the appropriate package manager for your '
+                'python environment.')
+        if LooseVersion(numpy.__version__) < LooseVersion('1.9'):
+            raise RuntimeError(
+                'Building yt from source requires NumPy 1.9 or newer. Please '
+                'update NumPy using the appropriate package manager for your '
+                'python environment.')            
         from Cython.Build import cythonize
         self.distribution.ext_modules[:] = cythonize(
                 self.distribution.ext_modules)
@@ -302,7 +320,6 @@
             __builtins__["__NUMPY_SETUP__"] = False
         else:
             __builtins__.__NUMPY_SETUP__ = False
-        import numpy
         self.include_dirs.append(numpy.get_include())
 
 class sdist(_sdist):
@@ -346,10 +363,6 @@
     },
     packages=find_packages(),
     include_package_data = True,
-    setup_requires=[
-        'numpy',
-        'cython>=0.24',
-    ],
     install_requires=[
         'matplotlib',
         'setuptools>=19.6',


https://bitbucket.org/yt_analysis/yt/commits/400a71c92cac/
Changeset:   400a71c92cac
User:        ngoldbaum
Date:        2017-05-15 15:20:05+00:00
Summary:     Impose minimum versions of our dependencies
Affected #:  1 file

diff -r 57302b0b05b0c0362c766754544b5797eaa92bf7 -r 400a71c92cacdffa92753fd044114d585745059a setup.py
--- a/setup.py
+++ b/setup.py
@@ -364,12 +364,11 @@
     packages=find_packages(),
     include_package_data = True,
     install_requires=[
-        'matplotlib',
+        'matplotlib>=1.5.3',
         'setuptools>=19.6',
-        'sympy',
-        'numpy',
-        'IPython',
-        'cython',
+        'sympy>=1.0',
+        'numpy>=1.9',
+        'IPython>=1.0',
     ],
     extras_require = {
         'hub':  ["girder_client"]


https://bitbucket.org/yt_analysis/yt/commits/a3b105094cc6/
Changeset:   a3b105094cc6
User:        ngoldbaum
Date:        2017-05-15 15:20:28+00:00
Summary:     clarify we use BSD 3-clause in our setup.py
Affected #:  1 file

diff -r 400a71c92cacdffa92753fd044114d585745059a -r a3b105094cc6be42480d370513f0b6863e4a2496 setup.py
--- a/setup.py
+++ b/setup.py
@@ -377,7 +377,7 @@
     author="The yt project",
     author_email="yt-dev at lists.spacepope.org",
     url="http://yt-project.org/",
-    license="BSD",
+    license="BSD 3-Clause",
     zip_safe=False,
     scripts=["scripts/iyt"],
     ext_modules=cython_extensions + extensions,


https://bitbucket.org/yt_analysis/yt/commits/f7e5435a9620/
Changeset:   f7e5435a9620
User:        ngoldbaum
Date:        2017-05-15 15:31:39+00:00
Summary:     massage text of error messages
Affected #:  1 file

diff -r a3b105094cc6be42480d370513f0b6863e4a2496 -r f7e5435a962073710a284d5d49c01fe6f62d53be setup.py
--- a/setup.py
+++ b/setup.py
@@ -295,19 +295,21 @@
             import numpy
         except ImportError:
             raise ImportError(
-                'Building yt from source requires cython and numpy to be '
-                'installed. Please install these packages using the '
-                'appropriate package manager for your python environment.')
+"""Could not import cython or numpy. Building yt from source requires
+cython and numpy to be installed. Please install these packages using
+the appropriate package manager for your python environment.""")
         if LooseVersion(cython.__version__) < LooseVersion('0.24'):
             raise RuntimeError(
-                'Building yt from source requires Cython 0.24 or newer. Please '
-                'update Cython using the appropriate package manager for your '
-                'python environment.')
+"""Building yt from source requires Cython 0.24 or newer but
+Cython %s is installed. Please update Cython using the appropriate
+package manager for your python environment.""" %
+                cython.__version__)
         if LooseVersion(numpy.__version__) < LooseVersion('1.9'):
             raise RuntimeError(
-                'Building yt from source requires NumPy 1.9 or newer. Please '
-                'update NumPy using the appropriate package manager for your '
-                'python environment.')            
+"""Building yt from source requires NumPy 1.9 or newer but
+NumPy %s is installed. Please update NumPy using the appropriate
+package manager for your python environment.""" %
+                numpy.__version__)
         from Cython.Build import cythonize
         self.distribution.ext_modules[:] = cythonize(
                 self.distribution.ext_modules)


https://bitbucket.org/yt_analysis/yt/commits/7ee4329ca016/
Changeset:   7ee4329ca016
User:        ngoldbaum
Date:        2017-05-15 15:40:43+00:00
Summary:     add travis job to test minimum required versions of dependencies
Affected #:  1 file

diff -r f7e5435a962073710a284d5d49c01fe6f62d53be -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 .travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,9 +10,22 @@
     packages:
       - libhdf5-serial-dev
 
+env:
+  global:
+    NUMPY=numpy
+    CYTHON=cython
+    MATPLOTLIB=matplotlib
+    SYMPY=sympy
+    H5PY=h5py
+    SCIPY=scipy
+    IPYTHON=ipython
+    FASTCACHE=fastcache
+
 matrix:
   include:
     - python: 2.7
+      env: NUMPY=numpy==1.9.0 CYTHON=cython==0.24 MATPLOTLIB=matplotlib==1.5.3 SYMPY=sympy==1.0 H5PY= SCIPY= FASTCACHE= IPYTHON=ipython==1.0
+    - python: 2.7
     - python: 3.4
     - python: 3.5
     - python: 3.6
@@ -52,7 +65,7 @@
     pip install --upgrade wheel
     pip install --upgrade setuptools
     # Install dependencies
-    pip install mock numpy scipy cython matplotlib sympy fastcache nose flake8 h5py ipython nose-timer
+    pip install mock $NUMPY $SCIPY $H5PY $CYTHON $MATPLOTLIB $SYMPY $FASTCACHE $IPYTHON nose flake8 nose-timer
     # install yt
     pip install -e .
 


https://bitbucket.org/yt_analysis/yt/commits/fe7ae9b1375e/
Changeset:   fe7ae9b1375e
User:        ngoldbaum
Date:        2017-05-15 16:04:05+00:00
Summary:     remove compatibility code for unsupported versions of dependencies
Affected #:  8 files

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -2,7 +2,6 @@
 from __future__ import print_function
 import os
 import re
-from distutils.version import LooseVersion
 from yt.mods import *
 from yt.data_objects.data_containers import YTDataContainer
 namespace = locals().copy()
@@ -25,38 +24,11 @@
     code.interact(doc, None, namespace)
     sys.exit()
 
-if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
-    api_version = '0.10'
-elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
-    api_version = '0.11'
-else:
-    api_version = '1.0'
-
-if api_version == "0.10" and "DISPLAY" in os.environ:
-    from matplotlib import rcParams
-    ipbackends = dict(Qt4 = IPython.Shell.IPShellMatplotlibQt4,
-                      WX  = IPython.Shell.IPShellMatplotlibWX,
-                      GTK = IPython.Shell.IPShellMatplotlibGTK,
-                      Qt  = IPython.Shell.IPShellMatplotlibQt)
-    bend = (rcParams["backend"]).rstrip('Agg')
-
-    try:
-        ip_shell = ipbackends[bend](user_ns=namespace)
-    except KeyError:
-        ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
-elif api_version == "0.10":
-    ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
-else:
-    if api_version == "0.11":
-        from IPython.frontend.terminal.interactiveshell import \
-            TerminalInteractiveShell
-    elif api_version == "1.0":
-        from IPython.terminal.interactiveshell import TerminalInteractiveShell
-    else:
-        raise RuntimeError
-    ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
-                    display_banner = True)
-    if "DISPLAY" in os.environ: ip_shell.enable_pylab(import_all=False)
+from IPython.terminal.interactiveshell import TerminalInteractiveShell
+ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
+                                    display_banner = True)
+if "DISPLAY" in os.environ:
+    ip_shell.enable_pylab(import_all=False)
 
 
 # The rest is a modified version of the IPython default profile code
@@ -82,14 +54,9 @@
 # Most of your config files and extensions will probably start with this import
 
 #import IPython.ipapi
-if api_version == "0.10":
-    ip = ip_shell.IP.getapi()
-    try_next = IPython.ipapi.TryNext
-    kwargs = dict(sys_exit=1, banner=doc)
-elif api_version in ("0.11", "1.0"):
-    ip = ip_shell
-    try_next = IPython.core.error.TryNext
-    kwargs = dict()
+ip = ip_shell
+try_next = IPython.core.error.TryNext
+kwargs = dict()
 
 ip.ex("from yt.mods import *")
 ip.ex("import yt")

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -34,7 +34,6 @@
 import numpy
 import matplotlib
 import getpass
-from distutils.version import LooseVersion
 from math import floor, ceil
 from numbers import Number as numeric_type
 
@@ -286,17 +285,6 @@
      %(filename)s:%(lineno)s
 """
 
-def get_ipython_api_version():
-    import IPython
-    if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
-        api_version = '0.10'
-    elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
-        api_version = '0.11'
-    else:
-        api_version = '1.0'
-
-    return api_version
-
 def insert_ipython(num_up=1):
     """
     Placed inside a function, this will insert an IPython interpreter at that
@@ -306,31 +294,22 @@
     defaults to 1 so that this function itself is stripped off.
     """
     import IPython
-    api_version = get_ipython_api_version()
+    from IPython.terminal.embed import InteractiveShellEmbed
+    try:
+        from traitlets.config.loader import Config
+    except ImportError:
+        from IPython.config.loader import Config
 
     frame = inspect.stack()[num_up]
     loc = frame[0].f_locals.copy()
     glo = frame[0].f_globals
     dd = dict(fname = frame[3], filename = frame[1],
               lineno = frame[2])
-    if api_version == '0.10':
-        ipshell = IPython.Shell.IPShellEmbed()
-        ipshell(header = __header % dd,
-                local_ns = loc, global_ns = glo)
-    else:
-        try:
-            from traitlets.config.loader import Config
-        except ImportError:
-            from IPython.config.loader import Config
-        cfg = Config()
-        cfg.InteractiveShellEmbed.local_ns = loc
-        cfg.InteractiveShellEmbed.global_ns = glo
-        IPython.embed(config=cfg, banner2 = __header % dd)
-        if api_version == '0.11':
-            from IPython.frontend.terminal.embed import InteractiveShellEmbed
-        else:
-            from IPython.terminal.embed import InteractiveShellEmbed
-        ipshell = InteractiveShellEmbed(config=cfg)
+    cfg = Config()
+    cfg.InteractiveShellEmbed.local_ns = loc
+    cfg.InteractiveShellEmbed.global_ns = glo
+    IPython.embed(config=cfg, banner2 = __header % dd)
+    ipshell = InteractiveShellEmbed(config=cfg)
 
     del ipshell
 

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -736,33 +736,21 @@
         import yt
 
         import IPython
-        from distutils import version
-        if version.LooseVersion(IPython.__version__) <= version.LooseVersion('0.10'):
-            api_version = '0.10'
-        else:
-            api_version = '0.11'
 
         local_ns = yt.mods.__dict__.copy()
         local_ns['ds'] = args.ds
         local_ns['pf'] = args.ds
         local_ns['yt'] = yt
 
-        if api_version == '0.10':
-            shell = IPython.Shell.IPShellEmbed()
-            shell(local_ns = local_ns,
-                  header =
-                  "\nHi there!  Welcome to yt.\n\nWe've loaded your dataset as 'ds'.  Enjoy!"
-                  )
-        else:
-            try:
-                from traitlets.config.loader import Config
-            except ImportError:
-                from IPython.config.loader import Config
-            import sys
-            cfg = Config()
-            # prepend sys.path with current working directory
-            sys.path.insert(0,'')
-            IPython.embed(config=cfg,user_ns=local_ns)
+        try:
+            from traitlets.config.loader import Config
+        except ImportError:
+            from IPython.config.loader import Config
+        import sys
+        cfg = Config()
+        # prepend sys.path with current working directory
+        sys.path.insert(0,'')
+        IPython.embed(config=cfg,user_ns=local_ns)
 
 class YTMapserverCmd(YTCommand):
     args = ("proj", "field", "weight",

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -10,7 +10,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import matplotlib
 import matplotlib._png as _png
 from yt.extern.six import PY2
 
@@ -18,17 +17,9 @@
     from cStringIO import StringIO
 else:
     from io import BytesIO as StringIO
-from distutils.version import LooseVersion
 
-MPL_VERSION = LooseVersion(matplotlib.__version__)
-MPL_API_2_VERSION = LooseVersion("1.5.0")
-
-if MPL_VERSION < MPL_API_2_VERSION:
-    def call_png_write_png(buffer, width, height, filename, dpi):
-        _png.write_png(buffer, width, height, filename, dpi)
-else:
-    def call_png_write_png(buffer, width, height, filename, dpi):
-        _png.write_png(buffer, filename, dpi)
+def call_png_write_png(buffer, width, height, filename, dpi):
+    _png.write_png(buffer, filename, dpi)
 
 def write_png(buffer, filename, dpi=100):
     width = buffer.shape[1]

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -32,7 +32,7 @@
     ytcfg
 from yt.funcs import \
     get_image_suffix, \
-    get_ipython_api_version, iterable, \
+    iterable, \
     ensure_dir, \
     ensure_list
 from yt.utilities.exceptions import \
@@ -655,12 +655,8 @@
                 v.show()
         else:
             if "__IPYTHON__" in dir(builtins):
-                api_version = get_ipython_api_version()
-                if api_version in ('0.10', '0.11'):
-                    self._send_zmq()
-                else:
-                    from IPython.display import display
-                    display(self)
+                from IPython.display import display
+                display(self)
 
     @validate_plot
     def display(self, name=None, mpl_kwargs=None):

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -21,7 +21,6 @@
 import numpy as np
 import re
 
-from distutils.version import LooseVersion
 from functools import wraps
 
 from yt.funcs import \
@@ -460,6 +459,8 @@
         self.data_source = data_source
 
     def __call__(self, plot):
+        from matplotlib.tri import Triangulation, LinearTriInterpolator
+
         # These need to be in code_length
         x0, x1 = (v.in_units("code_length") for v in plot.xlim)
         y0, y1 = (v.in_units("code_length") for v in plot.ylim)
@@ -517,14 +518,8 @@
 
             # Both the input and output from the triangulator are in plot
             # coordinates
-            if LooseVersion(matplotlib.__version__) < LooseVersion("1.4.0"):
-                from matplotlib.delaunay.triangulate import Triangulation as \
-                    triang
-                zi = triang(x,y).nn_interpolator(z)(xi,yi)
-            else:
-                from matplotlib.tri import Triangulation, LinearTriInterpolator
-                triangulation = Triangulation(x, y)
-                zi = LinearTriInterpolator(triangulation, z)(xi,yi)
+            triangulation = Triangulation(x, y)
+            zi = LinearTriInterpolator(triangulation, z)(xi,yi)
         elif plot._type_name == 'OffAxisProjection':
             zi = plot.frb[self.field][::self.factor,::self.factor].transpose()
 

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -72,15 +72,11 @@
 
 # Some magic for dealing with pyparsing being included or not
 # included in matplotlib (not in gentoo, yes in everything else)
-# Also accounting for the fact that in 1.2.0, pyparsing got renamed.
 try:
-    if MPL_VERSION < LooseVersion("1.2.0"):
-        from matplotlib.pyparsing import ParseFatalException
+    if sys.version_info[0] == 3:
+        from matplotlib.pyparsing_py3 import ParseFatalException
     else:
-        if sys.version_info[0] == 3:
-            from matplotlib.pyparsing_py3 import ParseFatalException
-        else:
-            from matplotlib.pyparsing_py2 import ParseFatalException
+        from matplotlib.pyparsing_py2 import ParseFatalException
 except ImportError:
     from pyparsing import ParseFatalException
 

diff -r 7ee4329ca016a4b0f897a3d0eb8faa17e1868e92 -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -41,7 +41,6 @@
 from yt.funcs import \
     ensure_list, \
     get_image_suffix, \
-    get_ipython_api_version, \
     matplotlib_style_context
 
 def get_canvas(name):
@@ -313,12 +312,8 @@
 
         """
         if "__IPYTHON__" in dir(builtins):
-            api_version = get_ipython_api_version()
-            if api_version in ('0.10', '0.11'):
-                self._send_zmq()
-            else:
-                from IPython.display import display
-                display(self)
+            from IPython.display import display
+            display(self)
         else:
             raise YTNotInsideNotebook
 


https://bitbucket.org/yt_analysis/yt/commits/49a870a22769/
Changeset:   49a870a22769
User:        ngoldbaum
Date:        2017-05-15 16:50:47+00:00
Summary:     bump minimum numpy version
Affected #:  2 files

diff -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc -r 49a870a22769d44fcb47c3e1fb26cf462bf2ddf1 .travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,7 +24,7 @@
 matrix:
   include:
     - python: 2.7
-      env: NUMPY=numpy==1.9.0 CYTHON=cython==0.24 MATPLOTLIB=matplotlib==1.5.3 SYMPY=sympy==1.0 H5PY= SCIPY= FASTCACHE= IPYTHON=ipython==1.0
+      env: NUMPY=numpy==1.10.4 CYTHON=cython==0.24 MATPLOTLIB=matplotlib==1.5.3 SYMPY=sympy==1.0 H5PY= SCIPY= FASTCACHE= IPYTHON=ipython==1.0
     - python: 2.7
     - python: 3.4
     - python: 3.5

diff -r fe7ae9b1375e50fbd68321f1996823a3ec07eebc -r 49a870a22769d44fcb47c3e1fb26cf462bf2ddf1 setup.py
--- a/setup.py
+++ b/setup.py
@@ -304,9 +304,9 @@
 Cython %s is installed. Please update Cython using the appropriate
 package manager for your python environment.""" %
                 cython.__version__)
-        if LooseVersion(numpy.__version__) < LooseVersion('1.9'):
+        if LooseVersion(numpy.__version__) < LooseVersion('1.10.4'):
             raise RuntimeError(
-"""Building yt from source requires NumPy 1.9 or newer but
+"""Building yt from source requires NumPy 1.10.4 or newer but
 NumPy %s is installed. Please update NumPy using the appropriate
 package manager for your python environment.""" %
                 numpy.__version__)
@@ -369,7 +369,7 @@
         'matplotlib>=1.5.3',
         'setuptools>=19.6',
         'sympy>=1.0',
-        'numpy>=1.9',
+        'numpy>=1.10.4',
         'IPython>=1.0',
     ],
     extras_require = {


https://bitbucket.org/yt_analysis/yt/commits/2f68d487b866/
Changeset:   2f68d487b866
User:        ngoldbaum
Date:        2017-05-15 18:20:13+00:00
Summary:     Merge pull request #1388 from ngoldbaum/setup-improvements

Setup improvements
Affected #:  11 files

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 .travis.yml
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,9 +10,22 @@
     packages:
       - libhdf5-serial-dev
 
+env:
+  global:
+    NUMPY=numpy
+    CYTHON=cython
+    MATPLOTLIB=matplotlib
+    SYMPY=sympy
+    H5PY=h5py
+    SCIPY=scipy
+    IPYTHON=ipython
+    FASTCACHE=fastcache
+
 matrix:
   include:
     - python: 2.7
+      env: NUMPY=numpy==1.10.4 CYTHON=cython==0.24 MATPLOTLIB=matplotlib==1.5.3 SYMPY=sympy==1.0 H5PY= SCIPY= FASTCACHE= IPYTHON=ipython==1.0
+    - python: 2.7
     - python: 3.4
     - python: 3.5
     - python: 3.6
@@ -52,7 +65,7 @@
     pip install --upgrade wheel
     pip install --upgrade setuptools
     # Install dependencies
-    pip install mock numpy scipy cython matplotlib sympy fastcache nose flake8 h5py ipython nose-timer
+    pip install mock $NUMPY $SCIPY $H5PY $CYTHON $MATPLOTLIB $SYMPY $FASTCACHE $IPYTHON nose flake8 nose-timer
     # install yt
     pip install -e .
 

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -2,7 +2,6 @@
 from __future__ import print_function
 import os
 import re
-from distutils.version import LooseVersion
 from yt.mods import *
 from yt.data_objects.data_containers import YTDataContainer
 namespace = locals().copy()
@@ -25,38 +24,11 @@
     code.interact(doc, None, namespace)
     sys.exit()
 
-if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
-    api_version = '0.10'
-elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
-    api_version = '0.11'
-else:
-    api_version = '1.0'
-
-if api_version == "0.10" and "DISPLAY" in os.environ:
-    from matplotlib import rcParams
-    ipbackends = dict(Qt4 = IPython.Shell.IPShellMatplotlibQt4,
-                      WX  = IPython.Shell.IPShellMatplotlibWX,
-                      GTK = IPython.Shell.IPShellMatplotlibGTK,
-                      Qt  = IPython.Shell.IPShellMatplotlibQt)
-    bend = (rcParams["backend"]).rstrip('Agg')
-
-    try:
-        ip_shell = ipbackends[bend](user_ns=namespace)
-    except KeyError:
-        ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
-elif api_version == "0.10":
-    ip_shell = IPython.Shell.IPShellMatplotlib(user_ns=namespace)
-else:
-    if api_version == "0.11":
-        from IPython.frontend.terminal.interactiveshell import \
-            TerminalInteractiveShell
-    elif api_version == "1.0":
-        from IPython.terminal.interactiveshell import TerminalInteractiveShell
-    else:
-        raise RuntimeError
-    ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
-                    display_banner = True)
-    if "DISPLAY" in os.environ: ip_shell.enable_pylab(import_all=False)
+from IPython.terminal.interactiveshell import TerminalInteractiveShell
+ip_shell = TerminalInteractiveShell(user_ns=namespace, banner1 = doc,
+                                    display_banner = True)
+if "DISPLAY" in os.environ:
+    ip_shell.enable_pylab(import_all=False)
 
 
 # The rest is a modified version of the IPython default profile code
@@ -82,14 +54,9 @@
 # Most of your config files and extensions will probably start with this import
 
 #import IPython.ipapi
-if api_version == "0.10":
-    ip = ip_shell.IP.getapi()
-    try_next = IPython.ipapi.TryNext
-    kwargs = dict(sys_exit=1, banner=doc)
-elif api_version in ("0.11", "1.0"):
-    ip = ip_shell
-    try_next = IPython.core.error.TryNext
-    kwargs = dict()
+ip = ip_shell
+try_next = IPython.core.error.TryNext
+kwargs = dict()
 
 ip.ex("from yt.mods import *")
 ip.ex("import yt")

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 setup.py
--- a/setup.py
+++ b/setup.py
@@ -6,17 +6,19 @@
 from setuptools.extension import Extension
 from setuptools.command.build_ext import build_ext as _build_ext
 from setuptools.command.sdist import sdist as _sdist
-from setuptools.command.build_py import build_py as _build_py
 from setupext import \
-    check_for_openmp, check_for_pyembree, read_embree_location, \
-    get_mercurial_changeset_id, in_conda_env
+    check_for_openmp, \
+    check_for_pyembree, \
+    read_embree_location, \
+    in_conda_env
 from distutils.version import LooseVersion
 import pkg_resources
 
 
-if sys.version_info < (2, 7):
-    print("yt currently requires Python version 2.7")
-    print("certain features may fail unexpectedly and silently with older versions.")
+if sys.version_info < (2, 7) or (3, 0) < sys.version_info < (3, 3):
+    print("yt currently supports Python 2.7 or versions newer than Python 3.4")
+    print("certain features may fail unexpectedly and silently with older "
+          "versions.")
     sys.exit(1)
 
 try:
@@ -290,31 +292,30 @@
                   library_dirs=[ldir],
                   include_dirs=[idir]))
 
-class build_py(_build_py):
-    def run(self):
-        # honor the --dry-run flag
-        if not self.dry_run:
-            target_dir = os.path.join(self.build_lib, 'yt')
-            src_dir = os.getcwd()
-            changeset = get_mercurial_changeset_id(src_dir)
-            self.mkpath(target_dir)
-            with open(os.path.join(target_dir, '__hg_version__.py'), 'w') as fobj:
-                fobj.write("hg_version = '%s'\n" % changeset)
-        _build_py.run(self)
-
-    def get_outputs(self):
-        # http://bitbucket.org/yt_analysis/yt/issues/1296
-        outputs = _build_py.get_outputs(self)
-        outputs.append(
-            os.path.join(self.build_lib, 'yt', '__hg_version__.py')
-        )
-        return outputs
-
-
 class build_ext(_build_ext):
     # subclass setuptools extension builder to avoid importing cython and numpy
     # at top level in setup.py. See http://stackoverflow.com/a/21621689/1382869
     def finalize_options(self):
+        try:
+            import cython
+            import numpy
+        except ImportError:
+            raise ImportError(
+"""Could not import cython or numpy. Building yt from source requires
+cython and numpy to be installed. Please install these packages using
+the appropriate package manager for your python environment.""")
+        if LooseVersion(cython.__version__) < LooseVersion('0.24'):
+            raise RuntimeError(
+"""Building yt from source requires Cython 0.24 or newer but
+Cython %s is installed. Please update Cython using the appropriate
+package manager for your python environment.""" %
+                cython.__version__)
+        if LooseVersion(numpy.__version__) < LooseVersion('1.10.4'):
+            raise RuntimeError(
+"""Building yt from source requires NumPy 1.10.4 or newer but
+NumPy %s is installed. Please update NumPy using the appropriate
+package manager for your python environment.""" %
+                numpy.__version__)
         from Cython.Build import cythonize
         self.distribution.ext_modules[:] = cythonize(
                 self.distribution.ext_modules)
@@ -327,7 +328,6 @@
             __builtins__["__NUMPY_SETUP__"] = False
         else:
             __builtins__.__NUMPY_SETUP__ = False
-        import numpy
         self.include_dirs.append(numpy.get_include())
 
 class sdist(_sdist):
@@ -387,26 +387,21 @@
     },
     packages=find_packages(),
     include_package_data = True,
-    setup_requires=[
-        'numpy',
-        'cython>=0.24',
-    ],
     install_requires=[
-        'matplotlib',
+        'matplotlib>=1.5.3',
         'setuptools>=19.6',
-        'sympy',
-        'numpy',
-        'IPython',
-        'cython',
+        'sympy>=1.0',
+        'numpy>=1.10.4',
+        'IPython>=1.0',
     ],
     extras_require = {
         'hub':  ["girder_client"]
     },
-    cmdclass={'sdist': sdist, 'build_ext': build_ext, 'build_py': build_py},
+    cmdclass={'sdist': sdist, 'build_ext': build_ext},
     author="The yt project",
     author_email="yt-dev at lists.spacepope.org",
     url="http://yt-project.org/",
-    license="BSD",
+    license="BSD 3-Clause",
     zip_safe=False,
     scripts=["scripts/iyt"],
     ext_modules=cython_extensions + extensions,

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -142,20 +142,3 @@
         shutil.rmtree(tmpdir)
 
     return rd
-
-
-def get_mercurial_changeset_id(target_dir):
-    '''
-    Returns changeset and branch using hglib
-    '''
-    try:
-        import hglib
-    except ImportError:
-        return None
-    try:
-        with hglib.open(target_dir) as repo:
-            changeset = repo.identify(
-                id=True, branch=True).strip().decode('utf8')
-    except hglib.error.ServerError:
-        return None
-    return changeset

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -34,7 +34,6 @@
 import numpy
 import matplotlib
 import getpass
-from distutils.version import LooseVersion
 from math import floor, ceil
 from numbers import Number as numeric_type
 
@@ -286,17 +285,6 @@
      %(filename)s:%(lineno)s
 """
 
-def get_ipython_api_version():
-    import IPython
-    if LooseVersion(IPython.__version__) <= LooseVersion('0.10'):
-        api_version = '0.10'
-    elif LooseVersion(IPython.__version__) <= LooseVersion('1.0'):
-        api_version = '0.11'
-    else:
-        api_version = '1.0'
-
-    return api_version
-
 def insert_ipython(num_up=1):
     """
     Placed inside a function, this will insert an IPython interpreter at that
@@ -306,31 +294,22 @@
     defaults to 1 so that this function itself is stripped off.
     """
     import IPython
-    api_version = get_ipython_api_version()
+    from IPython.terminal.embed import InteractiveShellEmbed
+    try:
+        from traitlets.config.loader import Config
+    except ImportError:
+        from IPython.config.loader import Config
 
     frame = inspect.stack()[num_up]
     loc = frame[0].f_locals.copy()
     glo = frame[0].f_globals
     dd = dict(fname = frame[3], filename = frame[1],
               lineno = frame[2])
-    if api_version == '0.10':
-        ipshell = IPython.Shell.IPShellEmbed()
-        ipshell(header = __header % dd,
-                local_ns = loc, global_ns = glo)
-    else:
-        try:
-            from traitlets.config.loader import Config
-        except ImportError:
-            from IPython.config.loader import Config
-        cfg = Config()
-        cfg.InteractiveShellEmbed.local_ns = loc
-        cfg.InteractiveShellEmbed.global_ns = glo
-        IPython.embed(config=cfg, banner2 = __header % dd)
-        if api_version == '0.11':
-            from IPython.frontend.terminal.embed import InteractiveShellEmbed
-        else:
-            from IPython.terminal.embed import InteractiveShellEmbed
-        ipshell = InteractiveShellEmbed(config=cfg)
+    cfg = Config()
+    cfg.InteractiveShellEmbed.local_ns = loc
+    cfg.InteractiveShellEmbed.global_ns = glo
+    IPython.embed(config=cfg, banner2 = __header % dd)
+    ipshell = InteractiveShellEmbed(config=cfg)
 
     del ipshell
 

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -736,33 +736,21 @@
         import yt
 
         import IPython
-        from distutils import version
-        if version.LooseVersion(IPython.__version__) <= version.LooseVersion('0.10'):
-            api_version = '0.10'
-        else:
-            api_version = '0.11'
 
         local_ns = yt.mods.__dict__.copy()
         local_ns['ds'] = args.ds
         local_ns['pf'] = args.ds
         local_ns['yt'] = yt
 
-        if api_version == '0.10':
-            shell = IPython.Shell.IPShellEmbed()
-            shell(local_ns = local_ns,
-                  header =
-                  "\nHi there!  Welcome to yt.\n\nWe've loaded your dataset as 'ds'.  Enjoy!"
-                  )
-        else:
-            try:
-                from traitlets.config.loader import Config
-            except ImportError:
-                from IPython.config.loader import Config
-            import sys
-            cfg = Config()
-            # prepend sys.path with current working directory
-            sys.path.insert(0,'')
-            IPython.embed(config=cfg,user_ns=local_ns)
+        try:
+            from traitlets.config.loader import Config
+        except ImportError:
+            from IPython.config.loader import Config
+        import sys
+        cfg = Config()
+        # prepend sys.path with current working directory
+        sys.path.insert(0,'')
+        IPython.embed(config=cfg,user_ns=local_ns)
 
 class YTMapserverCmd(YTCommand):
     args = ("proj", "field", "weight",

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -10,7 +10,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import matplotlib
 import matplotlib._png as _png
 from yt.extern.six import PY2
 
@@ -18,17 +17,9 @@
     from cStringIO import StringIO
 else:
     from io import BytesIO as StringIO
-from distutils.version import LooseVersion
 
-MPL_VERSION = LooseVersion(matplotlib.__version__)
-MPL_API_2_VERSION = LooseVersion("1.5.0")
-
-if MPL_VERSION < MPL_API_2_VERSION:
-    def call_png_write_png(buffer, width, height, filename, dpi):
-        _png.write_png(buffer, width, height, filename, dpi)
-else:
-    def call_png_write_png(buffer, width, height, filename, dpi):
-        _png.write_png(buffer, filename, dpi)
+def call_png_write_png(buffer, width, height, filename, dpi):
+    _png.write_png(buffer, filename, dpi)
 
 def write_png(buffer, filename, dpi=100):
     width = buffer.shape[1]

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -32,7 +32,7 @@
     ytcfg
 from yt.funcs import \
     get_image_suffix, \
-    get_ipython_api_version, iterable, \
+    iterable, \
     ensure_dir, \
     ensure_list
 from yt.utilities.exceptions import \
@@ -655,12 +655,8 @@
                 v.show()
         else:
             if "__IPYTHON__" in dir(builtins):
-                api_version = get_ipython_api_version()
-                if api_version in ('0.10', '0.11'):
-                    self._send_zmq()
-                else:
-                    from IPython.display import display
-                    display(self)
+                from IPython.display import display
+                display(self)
 
     @validate_plot
     def display(self, name=None, mpl_kwargs=None):

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -21,7 +21,6 @@
 import numpy as np
 import re
 
-from distutils.version import LooseVersion
 from functools import wraps
 
 from yt.funcs import \
@@ -460,6 +459,8 @@
         self.data_source = data_source
 
     def __call__(self, plot):
+        from matplotlib.tri import Triangulation, LinearTriInterpolator
+
         # These need to be in code_length
         x0, x1 = (v.in_units("code_length") for v in plot.xlim)
         y0, y1 = (v.in_units("code_length") for v in plot.ylim)
@@ -517,14 +518,8 @@
 
             # Both the input and output from the triangulator are in plot
             # coordinates
-            if LooseVersion(matplotlib.__version__) < LooseVersion("1.4.0"):
-                from matplotlib.delaunay.triangulate import Triangulation as \
-                    triang
-                zi = triang(x,y).nn_interpolator(z)(xi,yi)
-            else:
-                from matplotlib.tri import Triangulation, LinearTriInterpolator
-                triangulation = Triangulation(x, y)
-                zi = LinearTriInterpolator(triangulation, z)(xi,yi)
+            triangulation = Triangulation(x, y)
+            zi = LinearTriInterpolator(triangulation, z)(xi,yi)
         elif plot._type_name == 'OffAxisProjection':
             zi = plot.frb[self.field][::self.factor,::self.factor].transpose()
 

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -72,15 +72,11 @@
 
 # Some magic for dealing with pyparsing being included or not
 # included in matplotlib (not in gentoo, yes in everything else)
-# Also accounting for the fact that in 1.2.0, pyparsing got renamed.
 try:
-    if MPL_VERSION < LooseVersion("1.2.0"):
-        from matplotlib.pyparsing import ParseFatalException
+    if sys.version_info[0] == 3:
+        from matplotlib.pyparsing_py3 import ParseFatalException
     else:
-        if sys.version_info[0] == 3:
-            from matplotlib.pyparsing_py3 import ParseFatalException
-        else:
-            from matplotlib.pyparsing_py2 import ParseFatalException
+        from matplotlib.pyparsing_py2 import ParseFatalException
 except ImportError:
     from pyparsing import ParseFatalException
 

diff -r 33a88cc4dc4b27ab5132f033b7d3e00e5d0f972f -r 2f68d487b8661ea407ef740b60acc22063f85e18 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -41,7 +41,6 @@
 from yt.funcs import \
     ensure_list, \
     get_image_suffix, \
-    get_ipython_api_version, \
     matplotlib_style_context
 
 def get_canvas(name):
@@ -313,12 +312,8 @@
 
         """
         if "__IPYTHON__" in dir(builtins):
-            api_version = get_ipython_api_version()
-            if api_version in ('0.10', '0.11'):
-                self._send_zmq()
-            else:
-                from IPython.display import display
-                display(self)
+            from IPython.display import display
+            display(self)
         else:
             raise YTNotInsideNotebook

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list