From b942935169bb3a1f1028e716e409f2158cc07623 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 10 Oct 2020 14:39:53 +0100 Subject: [PATCH 1/7] :lipstick: kick start 0.6.3 --- CHANGELOG.rst | 8 ++++++++ LICENSE | 2 +- README.rst | 5 +++++ docs/source/conf.py | 2 +- docs/source/index.rst | 1 + pyexcel-io.yml | 4 ++-- setup.py | 8 ++++---- 7 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 50a44c7..6b8f1e7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Change log ================================================================================ +0.6.2 - 7.10.2020 +-------------------------------------------------------------------------------- + +**updated** + +#. `#94 `_: keep backward + compatibility for pyexcel-xls 0.4.1 + 0.6.1 - 7.10.2020 -------------------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE index 802c39c..747c8b4 100644 --- a/LICENSE +++ b/LICENSE @@ -13,7 +13,7 @@ that the following conditions are met: and/or other materials provided with the distribution. * Neither the name of 'pyexcel-io' nor the names of the contributors - may be used to endorse or promote products derived from this software + may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND diff --git a/README.rst b/README.rst index da577f8..2f9b838 100644 --- a/README.rst +++ b/README.rst @@ -29,6 +29,11 @@ pyexcel-io - Let you focus on data, instead of file formats .. image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg :target: https://gitter.im/pyexcel/Lobby +.. image:: https://img.shields.io/static/v1?label=continuous%20templating&message=%E6%A8%A1%E7%89%88%E6%9B%B4%E6%96%B0&color=blue&style=flat-square + :target: https://moban.readthedocs.io/en/latest/#at-scale-continous-templating-for-open-source-projects + +.. image:: https://img.shields.io/static/v1?label=coding%20style&message=black&color=black&style=flat-square + :target: https://github.com/psf/black .. image:: https://readthedocs.org/projects/pyexcel-io/badge/?version=latest :target: http://pyexcel-io.readthedocs.org/en/latest/ diff --git a/docs/source/conf.py b/docs/source/conf.py index 2828238..9c84362 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -28,7 +28,7 @@ # The short X.Y version version = '0.6.2' # The full version, including alpha/beta/rc tags -release = '0.6.2' +release = '0.6.3' # -- General configuration --------------------------------------------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index 95be968..4b66b2c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,6 +10,7 @@ :Source code: http://github.com/pyexcel/pyexcel-io.git :Issues: http://github.com/pyexcel/pyexcel-io/issues :License: New BSD License +:Development: |release| :Released: |version| :Generated: |today| diff --git a/pyexcel-io.yml b/pyexcel-io.yml index 8e44348..f344f13 100644 --- a/pyexcel-io.yml +++ b/pyexcel-io.yml @@ -3,8 +3,8 @@ project: "pyexcel-io" name: pyexcel-io nick_name: io version: 0.6.2 -current_version: 0.6.2 -release: 0.6.2 +current_version: 0.6.3 +release: 0.6.3 copyright_year: 2015-2020 moban_command: false is_on_conda: true diff --git a/setup.py b/setup.py index c03f51a..6c9261b 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ NAME = "pyexcel-io" AUTHOR = "chfw" -VERSION = "0.6.2" +VERSION = "0.6.3" EMAIL = "info@pyexcel.org" LICENSE = "New BSD" DESCRIPTION = ( @@ -40,7 +40,7 @@ "format and to/from databases" ) URL = "https://github.com/pyexcel/pyexcel-io" -DOWNLOAD_URL = "%s/archive/0.6.2.tar.gz" % URL +DOWNLOAD_URL = "%s/archive/0.6.3.tar.gz" % URL FILES = ["README.rst", "CHANGELOG.rst"] KEYWORDS = [ "python", @@ -85,8 +85,8 @@ } # You do not need to read beyond this line PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable) -GS_COMMAND = ("gs pyexcel-io v0.6.2 " + - "Find 0.6.2 in changelog for more details") +GS_COMMAND = ("gs pyexcel-io v0.6.3 " + + "Find 0.6.3 in changelog for more details") NO_GS_MESSAGE = ("Automatic github release is disabled. " + "Please install gease to enable it.") UPLOAD_FAILED_MSG = ( From 71c28b4bc911597fd8cfaa7d5182bf4d70e885dd Mon Sep 17 00:00:00 2001 From: jaska Date: Mon, 12 Oct 2020 22:56:58 +0100 Subject: [PATCH 2/7] Issue 96 (#97) * :bug: regression: unknown file type shall trigger NoSupportingPluginFound. fix #96 * This is an auto-commit, updating project meta data, such as changelog.rst, contributors.rst * :green_heart: update coding style. #96 * :microscope: more test coverage Co-authored-by: chfw --- CHANGELOG.rst | 8 ++++++++ changelog.yml | 6 ++++++ pyexcel_io/exceptions.py | 6 ------ pyexcel_io/reader.py | 25 +++++++------------------ pyexcel_io/readers/__init__.py | 5 +++++ pyexcel_io/readers/csvz.py | 7 +++++++ tests/test_issues.py | 22 +++++++--------------- tests/test_service.py | 6 ++++++ 8 files changed, 46 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6b8f1e7..95587f5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Change log ================================================================================ +0.6.3 - tbd +-------------------------------------------------------------------------------- + +**updated** + +#. `#96 `_: regression: unknown + file type shall trigger NoSupportingPluginFound + 0.6.2 - 7.10.2020 -------------------------------------------------------------------------------- diff --git a/changelog.yml b/changelog.yml index cdff924..15e5619 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,6 +1,12 @@ name: pyexcel-io organisation: pyexcel releases: +- changes: + - action: updated + details: + - "`#96`: regression: unknown file type shall trigger NoSupportingPluginFound" + version: 0.6.3 + date: tbd - changes: - action: updated details: diff --git a/pyexcel_io/exceptions.py b/pyexcel_io/exceptions.py index 8a8d1f6..b6d00aa 100644 --- a/pyexcel_io/exceptions.py +++ b/pyexcel_io/exceptions.py @@ -21,12 +21,6 @@ class SupportingPluginAvailableButNotInstalled(Exception): pass -class UpgradePlugin(Exception): - """raised when a known plugin is not compatible""" - - pass - - class IntegerAccuracyLossError(Exception): """ When an interger is greater than 999999999999999, ods loses its accuracy. diff --git a/pyexcel_io/reader.py b/pyexcel_io/reader.py index ee45c89..f0276fa 100644 --- a/pyexcel_io/reader.py +++ b/pyexcel_io/reader.py @@ -1,5 +1,3 @@ -from pyexcel_io import exceptions -from pyexcel_io.book import _convert_content_to_stream from pyexcel_io.sheet import SheetReader from pyexcel_io.plugins import NEW_READERS from pyexcel_io._compact import OrderedDict @@ -53,23 +51,14 @@ def open(self, file_name, **keywords): def open_content(self, file_content, **keywords): self.keywords, native_sheet_keywords = clean_keywords(keywords) - try: - if self.reader_class is None: - self.reader_class = NEW_READERS.get_a_plugin( - self.file_type, location="content", library=self.library - ) - self.reader = self.reader_class( - file_content, self.file_type, **native_sheet_keywords - ) - return self.reader - except ( - exceptions.NoSupportingPluginFound, - exceptions.SupportingPluginAvailableButNotInstalled, - ): - file_stream = _convert_content_to_stream( - file_content, self.file_type + if self.reader_class is None: + self.reader_class = NEW_READERS.get_a_plugin( + self.file_type, location="content", library=self.library ) - return self.open_stream(file_stream, **native_sheet_keywords) + self.reader = self.reader_class( + file_content, self.file_type, **native_sheet_keywords + ) + return self.reader def open_stream(self, file_stream, **keywords): self.keywords, native_sheet_keywords = clean_keywords(keywords) diff --git a/pyexcel_io/readers/__init__.py b/pyexcel_io/readers/__init__.py index 063674c..e06ec19 100644 --- a/pyexcel_io/readers/__init__.py +++ b/pyexcel_io/readers/__init__.py @@ -29,4 +29,9 @@ file_types=["csvz", "tsvz"], locations=["file", "memory"], stream_type="binary", +).add_a_reader( + relative_plugin_class_path="csvz.ContentReader", + file_types=["csvz", "tsvz"], + locations=["content"], + stream_type="binary", ) diff --git a/pyexcel_io/readers/csvz.py b/pyexcel_io/readers/csvz.py index 9fdc55e..4556015 100644 --- a/pyexcel_io/readers/csvz.py +++ b/pyexcel_io/readers/csvz.py @@ -8,6 +8,7 @@ :license: New BSD License, see LICENSE for more details """ import zipfile +from io import BytesIO import chardet from pyexcel_io import constants @@ -48,6 +49,12 @@ def read_sheet(self, index): return CSVinMemoryReader(NamedContent(name, sheet), **self.keywords) +class ContentReader(FileReader): + def __init__(self, file_content, file_type, **keywords): + io = BytesIO(file_content) + super().__init__(io, file_type, **keywords) + + def _get_sheet_name(filename): len_of_a_dot = 1 len_of_csv_word = 3 diff --git a/tests/test_issues.py b/tests/test_issues.py index b7b9dd5..50dc537 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -1,13 +1,11 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import os import pyexcel as p from pyexcel_io import get_data, save_data +from pyexcel_io.exceptions import NoSupportingPluginFound from nose import SkipTest -from nose.tools import eq_ +from nose.tools import eq_, raises IN_TRAVIS = "TRAVIS" in os.environ @@ -41,17 +39,6 @@ def test_issue_23(): eq_(data["issue23.csv"], expected) -# def test_issue_28(): -# from pyexcel_io.plugins import readers -# from pyexcel_io.exceptions import UpgradePlugin -# expected = "Please upgrade the plugin '%s' according to " -# expected += "plugin compactibility table." -# try: -# readers.load_me_later('pyexcel_test') -# except UpgradePlugin as e: -# eq_(str(e), expected % 'pyexcel_test') - - def test_issue_33_34(): import mmap @@ -154,5 +141,10 @@ def test_pyexcel_issue_138(): os.unlink("test.csv") +@raises(NoSupportingPluginFound) +def test_issue_96(): + get_data("foo-bar-data", file_type="Idonotexist") + + def get_fixture(file_name): return os.path.join("tests", "fixtures", file_name) diff --git a/tests/test_service.py b/tests/test_service.py index 7ded3d6..70f6209 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -3,6 +3,7 @@ from pyexcel_io.service import ( date_value, time_value, + float_value, boolean_value, ods_bool_value, ods_date_value, @@ -162,3 +163,8 @@ def test_time_value(): test_time_value = "PT23H00M01S" delta = time_value(test_time_value) eq_(delta, time(23, 0, 1)) + + +def test_float_value(): + a = float_value("1.2") + eq_(a, 1.2) From 6b9b0f7e3f78ecc5236b2ee779d2b176646c71dd Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 12 Oct 2020 22:58:12 +0100 Subject: [PATCH 3/7] :egg: :ferris_wheel: release 0.6.3 --- changelog.yml | 4 ++-- tests/test_issues.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog.yml b/changelog.yml index 15e5619..e53cad9 100644 --- a/changelog.yml +++ b/changelog.yml @@ -2,11 +2,11 @@ name: pyexcel-io organisation: pyexcel releases: - changes: - - action: updated + - action: fixed details: - "`#96`: regression: unknown file type shall trigger NoSupportingPluginFound" version: 0.6.3 - date: tbd + date: 12.10.2020 - changes: - action: updated details: diff --git a/tests/test_issues.py b/tests/test_issues.py index 50dc537..d9cbfd6 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -51,7 +51,7 @@ def test_issue_33_34(): def test_issue_30_utf8_BOM_header(): - content = [[u"人有悲歡離合", u"月有陰晴圓缺"]] + content = [["人有悲歡離合", "月有陰晴圓缺"]] test_file = "test-utf8-BOM.csv" save_data(test_file, content, encoding="utf-8-sig", lineterminator="\n") custom_encoded_content = get_data(test_file, encoding="utf-8-sig") From 12e1750e36f80bfd70a233b861f948a83b2fe09f Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 12 Oct 2020 21:58:41 +0000 Subject: [PATCH 4/7] This is an auto-commit, updating project meta data, such as changelog.rst, contributors.rst --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 95587f5..f3226d0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,10 +1,10 @@ Change log ================================================================================ -0.6.3 - tbd +0.6.3 - 12.10.2020 -------------------------------------------------------------------------------- -**updated** +**fixed** #. `#96 `_: regression: unknown file type shall trigger NoSupportingPluginFound From 23d278c5f145d39103c63718780285800f6d39a7 Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 12 Oct 2020 23:04:32 +0100 Subject: [PATCH 5/7] :books: update release version --- pyexcel-io.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyexcel-io.yml b/pyexcel-io.yml index f344f13..4dc5202 100644 --- a/pyexcel-io.yml +++ b/pyexcel-io.yml @@ -2,7 +2,7 @@ overrides: "pyexcel.yaml" project: "pyexcel-io" name: pyexcel-io nick_name: io -version: 0.6.2 +version: 0.6.3 current_version: 0.6.3 release: 0.6.3 copyright_year: 2015-2020 From db2faac409e5fbedcb8622340f0109cd3360782e Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 12 Oct 2020 23:06:18 +0100 Subject: [PATCH 6/7] :books: update extra dependencies --- changelog.yml | 3 +++ pyexcel-io.yml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog.yml b/changelog.yml index e53cad9..47f4053 100644 --- a/changelog.yml +++ b/changelog.yml @@ -5,6 +5,9 @@ releases: - action: fixed details: - "`#96`: regression: unknown file type shall trigger NoSupportingPluginFound" + - action: updated + details: + - "extra dependencies uses 0.6.0 based plugins" version: 0.6.3 date: 12.10.2020 - changes: diff --git a/pyexcel-io.yml b/pyexcel-io.yml index 4dc5202..8b43aff 100644 --- a/pyexcel-io.yml +++ b/pyexcel-io.yml @@ -17,11 +17,11 @@ test_dependencies: - pyexcel-xlsxw extra_dependencies: - xls: - - pyexcel-xls>=0.5.0 + - pyexcel-xls>=0.6.0 - xlsx: - - pyexcel-xlsx>=0.5.0 + - pyexcel-xlsx>=0.6.0 - ods: - - pyexcel-ods3>=0.5.0 + - pyexcel-ods3>=0.6.0 keywords: - API - tsv From 7adcec9bd008590c36d8b970b8e4c1d41daa6afa Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 12 Oct 2020 22:06:53 +0000 Subject: [PATCH 7/7] This is an auto-commit, updating project meta data, such as changelog.rst, contributors.rst --- CHANGELOG.rst | 4 ++++ docs/source/conf.py | 2 +- docs/source/index.rst | 1 - setup.py | 6 +++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f3226d0..92e656b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,10 @@ Change log #. `#96 `_: regression: unknown file type shall trigger NoSupportingPluginFound +**updated** + +#. extra dependencies uses 0.6.0 based plugins + 0.6.2 - 7.10.2020 -------------------------------------------------------------------------------- diff --git a/docs/source/conf.py b/docs/source/conf.py index 9c84362..a2fc48f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,7 +26,7 @@ copyright = '2015-2020 Onni Software Ltd.' author = 'chfw' # The short X.Y version -version = '0.6.2' +version = '0.6.3' # The full version, including alpha/beta/rc tags release = '0.6.3' diff --git a/docs/source/index.rst b/docs/source/index.rst index 4b66b2c..95be968 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,7 +10,6 @@ :Source code: http://github.com/pyexcel/pyexcel-io.git :Issues: http://github.com/pyexcel/pyexcel-io/issues :License: New BSD License -:Development: |release| :Released: |version| :Generated: |today| diff --git a/setup.py b/setup.py index 6c9261b..b5e4bea 100644 --- a/setup.py +++ b/setup.py @@ -79,9 +79,9 @@ PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests", "tests.*"]) EXTRAS_REQUIRE = { - "xls": ['pyexcel-xls>=0.5.0'], - "xlsx": ['pyexcel-xlsx>=0.5.0'], - "ods": ['pyexcel-ods3>=0.5.0'], + "xls": ['pyexcel-xls>=0.6.0'], + "xlsx": ['pyexcel-xlsx>=0.6.0'], + "ods": ['pyexcel-ods3>=0.6.0'], } # You do not need to read beyond this line PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)