Hello community,

here is the log from the commit of package python-nbsmoke for openSUSE:Factory 
checked in at 2019-06-13 23:03:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-nbsmoke (Old)
 and      /work/SRC/openSUSE:Factory/.python-nbsmoke.new.4811 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-nbsmoke"

Thu Jun 13 23:03:49 2019 rev:2 rq:709555 version:0.2.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-nbsmoke/python-nbsmoke.changes    
2019-05-22 11:07:48.114596803 +0200
+++ /work/SRC/openSUSE:Factory/.python-nbsmoke.new.4811/python-nbsmoke.changes  
2019-06-13 23:03:51.143367039 +0200
@@ -1,0 +2,9 @@
+Wed Jun 12 20:01:24 UTC 2019 - Todd R <[email protected]>
+
+- Update to 0.2.8
+  * Shorter lint tracebacks
+  * Added --nbsmoke-lint-onlywarn: Report lint failures as warnings
+  * Added --nbsmoke-lint-debug: Allow easier investigation (and debugging) of 
lint failures. nbsmoke lint currently uses nbconvert to convert ipynb to py, 
then runs pyflakes on that. You can now see the py source that was actually 
flake checked (pyflakes-reported line numbers correspond to this source). 
(Note: unhandled magics e.g. from holoviews can cause spurious flakes. I have 
separate changes that attempt to improve the situation. Meanwhile, this option 
is also helpful for debugging that situation.)
+  * Only supporting html storage in python 3.
+
+-------------------------------------------------------------------

Old:
----
  nbsmoke-0.2.7.tar.gz

New:
----
  nbsmoke-0.2.8.tar.gz

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

Other differences:
------------------
++++++ python-nbsmoke.spec ++++++
--- /var/tmp/diff_new_pack.iM4V4X/_old  2019-06-13 23:03:51.667366582 +0200
+++ /var/tmp/diff_new_pack.iM4V4X/_new  2019-06-13 23:03:51.671366579 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-nbsmoke
-Version:        0.2.7
+Version:        0.2.8
 Release:        0
 Summary:        Basic notebook checks
 License:        BSD-3-Clause
@@ -38,7 +38,7 @@
 Requires:       python-pytest >= 3.1.1
 Requires:       python-requests
 Provides:       python-jupyter_nbsmoke = %{version}
-Obsoletes:      python-jupyter_nbsmoke <= %{version}
+Obsoletes:      python-jupyter_nbsmoke < %{version}
 BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module beautifulsoup4}

++++++ nbsmoke-0.2.7.tar.gz -> nbsmoke-0.2.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsmoke-0.2.7/PKG-INFO new/nbsmoke-0.2.8/PKG-INFO
--- old/nbsmoke-0.2.7/PKG-INFO  2018-06-01 16:37:50.000000000 +0200
+++ new/nbsmoke-0.2.8/PKG-INFO  2019-05-01 20:01:43.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: nbsmoke
-Version: 0.2.7
+Version: 0.2.8
 Summary: Basic notebook checks. Do they run? Do they contain lint?
 Home-page: https://github.com/pyviz/nbsmoke
 Author: pyviz contributors
@@ -113,9 +113,11 @@
         that are not required.
         
         Using ``# noqa: explanation`` in a notebook might seem like overkill,
-        but the intention is to encourage unavoidable/desirable 'mysterious
-        imports' to be clarified. E.g. if you're importing something for its
-        side effects, it's very helpful to inform the reader of that.
+        but the intention is to at least force 'mysterious imports' to be
+        clarified (if they are necessary at all, which ideally they shouldn't
+        be). E.g. if you're importing something for its side effects, it's
+        very helpful to inform the reader of that, and the ugly/strange ``#
+        noqa`` should help remind you to fix the underlying problem...
         
         Pyflakes is used as the underlying linter because "Pyflakes makes a
         simple promise: it will never complain about style, and it will try
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsmoke-0.2.7/README.rst new/nbsmoke-0.2.8/README.rst
--- old/nbsmoke-0.2.7/README.rst        2018-06-01 16:37:02.000000000 +0200
+++ new/nbsmoke-0.2.8/README.rst        2019-05-01 20:01:23.000000000 +0200
@@ -105,9 +105,11 @@
 that are not required.
 
 Using ``# noqa: explanation`` in a notebook might seem like overkill,
