Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-json_tricks for openSUSE:Factory checked in at 2021-04-19 21:06:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-json_tricks (Old) and /work/SRC/openSUSE:Factory/.python-json_tricks.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-json_tricks" Mon Apr 19 21:06:01 2021 rev:9 rq:886565 version:3.15.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-json_tricks/python-json_tricks.changes 2020-04-21 13:10:39.400811016 +0200 +++ /work/SRC/openSUSE:Factory/.python-json_tricks.new.12324/python-json_tricks.changes 2021-04-19 21:06:19.816059138 +0200 @@ -1,0 +2,9 @@ +Mon Apr 19 06:34:11 UTC 2021 - Steve Kowalik <[email protected]> + +- Update to 3.15.5: + * Attempt py3.9 support + * Allow none as encoder class for dump(s), for compatibility + * Fix Numpy Array with shape (0,N) not decoded correctly. +- Do not build for Python 3.6, due to no NumPy. + +------------------------------------------------------------------- Old: ---- pyjson_tricks-3.15.2.tar.gz New: ---- pyjson_tricks-3.15.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-json_tricks.spec ++++++ --- /var/tmp/diff_new_pack.KYybsb/_old 2021-04-19 21:06:20.268059816 +0200 +++ /var/tmp/diff_new_pack.KYybsb/_new 2021-04-19 21:06:20.272059822 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-json_tricks # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,12 +18,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 +%define skip_python36 1 Name: python-json_tricks -Version: 3.15.2 +Version: 3.15.5 Release: 0 Summary: Extra features for Python's JSON License: BSD-3-Clause -Group: Development/Languages/Python URL: https://github.com/mverleg/pyjson_tricks Source: https://github.com/mverleg/pyjson_tricks/archive/v%{version}.tar.gz#/pyjson_tricks-%{version}.tar.gz BuildRequires: %{python_module setuptools} ++++++ pyjson_tricks-3.15.2.tar.gz -> pyjson_tricks-3.15.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/.github/workflows/tests.yml new/pyjson_tricks-3.15.5/.github/workflows/tests.yml --- old/pyjson_tricks-3.15.2/.github/workflows/tests.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pyjson_tricks-3.15.5/.github/workflows/tests.yml 2020-12-02 22:24:38.000000000 +0100 @@ -0,0 +1,34 @@ + +name: 'pyjson-tricks' + +on: + push: + +jobs: + build: + name: tests + runs-on: ubuntu-latest + strategy: + max-parallel: 8 + fail-fast: false + matrix: + python-version: [ + 2.7, + 3.5, + 3.6, + 3.7, + 3.8, + 3.9 + ] + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/.travis.yml new/pyjson_tricks-3.15.5/.travis.yml --- old/pyjson_tricks-3.15.2/.travis.yml 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -language: python -python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" - - "3.7" -matrix: - include: - - python: "3.8" - dist: xenial - sudo: true -install: pip install tox-travis -script: - - tox - - python setup.py bdist_wheel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/README.rst new/pyjson_tricks-3.15.5/README.rst --- old/pyjson_tricks-3.15.2/README.rst 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/README.rst 2020-12-02 22:24:38.000000000 +0100 @@ -384,8 +384,8 @@ Tests are run automatically for commits to the repository for all supported versions. This is the status: -.. image:: https://travis-ci.org/mverleg/pyjson_tricks.svg?branch=master - :target: https://travis-ci.org/mverleg/pyjson_tricks +.. image:: https://github.com/mverleg/pyjson_tricks/workflows/pyjson-tricks/badge.svg?branch=master + :target: https://github.com/mverleg/pyjson_tricks/actions To run the tests manually for your version, see `this guide`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/json_tricks/_version.py new/pyjson_tricks-3.15.5/json_tricks/_version.py --- old/pyjson_tricks-3.15.2/json_tricks/_version.py 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/json_tricks/_version.py 2020-12-02 22:24:38.000000000 +0100 @@ -1,3 +1,3 @@ -VERSION = '3.15.2' +VERSION = '3.15.5' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/json_tricks/decoders.py new/pyjson_tricks-3.15.5/json_tricks/decoders.py --- old/pyjson_tricks-3.15.2/json_tricks/decoders.py 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/json_tricks/decoders.py 2020-12-02 22:24:38.000000000 +0100 @@ -300,6 +300,8 @@ """ from numpy import asarray arr = asarray(data, dtype=dtype, order=order) + if 0 in shape: + return arr.reshape(shape) if shape != arr.shape: warnings.warn('size mismatch decoding numpy array: expected {}, got {}'.format(shape, arr.shape)) return arr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/json_tricks/nonp.py new/pyjson_tricks-3.15.5/json_tricks/nonp.py --- old/pyjson_tricks-3.15.2/json_tricks/nonp.py 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/json_tricks/nonp.py 2020-12-02 22:24:38.000000000 +0100 @@ -75,7 +75,7 @@ DEFAULT_NONP_HOOKS = [json_nonumpy_obj_hook,] + DEFAULT_HOOKS # DEPRECATED -def dumps(obj, sort_keys=None, cls=TricksEncoder, obj_encoders=DEFAULT_ENCODERS, extra_obj_encoders=(), +def dumps(obj, sort_keys=None, cls=None, obj_encoders=DEFAULT_ENCODERS, extra_obj_encoders=(), primitives=False, compression=None, allow_nan=False, conv_str_byte=False, fallback_encoders=(), properties=None, **jsonkwargs): """ @@ -101,6 +101,8 @@ dict_default(properties, 'primitives', primitives) dict_default(properties, 'compression', compression) dict_default(properties, 'allow_nan', allow_nan) + if cls is None: + cls = TricksEncoder txt = cls(sort_keys=sort_keys, obj_encoders=encoders, allow_nan=allow_nan, primitives=primitives, fallback_encoders=fallback_encoders, properties=properties, **jsonkwargs).encode(obj) @@ -115,7 +117,7 @@ return gzstring -def dump(obj, fp, sort_keys=None, cls=TricksEncoder, obj_encoders=DEFAULT_ENCODERS, extra_obj_encoders=(), +def dump(obj, fp, sort_keys=None, cls=None, obj_encoders=DEFAULT_ENCODERS, extra_obj_encoders=(), primitives=False, compression=None, force_flush=False, allow_nan=False, conv_str_byte=False, fallback_encoders=(), properties=None, **jsonkwargs): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/setup.py new/pyjson_tricks-3.15.5/setup.py --- old/pyjson_tricks-3.15.2/setup.py 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/setup.py 2020-12-02 22:24:38.000000000 +0100 @@ -58,6 +58,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Libraries :: Python Modules', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/tests/run_locally.rst new/pyjson_tricks-3.15.5/tests/run_locally.rst --- old/pyjson_tricks-3.15.2/tests/run_locally.rst 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/tests/run_locally.rst 2020-12-02 22:24:38.000000000 +0100 @@ -7,67 +7,48 @@ Note ------------------------------- -The tests run automatically on the supported versions of Python for every commit. You can check the TravisCI result at the bottom of the README on Github. +The tests run automatically on the supported versions of Python for every commit. You can check the Github Actions result at the bottom of the README on Github. -This file is only for if you want to run the tests on the exact code that you're getting through pip, using your local environment. - -Setup +Run current verison ------------------------------- -First download the files using pip for the version you want to use (replace ``X.Y.Z`` by the version): - - pip download 'json_tricks==X.Y.Z' - -There will be a compressed directory ``json_tricks-X.Y.Z.tar.gz``. Uncompress it and navigate to it's root. You should see ``json_tricks``, ``tests`` and a number of other things. +To run py.test for current Python version, install requirements:: -You will need to install ``pytest``, e.g. using ``pip install pytest``. + pip install numpy pytz pandas pathlib ordereddict pytest-coverage -To test the full functionality, you will need to install - -* ``pytz`` -* ``numpy`` (note: doesn't work with pypy) -* ``pandas`` (note: doesn't work with pypy and does not supported python 3.4) -* ``enum34`` if you're on python 2.7 or pypy -* ``ordereddict`` on python 2.6 (which is not supported but might work) - -If you want coverage information, also install ``pytest-coverage``. - -Run -------------------------------- - -To run all the tests (requiring you to have all the packages mentioned): +To run all the tests (requiring you to have all the packages mentioned):: py.test --continue-on-collection-errors Using this flag, you will get a failure message when e.g. ``pandas`` is missing, but the other tests will still run. -You might see something like this on Python 3.5 with pytz and numpy but *without* pandas: - - collected 49 items / 1 errors +Example output +------------------------------- - json_tricks-3.11.1.1/tests/test_bare.py ....................... [ 46%] - ...... [ 59%] - json_tricks-3.11.1.1/tests/test_enum.py ....... [ 73%] - json_tricks-3.11.1.1/tests/test_np.py ......... [ 91%] - json_tricks-3.11.1.1/tests/test_tz.py .. [ 95%] - json_tricks-3.11.1.1/tests/test_utils.py .. [100%] - - =============================== ERRORS ================================ - _____ ERROR collecting json_tricks-3.11.1.1/tests/test_pandas.py ______ - ImportError while importing test module '/home/mark/TMP_jsontricks/json_tricks-3.11.1.1/tests/test_pandas.py'. - Hint: make sure your test modules/packages have valid Python names. - Traceback: - json_tricks-3.11.1.1/tests/test_pandas.py:7: in <module> - from pandas import DataFrame, Series - E ImportError: No module named 'pandas' - ================= 49 passed, 1 error in 0.39 seconds ================== +Output if all tests pass:: -which means that it worked! (Since the only error is the pandas one). + platform linux -- Python 3.6.8, pytest-5.3.1, py-1.8.1, pluggy-0.13.1 + rootdir: /home/mark/pyjson_tricks + plugins: cov-2.10.1 + collected 80 items + + tests/test_bare.py ....................................... [ 48%] + tests/test_enum.py ....... [ 57%] + tests/test_meta.py . [ 58%] + tests/test_np.py ....................... [ 87%] + tests/test_pandas.py ... [ 91%] + tests/test_pathlib.py . [ 92%] + tests/test_tz.py ... [ 96%] + tests/test_utils.py ... [100%] -If you want to see test coverage, make sure you have ``pytest-coverage`` and run: + 80 passed, 4 warnings in 0.41s - py.test --cov json_tricks --cov-report=html --continue-on-collection-errors +Coverage +------------------------------- -You can then see your report in ``htmlcov/index.html`` (in a browser). Note that coverage is naturally lower if some tests are skipped due to missing packages. +To collect coverage after using tox:: + coverage combine .tox/coverage/* + coverage report +You can then see your report in ``htmlcov/index.html`` (in a browser). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/tests/test_bare.py new/pyjson_tricks-3.15.5/tests/test_bare.py --- old/pyjson_tricks-3.15.2/tests/test_bare.py 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/tests/test_bare.py 2020-12-02 22:24:38.000000000 +0100 @@ -58,7 +58,6 @@ assert data == back - def test_wrong_arg_order(): # Based on a problem from https://github.com/mverleg/array_storage_benchmark li = [[1.0, 2.0], [3.0, 4.0]] @@ -613,3 +612,17 @@ txt = '{"///": "////*/*"}' assert txt == dumps(loads(txt)) + +def test_no_cls(): + """ Originally for https://github.com/mverleg/pyjson_tricks/issues/79 """ + data = dict(name='Leonardo da Vinci', year=1452) + path = join(mkdtemp(), 'pytest-no-cls.json') + with open(path, 'wb+') as fh: + dump(data, fh, cls=None, compression=1) + with open(path, 'rb') as fh: + bck = load(fh) + assert data == bck + txt = dumps(data, cls=None, compression=2) + bck = loads(txt) + assert data == bck + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/tests/test_np.py new/pyjson_tricks-3.15.5/tests/test_np.py --- old/pyjson_tricks-3.15.2/tests/test_np.py 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/tests/test_np.py 2020-12-02 22:24:38.000000000 +0100 @@ -83,8 +83,8 @@ 'vec': array(range(10)), 'inst': MyTestCls( nr=7, txt='yolo', - li=[1,1,2,3,5,8,12], - vec=array(range(7,16,2)), + li=[1, 1, 2, 3, 5, 8, 12], + vec=array(range(7, 16, 2)), inst=cls_instance ), } @@ -291,3 +291,16 @@ '"dtype": "float64", "shape": [2, 2], "Corder": true}]' data = loads(json) assert_equal(data[0], array([[1.0, 2.0], [3.0, 4.0]])) + + +def test_empty(): + # issue https://github.com/mverleg/pyjson_tricks/issues/76 + datas = [ + zeros(shape=(1, 0)), + zeros(shape=(0, 1)), + zeros(shape=(0, 0)), + ] + for data in datas: + json = dumps(data) + assert_equal(loads(json), data, 'shape = {} ; json = {}'.format(data.shape, json)) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyjson_tricks-3.15.2/tox.ini new/pyjson_tricks-3.15.5/tox.ini --- old/pyjson_tricks-3.15.2/tox.ini 2020-04-12 23:14:07.000000000 +0200 +++ new/pyjson_tricks-3.15.5/tox.ini 2020-12-02 22:24:38.000000000 +0100 @@ -1,38 +1,47 @@ -; after running, use `coverage combine .tox/coverage/*` and `coverage report` - [tox] envlist = - ; py26 not tested; also update setup.py - {py27,py34,py35,py36,py37,py38}-{bare,pnp,tz,enum,path} - {py27,py35,py36,py37,py38}-panda + ; also update setup.py + {py27,py35,py36,py37,py38,py39}-{bare,pnp,tz,enum,path,panda,all} pypy-{bare,tz,enum} +[gh-actions] +python = + 2.7: py27 + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39, mypy + [testenv] -;usedevelop = true +; pandas 0.20.* does not work, but bound doesn't always work either, so I assume it'll pick the latest one skip_install = true deps = pytest - pytest-cov pnp: numpy snp: git+https://bitbucket.org/pypy/numpy.git tz: pytz - panda: pandas!=0.20.* + panda: pandas path: pathlib py26: ordereddict py27-enum: enum34 pypy-enum: enum34 + all: numpy + pytz + pandas + pathlib + ordereddict + py27-all: enum34 setenv = COVERAGE_FILE = .tox/coverage/{envname} whitelist_externals = mkdir commands = - mkdir -p .tox/coverage - bare: py.test --cov json_tricks --cov-report= --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py {posargs} - pnp,snp: py.test --cov json_tricks --cov-report= --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_np.py {posargs} - tz: py.test --cov json_tricks --cov-report= --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_tz.py {posargs} - panda: py.test --cov json_tricks --cov-report= --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_pandas.py {posargs} - enum: py.test --cov json_tricks --cov-report= --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_enum.py {posargs} - path: py.test --cov json_tricks --cov-report= --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_pathlib.py {posargs} -;{envsitepackagesdir}/json_tricks - + bare: py.test -v --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py {posargs} + pnp,snp: py.test -v --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_np.py {posargs} + tz: py.test -v --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_tz.py {posargs} + panda: py.test -v --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_pandas.py {posargs} + enum: py.test -v --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_enum.py {posargs} + path: py.test -v --strict --exitfirst tests/test_bare.py tests/test_class.py tests/test_meta.py tests/test_pathlib.py {posargs} + all: py.test -v --strict --exitfirst {posargs}
