Skip to content

Commit

Permalink
Merge pull request #98 from pyexcel/dev
Browse files Browse the repository at this point in the history
Release 0.6.3
  • Loading branch information
chfw authored Oct 12, 2020
2 parents aa5e1b0 + 7adcec9 commit 9d70e97
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 56 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Change log
================================================================================

0.6.3 - 12.10.2020
--------------------------------------------------------------------------------

**fixed**

#. `#96 <https://github.com/pyexcel/pyexcel-io/issues/96>`_: regression: unknown
file type shall trigger NoSupportingPluginFound

**updated**

#. extra dependencies uses 0.6.0 based plugins

0.6.2 - 7.10.2020
--------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
9 changes: 9 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: pyexcel-io
organisation: pyexcel
releases:
- changes:
- 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:
- action: updated
details:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
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.2'
release = '0.6.3'

# -- General configuration ---------------------------------------------------

Expand Down
12 changes: 6 additions & 6 deletions pyexcel-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ overrides: "pyexcel.yaml"
project: "pyexcel-io"
name: pyexcel-io
nick_name: io
version: 0.6.2
current_version: 0.6.2
release: 0.6.2
version: 0.6.3
current_version: 0.6.3
release: 0.6.3
copyright_year: 2015-2020
moban_command: false
is_on_conda: true
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions pyexcel_io/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 7 additions & 18 deletions pyexcel_io/reader.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions pyexcel_io/readers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
7 changes: 7 additions & 0 deletions pyexcel_io/readers/csvz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@

NAME = "pyexcel-io"
AUTHOR = "chfw"
VERSION = "0.6.2"
VERSION = "0.6.3"
EMAIL = "info@pyexcel.org"
LICENSE = "New BSD"
DESCRIPTION = (
"A python library to read and write structured data in csv, zipped csv" +
"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",
Expand Down Expand Up @@ -79,14 +79,14 @@

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)
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 = (
Expand Down
24 changes: 8 additions & 16 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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

Expand All @@ -64,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")
Expand Down Expand Up @@ -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)
6 changes: 6 additions & 0 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pyexcel_io.service import (
date_value,
time_value,
float_value,
boolean_value,
ods_bool_value,
ods_date_value,
Expand Down Expand Up @@ -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)

0 comments on commit 9d70e97

Please sign in to comment.