Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-mpld3 for openSUSE:Factory 
checked in at 2022-02-07 23:37:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-mpld3 (Old)
 and      /work/SRC/openSUSE:Factory/.python-mpld3.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-mpld3"

Mon Feb  7 23:37:59 2022 rev:2 rq:951994 version:0.5.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-mpld3/python-mpld3.changes        
2021-05-05 20:40:01.666909348 +0200
+++ /work/SRC/openSUSE:Factory/.python-mpld3.new.1898/python-mpld3.changes      
2022-02-07 23:39:05.682032139 +0100
@@ -1,0 +2,20 @@
+Mon Feb  7 01:54:44 UTC 2022 - Matej Cepl <mc...@suse.com>
+
+- Update to version 0.5.7:
+  Unfortunately, I am not able to find a changelog anywhere, so
+  this is just edited list of commit messages:
+  - Bump to 0.5.2, attempt to fix docs, fix very deprecated
+    pandas and nu???
+  - Add an option to not include JS libraries in HTML.
+  - Update package.json with new version
+  - Treat browserify as default, update require mechanism
+  - Fix outdated dependency and update RELEASING.md
+  - Clean up test_ticklabels.py
+  - Remove test_tickformat_index as it has been replaced by
+    FuncFormatter???
+  - Update documentation code to work with Python 3
+  - Update long_description_content_type
+- Add remove-nose.patch to remove completely unnecessary nose
+  dependency (gh#mpld3/mpld3#505).
+
+-------------------------------------------------------------------

Old:
----
  mpld3-0.5.2.tar.gz

New:
----
  mpld3-0.5.7.tar.gz
  remove-nose.patch
  visualize_tests.py

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-mpld3.spec ++++++
--- /var/tmp/diff_new_pack.dnRA3J/_old  2022-02-07 23:39:06.182028717 +0100
+++ /var/tmp/diff_new_pack.dnRA3J/_new  2022-02-07 23:39:06.186028690 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-mpld3
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,17 +20,21 @@
 %define skip_python36 1
 %define modname mpld3
 # Tests are not designed to be non-interactively run, see README.md
-%bcond_with     test
+%bcond_without  test
 Name:           python-mpld3
-Version:        0.5.2
+Version:        0.5.7
 Release:        0
 Summary:        D3 Viewer for Matplotlib
 License:        BSD-3-Clause
 Group:          Development/Languages/Python
 URL:            https://mpld3.github.com
-Source:         
https://files.pythonhosted.org/packages/source/m/mpld3/%{modname}-%{version}.tar.gz
+Source0:        
https://files.pythonhosted.org/packages/source/m/mpld3/%{modname}-%{version}.tar.gz
+# Originally from 
https://raw.githubusercontent.com/mpld3/mpld3/master/visualize_tests.py
+Source1:        visualize_tests.py
+# PATCH-FIX-UPSTREAM remove-nose.patch gh#mpld3/mpld3#505 mc...@suse.com
+# there are just few SkipTests which need to be imported from stdlib
+Patch0:         remove-nose.patch
 BuildRequires:  %{python_module Jinja2 >= 2.7}
-BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module matplotlib >= 2.2}
 BuildRequires:  %{python_module pandas}
 BuildRequires:  %{python_module setuptools}
@@ -43,8 +47,8 @@
 BuildArch:      noarch
 %if %{with test}
 BuildRequires:  %{python_module diffimg}
-BuildRequires:  %{python_module nose}
 BuildRequires:  %{python_module numpy}
+BuildRequires:  %{python_module pytest}
 %endif
 %python_subpackages
 
@@ -67,7 +71,11 @@
 Documentation and examples for %{name}
 
 %prep