-but the intention is to encourage unavoidable/desirable 'mysterious
-imports' to be clarified. E.g. if you're importing something for its
-side effects, it's very helpful to inform the reader of that.
+but the intention is to at least force 'mysterious imports' to be
+clarified (if they are necessary at all, which ideally they shouldn't
+be). E.g. if you're importing something for its side effects, it's
+very helpful to inform the reader of that, and the ugly/strange ``#
+noqa`` should help remind you to fix the underlying problem...
 
 Pyflakes is used as the underlying linter because "Pyflakes makes a
 simple promise: it will never complain about style, and it will try
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsmoke-0.2.7/nbsmoke/.version 
new/nbsmoke-0.2.8/nbsmoke/.version
--- old/nbsmoke-0.2.7/nbsmoke/.version  2018-06-01 16:37:50.000000000 +0200
+++ new/nbsmoke-0.2.8/nbsmoke/.version  2019-05-01 20:01:43.000000000 +0200
@@ -1 +1 @@
-{"git_describe": "v0.2.7-0-gc6ef220", "version_string": "0.2.7"}
\ No newline at end of file
+{"git_describe": "v0.2.8-0-g3e0ff4d", "version_string": "0.2.8"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsmoke-0.2.7/nbsmoke/__init__.py 
new/nbsmoke-0.2.8/nbsmoke/__init__.py
--- old/nbsmoke-0.2.7/nbsmoke/__init__.py       2018-06-01 16:37:02.000000000 
+0200
+++ new/nbsmoke-0.2.8/nbsmoke/__init__.py       2019-05-01 20:01:23.000000000 
+0200
@@ -26,15 +26,25 @@
 ######################################################################
 ######################################################################
 
-# This section is adding "# noqa" support to pyflakes. It's not
-# perfect (e.g. what if someone has "# noqa" in some string). Could
-# consider switching to flake8, but it's probably too complex to use
-# for notebooks.
+# Copied out of pyflakes, except with additions as noted.
 
 import pyflakes.reporter, pyflakes.checker
 import _ast
 
-def flake_check(codeString, filename, reporter=None):
+
+def flake_check(codeString, filename, reporter=None, debug=False):
+    ####
+    # nbsmoke addition: debug parameter above; allow to debug ipynb
+    # linting
+    if debug:
+        # should i use a temp file instead?
+        fn = os.path.splitext(filename)[0]+".nbsmoke-debug.py"
+        with open(fn,'w') as df:
+            df.write(codeString)
+    else:
+        fn = "pass --nbsmoke-lint-debug"
+    ####
+
     if reporter is None:
         reporter = pyflakes.reporter._makeDefaultReporter()
     # First, compile into an AST and handle syntax errors.
@@ -66,25 +76,39 @@
             reporter.unexpectedError(filename, 'problem decoding source')
         else:
             reporter.syntaxError(filename, msg, lineno, offset, text)
-        return 1
+        ####
+        # nbsmoke addition: (see final 'return' in this fn)
+        return {'status': 1,
+                'messages':["Error - see captured stderr, below."],
+                'source': fn}
+        ####
+
     except Exception:
         reporter.unexpectedError(filename, 'problem decoding source')
-        return 1
+        ####
+        # nbsmoke addition: (see final 'return' in this fn)
+        return {'status': 1,
+                'messages':["Error - see captured stderr, below."],
+                'source': fn}
+        ####
     # Okay, it's syntactically valid.  Now check it.
     w = pyflakes.checker.Checker(tree, filename)
 
-    ##########################
-    ## addition to pyflakes ##
+    ####
+    # nbsmoke addition: hack to support '# noqa' in ipynb
     NOQA = re.compile('# noqa', re.IGNORECASE)
     noqa_lines = [i+1 for i,l in enumerate(codeString.splitlines()) if 
NOQA.search(l)]
     w.messages[:] = [m for m in w.messages if m.lineno not in noqa_lines]
-    ##########################
+    ####
 
     w.messages.sort(key=lambda m: m.lineno)
-    for warning in w.messages:
-        reporter.flake(warning)
-    return len(w.messages)
 
+    ####
+    # nbsmoke addition: return more info
+    return {'status':len(w.messages),
+            'messages':[("line %s col %s: 
"%(msg.lineno,msg.col))+msg.message%msg.message_args for msg in w.messages],
+            'source': fn}
+    ####
 
 ######################################################################
 ######################################################################
@@ -108,6 +132,16 @@
         help="Lint check notebooks using flake8")
 
     group.addoption(
+        '--nbsmoke-lint-debug',
+        action="store_true",
+        help="Write out copy of python script resulting from conversion of 
ipynb")
+
+    group.addoption(
+        '--nbsmoke-lint-onlywarn',
+        action="store_true",
+        help="Flake errors will only appear as warnings")
+
+    group.addoption(
         '--nbsmoke-verify',
         action="store_true",
         help="Verify notebooks")
@@ -257,6 +291,10 @@
 
 
 class RunNb(pytest.Item):
+
+    def repr_failure(self, excinfo):
+        return excinfo.exconly(True)
+
     def runtest(self):
         self._skip()
         with io.open(self.name,encoding='utf8') as nb:
@@ -376,8 +414,19 @@
 
 ####################
 
+class NBLintError(Exception):
+    pass
+
 
 class LintNb(pytest.Item):
+
+    def repr_failure(self, excinfo):
+        if excinfo.errisinstance(NBLintError):
+            return excinfo.value.args[0]
+        else:
+            return super(LintNb, self).repr_failure(excinfo)
+
+
     def runtest(self):
         with io.open(self.name,encoding='utf8') as nbfile:
             nb = nbformat.read(nbfile, as_version=4)
@@ -387,9 +436,15 @@
             if sys.version_info[0]==2:
                 # notebooks will start with "coding: utf-8", but py already 
unicode
                 py = py.encode('utf8')
-            if flake_check(py,self.name) != 0:
-                raise AssertionError
-
+            flake_result = flake_check(py,self.name, 
debug=self.config.option.nbsmoke_lint_debug)
+            if flake_result['status'] != 0:
+                msg = "%s\n"%self.name
+                msg += "\n".join(flake_result['messages'])
+                msg += "\n"+"To see python source that was flake checked: 
%s"%flake_result['source']
+                if self.config.option.nbsmoke_lint_onlywarn:
+                    warnings.warn("Flakes detected:\n"+msg)
+                else:
+                    raise NBLintError(msg)
 
 class IPyNbFile(pytest.File):
     def __init__(self, fspath, parent=None, config=None, session=None, 
dowhat=RunNb):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsmoke-0.2.7/nbsmoke.egg-info/PKG-INFO 
new/nbsmoke-0.2.8/nbsmoke.egg-info/PKG-INFO
--- old/nbsmoke-0.2.7/nbsmoke.egg-info/PKG-INFO 2018-06-01 16:37:50.000000000 
+0200
+++ new/nbsmoke-0.2.8/nbsmoke.egg-info/PKG-INFO 2019-05-01 20:01:43.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: nbsmoke
-Version: 0.2.7
+Version: 0.2.8
 Summary: Basic notebook checks. Do they run? Do they contain lint?
 Home-page: https://github.com/pyviz/nbsmoke
 Author: pyviz contributors
@@ -113,9 +113,11 @@
         that are not required.
         
         Using ``# noqa: explanation`` in a notebook might seem like overkill,
-        but the intention is to encourage unavoidable/desirable 'mysterious
-        imports' to be clarified. E.g. if you're importing something for its
-        side effects, it's very helpful to inform the reader of that.
+        but the intention is to at least force 'mysterious imports' to be
+        clarified (if they are necessary at all, which ideally they shouldn't
+        be). E.g. if you're importing something for its side effects, it's
+        very helpful to inform the reader of that, and the ugly/strange ``#
+        noqa`` should help remind you to fix the underlying problem...
         
         Pyflakes is used as the underlying linter because "Pyflakes makes a
         simple promise: it will never complain about style, and it will try
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbsmoke-0.2.7/setup.cfg new/nbsmoke-0.2.8/setup.cfg
--- old/nbsmoke-0.2.7/setup.cfg 2018-06-01 16:37:50.000000000 +0200
+++ new/nbsmoke-0.2.8/setup.cfg 2019-05-01 20:01:43.000000000 +0200
@@ -1,6 +1,9 @@
 [wheel]
 universal = 1
 
+[metadata]
+license_file = LICENSE
+
 [flake8]
 ignore = E,W
 


Reply via email to