Hello community, here is the log from the commit of package python-tablib for openSUSE:Factory checked in at 2020-07-26 16:19:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-tablib (Old) and /work/SRC/openSUSE:Factory/.python-tablib.new.3592 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-tablib" Sun Jul 26 16:19:20 2020 rev:7 rq:822670 version:2.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-tablib/python-tablib.changes 2020-04-21 13:07:15.968405282 +0200 +++ /work/SRC/openSUSE:Factory/.python-tablib.new.3592/python-tablib.changes 2020-07-26 16:19:57.948843179 +0200 @@ -1,0 +2,12 @@ +Fri Jul 24 14:13:26 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com> + +- Update to 2.0.0 + * The `Row.lpush/rpush` logic was reversed. `lpush` was appending while `rpush` + and `append` were prepending. This was fixed (reversed behavior). If you + counted on the broken behavior, please update your code (#453). + * Fixed minimal openpyxl dependency version to 2.6.0 (#457). + * Dates from xls files are now read as Python datetime objects (#373). + * Allow import of "ragged" xlsx files (#465). + * When importing an xlsx file, Tablib will now read cell values instead of formulas (#462). + +------------------------------------------------------------------- Old: ---- tablib-1.1.0.tar.gz New: ---- tablib-2.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-tablib.spec ++++++ --- /var/tmp/diff_new_pack.RhlCnJ/_old 2020-07-26 16:20:01.916846890 +0200 +++ /var/tmp/diff_new_pack.RhlCnJ/_new 2020-07-26 16:20:01.920846893 +0200 @@ -23,7 +23,7 @@ %endif %define skip_python2 1 Name: python-tablib -Version: 1.1.0 +Version: 2.0.0 Release: 0 Summary: Format agnostic tabular data library (XLS, JSON, YAML, CSV) License: MIT @@ -31,28 +31,27 @@ URL: http://python-tablib.org Source: https://files.pythonhosted.org/packages/source/t/tablib/tablib-%{version}.tar.gz BuildRequires: %{python_module MarkupPy} -BuildRequires: %{python_module PyYAML >= 3.12} -BuildRequires: %{python_module odfpy >= 1.3.5} -BuildRequires: %{python_module openpyxl >= 2.4.8} -BuildRequires: %{python_module pandas >= 0.20.3} +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module odfpy} +BuildRequires: %{python_module openpyxl >= 2.6.0} +BuildRequires: %{python_module pandas} BuildRequires: %{python_module pytest-cov} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module tabulate} -BuildRequires: %{python_module xlrd >= 1.1.0} -BuildRequires: %{python_module xlwt >= 1.3.0} -BuildRequires: %{python_module xml} +BuildRequires: %{python_module xlrd} +BuildRequires: %{python_module xlwt} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-MarkupPy -Requires: python-PyYAML >= 3.12 -Requires: python-odfpy >= 1.3.5 -Requires: python-openpyxl >= 2.4.8 -Requires: python-xlrd >= 1.1.0 -Requires: python-xlwt >= 1.3.0 -Requires: python-xml -Suggests: python-pandas >= 0.20.3 +Requires: python-PyYAML +Requires: python-odfpy +Requires: python-openpyxl >= 2.6.0 +Requires: python-tabulate +Requires: python-xlrd +Requires: python-xlwt +Suggests: python-pandas BuildArch: noarch %python_subpackages ++++++ tablib-1.1.0.tar.gz -> tablib-2.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/HISTORY.md new/tablib-2.0.0/HISTORY.md --- old/tablib-1.1.0/HISTORY.md 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/HISTORY.md 2020-05-16 14:07:58.000000000 +0200 @@ -1,5 +1,23 @@ # History +## 2.0.0 (2020-05-16) + +### Breaking changes + +- The `Row.lpush/rpush` logic was reversed. `lpush` was appending while `rpush` + and `append` were prepending. This was fixed (reversed behavior). If you + counted on the broken behavior, please update your code (#453). + +### Bugfixes + +- Fixed minimal openpyxl dependency version to 2.6.0 (#457). +- Dates from xls files are now read as Python datetime objects (#373). +- Allow import of "ragged" xlsx files (#465). + +### Improvements + +- When importing an xlsx file, Tablib will now read cell values instead of formulas (#462). + ## 1.1.0 (2020-02-13) ### Deprecations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/PKG-INFO new/tablib-2.0.0/PKG-INFO --- old/tablib-1.1.0/PKG-INFO 2020-02-13 19:00:19.000000000 +0100 +++ new/tablib-2.0.0/PKG-INFO 2020-05-16 14:08:46.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: tablib -Version: 1.1.0 +Version: 2.0.0 Summary: Format agnostic tabular data library (XLS, JSON, YAML, CSV) Home-page: https://tablib.readthedocs.io Author: Kenneth Reitz @@ -59,6 +59,24 @@ # History + ## 2.0.0 (2020-05-16) + + ### Breaking changes + + - The `Row.lpush/rpush` logic was reversed. `lpush` was appending while `rpush` + and `append` were prepending. This was fixed (reversed behavior). If you + counted on the broken behavior, please update your code (#453). + + ### Bugfixes + + - Fixed minimal openpyxl dependency version to 2.6.0 (#457). + - Dates from xls files are now read as Python datetime objects (#373). + - Allow import of "ragged" xlsx files (#465). + + ### Improvements + + - When importing an xlsx file, Tablib will now read cell values instead of formulas (#462). + ## 1.1.0 (2020-02-13) ### Deprecations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/docs/formats.rst new/tablib-2.0.0/docs/formats.rst --- old/tablib-1.1.0/docs/formats.rst 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/docs/formats.rst 2020-05-16 14:07:58.000000000 +0200 @@ -206,6 +206,15 @@ This format is optional, install Tablib with ``pip install tablib[xlsx]`` to make the format available. +.. note:: + + When reading an ``xlsx`` file containing formulas in its cells, Tablib will + read the cell values, not the cell formulas. + +.. versionchanged:: 2.0.0 + + Reads cell values instead of formulas. + .. admonition:: Binary Warning The ``xlsx`` file format is binary, so make sure to write in binary mode:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/setup.py new/tablib-2.0.0/setup.py --- old/tablib-1.1.0/setup.py 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/setup.py 2020-05-16 14:07:58.000000000 +0200 @@ -38,13 +38,13 @@ ], python_requires='>=3.5', extras_require={ - 'all': ['markuppy', 'odfpy', 'openpyxl>=2.4.0', 'pandas', 'pyyaml', 'tabulate', 'xlrd', 'xlwt'], + 'all': ['markuppy', 'odfpy', 'openpyxl>=2.6.0', 'pandas', 'pyyaml', 'tabulate', 'xlrd', 'xlwt'], 'cli': ['tabulate'], 'html': ['markuppy'], 'ods': ['odfpy'], 'pandas': ['pandas'], 'xls': ['xlrd', 'xlwt'], - 'xlsx': ['openpyxl>=2.4.0'], + 'xlsx': ['openpyxl>=2.6.0'], 'yaml': ['pyyaml'], }, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib/core.py new/tablib-2.0.0/src/tablib/core.py --- old/tablib-1.1.0/src/tablib/core.py 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/src/tablib/core.py 2020-05-16 14:07:58.000000000 +0200 @@ -71,10 +71,10 @@ setattr(self, k, v) def rpush(self, value): - self.insert(0, value) + self.insert(len(self._row), value) def lpush(self, value): - self.insert(len(value), value) + self.insert(0, value) def append(self, value): self.rpush(value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib/formats/_xls.py new/tablib-2.0.0/src/tablib/formats/_xls.py --- old/tablib-1.1.0/src/tablib/formats/_xls.py 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/src/tablib/formats/_xls.py 2020-05-16 14:07:58.000000000 +0200 @@ -6,6 +6,7 @@ import tablib import xlrd import xlwt +from xlrd.xldate import xldate_as_datetime # special styles wrap = xlwt.easyxf("alignment: wrap on") @@ -74,12 +75,19 @@ dset.title = sheet.name + def cell_value(value, type_): + if type_ == xlrd.XL_CELL_ERROR: + return xlrd.error_text_from_code[value] + elif type_ == xlrd.XL_CELL_DATE: + return xldate_as_datetime(value, xls_book.datemode) + return value + for i in range(sheet.nrows): if i == 0 and headers: dset.headers = sheet.row_values(0) else: dset.append([ - val if typ != xlrd.XL_CELL_ERROR else xlrd.error_text_from_code[val] + cell_value(val, typ) for val, typ in zip(sheet.row_values(i), sheet.row_types(i)) ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib/formats/_xlsx.py new/tablib-2.0.0/src/tablib/formats/_xlsx.py --- old/tablib-1.1.0/src/tablib/formats/_xlsx.py 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/src/tablib/formats/_xlsx.py 2020-05-16 14:07:58.000000000 +0200 @@ -63,7 +63,7 @@ dset.wipe() - xls_book = load_workbook(in_stream, read_only=True) + xls_book = load_workbook(in_stream, read_only=True, data_only=True) sheet = xls_book.active dset.title = sheet.title @@ -81,7 +81,7 @@ dbook.wipe() - xls_book = load_workbook(in_stream, read_only=True) + xls_book = load_workbook(in_stream, read_only=True, data_only=True) for sheet in xls_book.worksheets: data = tablib.Dataset() @@ -92,6 +92,8 @@ if (i == 0) and (headers): data.headers = row_vals else: + if i > 0 and len(row_vals) < data.width: + row_vals += [''] * (data.width - len(row_vals)) data.append(row_vals) dbook.add_sheet(data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib/packages/dbfpy/record.py new/tablib-2.0.0/src/tablib/packages/dbfpy/record.py --- old/tablib-1.1.0/src/tablib/packages/dbfpy/record.py 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/src/tablib/packages/dbfpy/record.py 2020-05-16 14:07:58.000000000 +0200 @@ -60,7 +60,7 @@ Arguments: dbf: - A `Dbf.Dbf` instance this record belonogs to. + A `Dbf.Dbf` instance this record belongs to. index: An integer record index or None. If this value is None, record will be appended to the DBF. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib.egg-info/PKG-INFO new/tablib-2.0.0/src/tablib.egg-info/PKG-INFO --- old/tablib-1.1.0/src/tablib.egg-info/PKG-INFO 2020-02-13 19:00:19.000000000 +0100 +++ new/tablib-2.0.0/src/tablib.egg-info/PKG-INFO 2020-05-16 14:08:46.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: tablib -Version: 1.1.0 +Version: 2.0.0 Summary: Format agnostic tabular data library (XLS, JSON, YAML, CSV) Home-page: https://tablib.readthedocs.io Author: Kenneth Reitz @@ -59,6 +59,24 @@ # History + ## 2.0.0 (2020-05-16) + + ### Breaking changes + + - The `Row.lpush/rpush` logic was reversed. `lpush` was appending while `rpush` + and `append` were prepending. This was fixed (reversed behavior). If you + counted on the broken behavior, please update your code (#453). + + ### Bugfixes + + - Fixed minimal openpyxl dependency version to 2.6.0 (#457). + - Dates from xls files are now read as Python datetime objects (#373). + - Allow import of "ragged" xlsx files (#465). + + ### Improvements + + - When importing an xlsx file, Tablib will now read cell values instead of formulas (#462). + ## 1.1.0 (2020-02-13) ### Deprecations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib.egg-info/SOURCES.txt new/tablib-2.0.0/src/tablib.egg-info/SOURCES.txt --- old/tablib-1.1.0/src/tablib.egg-info/SOURCES.txt 2020-02-13 19:00:19.000000000 +0100 +++ new/tablib-2.0.0/src/tablib.egg-info/SOURCES.txt 2020-05-16 14:08:46.000000000 +0200 @@ -63,5 +63,8 @@ tests/test_tablib.py tests/test_tablib_dbfpy_packages_fields.py tests/test_tablib_dbfpy_packages_utils.py +tests/files/dates.xls tests/files/errors.xls -tests/files/founders.xlsx \ No newline at end of file +tests/files/founders.xlsx +tests/files/ragged.xlsx +tests/files/xlsx_cell_values.xlsx \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/src/tablib.egg-info/requires.txt new/tablib-2.0.0/src/tablib.egg-info/requires.txt --- old/tablib-1.1.0/src/tablib.egg-info/requires.txt 2020-02-13 19:00:19.000000000 +0100 +++ new/tablib-2.0.0/src/tablib.egg-info/requires.txt 2020-05-16 14:08:46.000000000 +0200 @@ -2,7 +2,7 @@ [all] markuppy odfpy -openpyxl>=2.4.0 +openpyxl>=2.6.0 pandas pyyaml tabulate @@ -26,7 +26,7 @@ xlwt [xlsx] -openpyxl>=2.4.0 +openpyxl>=2.6.0 [yaml] pyyaml Binary files old/tablib-1.1.0/tests/files/dates.xls and new/tablib-2.0.0/tests/files/dates.xls differ Binary files old/tablib-1.1.0/tests/files/ragged.xlsx and new/tablib-2.0.0/tests/files/ragged.xlsx differ Binary files old/tablib-1.1.0/tests/files/xlsx_cell_values.xlsx and new/tablib-2.0.0/tests/files/xlsx_cell_values.xlsx differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/tests/requirements.txt new/tablib-2.0.0/tests/requirements.txt --- old/tablib-1.1.0/tests/requirements.txt 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/tests/requirements.txt 2020-05-16 14:07:58.000000000 +0200 @@ -2,7 +2,7 @@ pytest-cov MarkupPy odfpy -openpyxl>=2.4.0 +openpyxl>=2.6.0 pandas pyyaml tabulate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tablib-1.1.0/tests/test_tablib.py new/tablib-2.0.0/tests/test_tablib.py --- old/tablib-1.1.0/tests/test_tablib.py 2020-02-13 18:59:20.000000000 +0100 +++ new/tablib-2.0.0/tests/test_tablib.py 2020-05-16 14:07:58.000000000 +0200 @@ -556,27 +556,15 @@ def test_row_lpush(self): """Row lpush.""" - # Arrange john = Row(self.john) - george = Row(self.george) - - # Act - john.lpush(george) - - # Assert - self.assertEqual(john[-1], george) + john.lpush(53) + self.assertEqual(john.list, [53, 'John', 'Adams', 90]) def test_row_append(self): """Row append.""" - # Arrange john = Row(self.john) - george = Row(self.george) - - # Act - john.append(george) - - # Assert - self.assertEqual(john[0], george) + john.append('stuff') + self.assertEqual(john.list, ['John', 'Adams', 90, 'stuff']) def test_row_contains(self): """Row __contains__.""" @@ -987,6 +975,12 @@ in_stream = self.founders.xls self.assertEqual(detect_format(in_stream), 'xls') + def test_xls_date_import(self): + xls_source = Path(__file__).parent / 'files' / 'dates.xls' + with open(str(xls_source), mode='rb') as fh: + dset = tablib.Dataset().load(fh, 'xls') + self.assertEqual(dset.dict[0]['birth_date'], datetime.datetime(2015, 4, 12, 0, 0)) + def test_xls_import_with_errors(self): """Errors from imported files are kept as errors.""" xls_source = Path(__file__).parent / 'files' / 'errors.xls' @@ -1021,6 +1015,13 @@ self.assertEqual(data.dict[0]['float'], 21.55) self.assertEqual(data.dict[0]['date/time'], date_time) + def test_xlsx_import_set_ragged(self): + """Import XLSX file when not all rows have the same length.""" + xlsx_source = Path(__file__).parent / 'files' / 'ragged.xlsx' + with open(str(xlsx_source), mode='rb') as fh: + book = tablib.Databook().load(fh, 'xlsx') + self.assertEqual(book.sheets()[0].pop(), (1.0, '')) + def test_xlsx_wrong_char(self): """Bad characters are not silently ignored. We let the exception bubble up.""" from openpyxl.utils.exceptions import IllegalCharacterError @@ -1029,6 +1030,13 @@ data.append(('string', b'\x0cf')) data.xlsx + def test_xlsx_cell_values(self): + """Test cell values are read and not formulas""" + xls_source = Path(__file__).parent / 'files' / 'xlsx_cell_values.xlsx' + with xls_source.open('rb') as fh: + data = tablib.Dataset().load(fh) + self.assertEqual(data.headers[0], 'Hello World') + class JSONTests(BaseTestCase): def test_json_format_detect(self):