-%setup -q -n mpld3-%{version}
+%autosetup -p1 -n mpld3-%{version}
+
+cp %{SOURCE1} .
+
+chmod -x examples/*.py
 
 # Fix a bunch of inappropriate exec perms
 chmod a-x notebooks/*.ipynb \
@@ -86,7 +94,8 @@
 %if %{with test}
 %check
 export HIDE_PLOTS=True
-%python_expand nosetests-%{$python_bin_suffix} mpld3/tests/*.py
+# exclusions gh#mpld3/mpld3#505
+%pytest -k 'not (test_show or test_snapshots)' mpld3/tests/*.py
 %endif
 
 %files %{python_files}

++++++ mpld3-0.5.2.tar.gz -> mpld3-0.5.7.tar.gz ++++++
++++ 31357 lines of diff (skipped)

++++++ remove-nose.patch ++++++
---
 mpld3/mplexporter/tests/test_basic.py    |    2 +-
 mpld3/test_plots/test_pandas_timeaxis.py |    2 +-
 mpld3/tests/test_d3_snapshots.py         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/mpld3/mplexporter/tests/test_basic.py
+++ b/mpld3/mplexporter/tests/test_basic.py
@@ -1,7 +1,7 @@
 import matplotlib
 import numpy as np
 from distutils.version import LooseVersion
-from nose.plugins.skip import SkipTest
+from unittest import SkipTest
 from numpy.testing import assert_warns
 
 from ..exporter import Exporter
--- a/mpld3/test_plots/test_pandas_timeaxis.py
+++ b/mpld3/test_plots/test_pandas_timeaxis.py
@@ -7,7 +7,7 @@ def create_plot():
     try:
         import pandas as pd
     except Exception:
-        from nose import SkipTest
+        from unittest import SkipTest
         raise SkipTest("pandas not installed")
     df2_index = pd.date_range(start="2010-01-01", periods=100, freq='D')
     df2 = pd.DataFrame({'a': range(100)}, index=df2_index)
--- a/mpld3/tests/test_d3_snapshots.py
+++ b/mpld3/tests/test_d3_snapshots.py
@@ -4,7 +4,7 @@ import glob
 import matplotlib
 from . import export
 
-from nose.plugins.skip import SkipTest
+from unittest import SkipTest
 matplotlib.use('Agg')
 
 TEST_PLOT_FILES  = os.path.join(mpld3.BASE_PATH, 'mpld3/test_plots/*.py')

++++++ visualize_tests.py ++++++
"""
Visualize Test Plots

This script will go through all the plots in the ``mpld3/test_plots``
directory, and save them as D3js to a single HTML file for inspection.
"""
import os
import glob
import sys
import gc
import traceback
import itertools
import json
import contextlib

import matplotlib

MPLBE = os.environ.get('MPLBE', False)
if MPLBE:
    import matplotlib
    matplotlib.use(MPLBE)

import matplotlib.pyplot as plt

import mpld3
from mpld3 import urls
from mpld3._display import NumpyEncoder
from mpld3.mpld3renderer import MPLD3Renderer
from mpld3.mplexporter import Exporter

plt.rcParams['figure.figsize'] = (6, 4.5)
plt.rcParams['savefig.dpi'] = 80

TEMPLATE = """
<html>
<head>
<script type="text/javascript" src={d3_url}></script>
<script type="text/javascript" src={mpld3_url}></script>
<style type="text/css">
.left_col {{
    float: left;
    width: 50%;
}}

.right_col {{
    margin-left: 50%;
    width: 50%;
}}

.fig {{
  height: 850px;
}}


{extra_css}

</style>
</head>

<body>
<div id="wrap">
    <div class="left_col">
        {left_col}
    </div>
    <div class="right_col">
        {right_col}
    </div>
</div>
<script>
    {js_commands}
</script>
</body>
</html>
"""

MPLD3_TEMPLATE = """
<div>{fname}</div><div class="fig" id="fig{figid:03d}"></div>
"""

JS_TEMPLATE = """
!function(mpld3){{
  {extra_js}
  mpld3.draw_figure("fig{figid:03d}", {figure_json});
}}(mpld3);
"""


@contextlib.contextmanager
def mpld3_noshow():
    """context manager to use mpld3 with show() disabled"""
    import mpld3
    _show = mpld3.show
    mpld3.show = lambda *args, **kwargs: None
    yield mpld3
    mpld3.show = _show


@contextlib.contextmanager
def use_dir(dirname=None):
    """context manager to temporarily change the working directory"""
    cwd = os.getcwd()
    if dirname is None:
        dirname = cwd
    os.chdir(dirname)
    yield
    os.chdir(cwd)


class ExecFile(object):
    """
    Class to execute plotting files, and extract the mpl and mpld3 figures.
    """
    def __init__(self, filename, execute=True, pngdir='_pngs'):
        self.filename = filename
        if execute:
            self.execute_file()
        if not os.path.exists(pngdir):
            os.makedirs(pngdir)
        basename = os.path.splitext(os.path.basename(filename))[0]
        self.pngfmt = os.path.join(pngdir, basename + "_{0:2d}.png")

    def execute_file(self):
        """
        Execute the file, catching matplotlib figures
        """
        dirname, fname = os.path.split(self.filename)
        print('plotting {0}'.format(fname))

        # close any currently open figures
        plt.close('all')

        # close any currently open figures
        plt.close('all')

        with mpld3_noshow() as mpld3:
            with use_dir(dirname):
                try:
                    # execute file, forcing __name__ == '__main__'
                    exec(open(os.path.basename(self.filename)).read(),
                         {'plt': plt, 'mpld3': mpld3, '__name__': '__main__'})
                    gcf = matplotlib._pylab_helpers.Gcf
                    fig_mgr_list = gcf.get_all_fig_managers()
                    self.figlist = sorted([manager.canvas.figure
                                           for manager in fig_mgr_list],
                                          key=lambda fig: fig.number)
                except:
                    print(80 * '_')
                    print('{0} is not compiling:'.format(fname))
                    traceback.print_exc()
                    print(80 * '_')
                finally:
                    ncol = gc.collect()

    def iter_png(self):
        for fig in self.figlist:
            fig_png = self.pngfmt.format(fig.number)
            fig.savefig(fig_png)
            yield fig_png

    def iter_json(self):
        for fig in self.figlist:
            renderer = MPLD3Renderer()
            Exporter(renderer, close_mpl=False).run(fig)
            fig, fig_json, extra_css, extra_js = renderer.finished_figures[0]
            yield (json.dumps(fig_json, cls=NumpyEncoder), extra_js, extra_css)


def combine_testplots(wildcard='mpld3/test_plots/*.py',
                      outfile='_test_plots.html',
                      pngdir='_pngs',
                      d3_url=None, mpld3_url=None):
    """Generate figures from the plots and save to an HTML file

    Parameters
    ----------
    wildcard : string or list
        a regexp or list of regexps matching files to test
    outfile : string
        the path at which the output HTML will be saved
    d3_url : string
        the URL of the d3 library to use.  If not specified, a standard web
        address will be used.
    mpld3_url : string
        the URL of the mpld3 library to use.  If not specified, a standard web
        address will be used.
    """
    if isinstance(wildcard, str):
        filenames = glob.glob(wildcard)
    else:
        filenames = itertools.chain(*(glob.glob(w) for w in wildcard))

    fig_png = []
    fig_json = []
    fig_name = []
    for filename in filenames:
        result = ExecFile(filename, pngdir=pngdir)
        fig_png.extend(result.iter_png())
        for r in result.iter_json():
            fig_json.append(r)
            fig_name.append(filename)

    left_col = [MPLD3_TEMPLATE.format(figid=i, fname=fig_name[i])
                for i in range(len(fig_json))]
    js_commands = [JS_TEMPLATE.format(figid=figid,
                                      figure_json=figjson,
                                      extra_js=figjs)
                   for figid, (figjson, figjs, _) in enumerate(fig_json)]
    right_col = ['<div>png version</div><div class="fig"><img 
src="{0}"></div>\n'.format(fig)
                 for fig in fig_png]
    extra_css = [tup[2] for tup in fig_json]

    print("writing results to {0}".format(outfile))
    with open(outfile, 'w') as f:
        f.write(TEMPLATE.format(left_col="".join(left_col),
                                right_col="".join(right_col),
                                d3_url=json.dumps(d3_url),
                                mpld3_url=json.dumps(mpld3_url),
                                js_commands="".join(js_commands),
                                extra_css="".join(extra_css)))


def run_main():
    import argparse
    parser = argparse.ArgumentParser(description=("Run files and convert "
                                                  "output to D3"))
    parser.add_argument("files", nargs='*', type=str)
    parser.add_argument("-d", "--d3-url",
                        help="location of d3 library",
                        type=str, default=None)
    parser.add_argument("-m", "--mpld3-url",
                        help="location of the mpld3 library",
                        type=str, default=None)
    parser.add_argument("-o", "--output",
                        help="output filename",
                        type=str, default='_test_plots.html')
    parser.add_argument("-j", "--minjs", action="store_true")
    parser.add_argument("-l", "--local", action="store_true")
    parser.add_argument("-n", "--nolaunch", action="store_true")
    args = parser.parse_args()

    if len(args.files) == 0:
        wildcard = ['mpld3/test_plots/*.py', 'examples/*.py']
    else:
        wildcard = args.files

    if args.d3_url is None:
        args.d3_url = urls.D3_URL
    if args.mpld3_url is None:
        args.mpld3_url = urls.MPLD3_URL

    if args.local:
        args.d3_url = urls.D3_LOCAL
        if args.minjs:
            args.mpld3_url = urls.MPLD3MIN_LOCAL
        else:
            args.mpld3_url = urls.MPLD3_LOCAL
    else:
        if args.minjs:
            args.mpld3_url = urls.MPLD3MIN_URL

    print("d3 url: {0}".format(args.d3_url))
    print("mpld3 url: {0}".format(args.mpld3_url))

    combine_testplots(wildcard=wildcard,
                      outfile=args.output,
                      d3_url=args.d3_url,
                      mpld3_url=args.mpld3_url)
    return args.output, args.nolaunch


if __name__ == '__main__':
    outfile, nolaunch = run_main()

    if not nolaunch:
        # Open local file (works on OSX; maybe not on other systems)
        import webbrowser
        webbrowser.open_new('file://localhost' + os.path.abspath(outfile))

Reply via email to