From 78626bb2dc0d7c05da75e3a6e5b6ca7856ff22b4 Mon Sep 17 00:00:00 2001 From: chfw Date: Thu, 6 Apr 2017 23:04:06 +0100 Subject: [PATCH 01/15] update plugin protocol --- CHANGELOG.rst | 2 +- pyexcel_ods/__init__.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c453422..fd789d9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ Change log 0.3.1 - 02.02.2017 -------------------------------------------------------------------------------- -Updated +Added ******************************************************************************** #. Recognize currency type diff --git a/pyexcel_ods/__init__.py b/pyexcel_ods/__init__.py index 3d0a58f..3359b15 100644 --- a/pyexcel_ods/__init__.py +++ b/pyexcel_ods/__init__.py @@ -10,6 +10,7 @@ # because of dynamic import __FILE_TYPE__ = 'ods' __META__ = { + 'plugin_type': 'pyexcel io plugin', 'submodule': __FILE_TYPE__, 'file_types': [__FILE_TYPE__], 'stream_type': 'binary' From 1b1100db54699e33dbdf4cadd98dc2d3a67032c2 Mon Sep 17 00:00:00 2001 From: chfw Date: Thu, 6 Apr 2017 23:27:51 +0100 Subject: [PATCH 02/15] add lml for testing and use v0.4.x branches --- rnd_requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rnd_requirements.txt b/rnd_requirements.txt index 3188ce5..ce2c7f6 100644 --- a/rnd_requirements.txt +++ b/rnd_requirements.txt @@ -1,3 +1,4 @@ +https://github.com/chfw/lml/archive/master.zip https://github.com/pyexcel/pyexcel/archive/master.zip -https://github.com/pyexcel/pyexcel-io/archive/master.zip -https://github.com/pyexcel/pyexcel-xls/archive/master.zip +https://github.com/pyexcel/pyexcel-io/archive/v0.4.x.zip +https://github.com/pyexcel/pyexcel-xls/archive/v0.4.x.zip From b9b140d6e5c243ef6120661bf1c47acad9199cf7 Mon Sep 17 00:00:00 2001 From: chfw Date: Tue, 11 Apr 2017 17:37:01 +0100 Subject: [PATCH 03/15] pump up versions --- README.rst | 6 +++--- docs/source/conf.py | 20 ++++++++++++++------ pyexcel_ods.yaml | 4 ++-- setup.py | 2 +- test.bat | 4 +--- test.sh | 4 +--- tests/base.py | 6 +++--- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/README.rst b/README.rst index 0d83457..38fb3ac 100644 --- a/README.rst +++ b/README.rst @@ -287,7 +287,7 @@ Development steps for code changes Upgrade your setup tools and pip. They are needed for development and testing only: -#. pip install --upgrade setuptools "pip==7.1" +#. pip install --upgrade setuptools pip Then install relevant development requirements: @@ -296,7 +296,7 @@ Then install relevant development requirements: #. pip install -r tests/requirements.txt -In order to update test environment, and documentation, additional setps are +In order to update test environment, and documentation, additional steps are required: #. pip install moban @@ -325,7 +325,7 @@ Although `nose` and `doctest` are both used in code testing, it is adviable that On Linux/Unix systems, please launch your tests like this:: - $ make test + $ make On Windows systems, please issue this command:: diff --git a/docs/source/conf.py b/docs/source/conf.py index 62b0d6c..ae31813 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,8 @@ # -*- coding: utf-8 -*- +DESCRIPTION = ( + 'A wrapper library to read, manipulate and write data in ods format' + + '' +) extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', @@ -16,8 +20,8 @@ master_doc = 'index' project = u'pyexcel-ods' copyright = u'2015-2017 Onni Software Ltd.' -version = '0.3.0' -release = '0.3.1' +version = '0.3.1' +release = '0.4.0' exclude_patterns = [] pygments_style = 'sphinx' html_theme = 'default' @@ -25,15 +29,19 @@ html_static_path = ['_static'] htmlhelp_basename = 'pyexcel-odsdoc' latex_elements = {} latex_documents = [ - ('index', 'pyexcel-ods.tex', u'pyexcel-ods Documentation', + ('index', 'pyexcel-ods.tex', + 'pyexcel-ods Documentation', 'Onni Software Ltd.', 'manual'), ] man_pages = [ - ('index', 'pyexcel-ods', u'pyexcel-ods Documentation', + ('index', 'pyexcel-ods', + 'pyexcel-ods Documentation', [u'Onni Software Ltd.'], 1) ] texinfo_documents = [ - ('index', 'pyexcel-ods', u'pyexcel-ods Documentation', - 'Onni Software Ltd.', 'pyexcel-ods', 'One line description of project.', + ('index', 'pyexcel-ods', + 'pyexcel-ods Documentation', + 'Onni Software Ltd.', 'pyexcel-ods', + DESCRIPTION, 'Miscellaneous'), ] diff --git a/pyexcel_ods.yaml b/pyexcel_ods.yaml index a2152a5..31a2d10 100644 --- a/pyexcel_ods.yaml +++ b/pyexcel_ods.yaml @@ -1,8 +1,8 @@ overrides: "pyexcel.yaml" name: "pyexcel-ods" nick_name: ods -version: 0.3.1 -release: 0.3.0 +version: 0.4.0 +release: 0.3.1 file_type: ods dependencies: - pyexcel-io>=0.3.0 diff --git a/setup.py b/setup.py index fb71b11..a7fba70 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ except ImportError: NAME = 'pyexcel-ods' AUTHOR = 'C.W.' -VERSION = '0.3.1' +VERSION = '0.4.0' EMAIL = 'wangc_2011 (at) hotmail.com' LICENSE = 'New BSD' DESCRIPTION = ( diff --git a/test.bat b/test.bat index 86e1379..7e4a6fa 100644 --- a/test.bat +++ b/test.bat @@ -1,4 +1,2 @@ - - pip freeze -nosetests --with-cov --cover-package pyexcel_ods --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst docs/source pyexcel_ods && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long +nosetests --with-cov --cover-package pyexcel_ods --cover-package tests --with-doctest --doctest-extension=.rst README.rst tests docs/source pyexcel_ods && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long diff --git a/test.sh b/test.sh index 86e1379..7e4a6fa 100644 --- a/test.sh +++ b/test.sh @@ -1,4 +1,2 @@ - - pip freeze -nosetests --with-cov --cover-package pyexcel_ods --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst docs/source pyexcel_ods && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long +nosetests --with-cov --cover-package pyexcel_ods --cover-package tests --with-doctest --doctest-extension=.rst README.rst tests docs/source pyexcel_ods && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long diff --git a/tests/base.py b/tests/base.py index f92845b..e469574 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1,7 +1,7 @@ -import os +import os # noqa import pyexcel -import datetime -from nose.tools import raises, eq_ +import datetime # noqa +from nose.tools import raises, eq_ # noqa def create_sample_file1(file): From b1861b30349c980ec9331b1e15682ef2026e9076 Mon Sep 17 00:00:00 2001 From: chfw Date: Tue, 11 Apr 2017 17:41:39 +0100 Subject: [PATCH 04/15] simplify plugin interace. aligned it with pyexcel. both uses meta_class --- pyexcel_ods/ods.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pyexcel_ods/ods.py b/pyexcel_ods/ods.py index 8d9f651..f1e6328 100644 --- a/pyexcel_ods/ods.py +++ b/pyexcel_ods/ods.py @@ -113,6 +113,9 @@ class ODSSheet(SheetReader): class ODSBook(BookReader): """read ods book""" + file_types = ['ods'] + stream_type = 'binary' + library = 'pyexcel-ods' def open(self, file_name, **keywords): """open ods file""" @@ -221,6 +224,10 @@ class ODSWriter(BookWriter): open document spreadsheet writer """ + file_types = ['ods'] + stream_type = 'binary' + library = 'pyexcel-ods' + def __init__(self): BookWriter.__init__(self) self._native_book = OpenDocumentSpreadsheet() @@ -242,15 +249,3 @@ class ODSWriter(BookWriter): def is_integer_ok_for_xl_float(value): """check if a float had zero value in digits""" return value == math.floor(value) - - -_ods_registry = { - "file_type": "ods", - "reader": ODSBook, - "writer": ODSWriter, - "stream_type": "binary", - "mime_type": "application/vnd.oasis.opendocument.spreadsheet", - "library": "pyexcel-ods" -} - -exports = (_ods_registry,) From 16133985e360a87a754ada49623b887ae8687099 Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 7 May 2017 17:51:44 +0100 Subject: [PATCH 05/15] fix the merge error --- rnd_requirements.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rnd_requirements.txt b/rnd_requirements.txt index b1f9be1..79fea6b 100644 --- a/rnd_requirements.txt +++ b/rnd_requirements.txt @@ -1,7 +1,5 @@ -<<<<<<< HEAD https://github.com/chfw/lml/archive/master.zip https://github.com/pyexcel/pyexcel/archive/master.zip https://github.com/pyexcel/pyexcel-io/archive/v0.4.x.zip https://github.com/pyexcel/pyexcel-xls/archive/v0.4.x.zip -======= ->>>>>>> master + From 548f2b17e6e4590cb4c2ea3d553aefafea5179a7 Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 7 May 2017 17:55:49 +0100 Subject: [PATCH 06/15] update test cases --- tests/test_ods_reader.py | 11 ++++++----- tests/test_writer.py | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_ods_reader.py b/tests/test_ods_reader.py index 551bda3..cf7c1f3 100644 --- a/tests/test_ods_reader.py +++ b/tests/test_ods_reader.py @@ -1,11 +1,12 @@ import os -from pyexcel_ods import ods +from pyexcel_ods.odsr import ODSBook +from pyexcel_ods.odsw import ODSWriter from base import ODSCellTypes class TestODSReader(ODSCellTypes): def setUp(self): - r = ods.ODSBook() + r = ODSBook() r.open(os.path.join("tests", "fixtures", "ods_formats.ods")) @@ -17,17 +18,17 @@ class TestODSReader(ODSCellTypes): class TestODSWriter(ODSCellTypes): def setUp(self): - r = ods.ODSBook() + r = ODSBook() r.open(os.path.join("tests", "fixtures", "ods_formats.ods")) self.data1 = r.read_all() self.testfile = "odswriter.ods" - w = ods.ODSWriter() + w = ODSWriter() w.open(self.testfile) w.write(self.data1) w.close() - r2 = ods.ODSBook() + r2 = ODSBook() r2.open(self.testfile) self.data = r2.read_all() for key in self.data.keys(): diff --git a/tests/test_writer.py b/tests/test_writer.py index 4eedec4..1e5a799 100644 --- a/tests/test_writer.py +++ b/tests/test_writer.py @@ -1,5 +1,6 @@ import os -from pyexcel_ods.ods import ODSWriter as Writer, ODSBook as Reader +from pyexcel_ods.odsw import ODSWriter as Writer +from pyexcel_ods.odsr import ODSBook as Reader from base import PyexcelWriterBase, PyexcelHatWriterBase From 1e78632474ec7d124e50184414b0a45137078046 Mon Sep 17 00:00:00 2001 From: chfw Date: Sun, 7 May 2017 18:00:50 +0100 Subject: [PATCH 07/15] update readme --- .moban.d/README.rst | 3 +++ README.rst | 1 + 2 files changed, 4 insertions(+) diff --git a/.moban.d/README.rst b/.moban.d/README.rst index d17295c..83502eb 100644 --- a/.moban.d/README.rst +++ b/.moban.d/README.rst @@ -1,5 +1,8 @@ {%extends 'README.rst.jj2' %} +{%block documentation_link%} +{%endblock%} + {%block description%} **pyexcel-ods** is a tiny wrapper library to read, manipulate and write data in ods format using python 2.6 and python 2.7. You are likely to use it with diff --git a/README.rst b/README.rst index 2e9179a..2decc89 100644 --- a/README.rst +++ b/README.rst @@ -11,6 +11,7 @@ pyexcel-ods - Let you focus on data, instead of ods format .. image:: https://codecov.io/github/pyexcel/pyexcel-ods/coverage.png :target: https://codecov.io/github/pyexcel/pyexcel-ods + **pyexcel-ods** is a tiny wrapper library to read, manipulate and write data in ods format using python 2.6 and python 2.7. You are likely to use it with `pyexcel `_. From 8635232a179978cf6eb4e9f053729c1ca150a2b6 Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 22 May 2017 08:43:08 +0100 Subject: [PATCH 08/15] propagate the lml interface changes --- README.rst | 2 +- pyexcel_ods/__init__.py | 8 ++++---- pyexcel_ods/odsr.py | 4 ---- pyexcel_ods/odsw.py | 4 ---- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.rst b/README.rst index 2decc89..64b0e70 100644 --- a/README.rst +++ b/README.rst @@ -351,5 +351,5 @@ Support the project ================================================================================ If your company has embedded pyexcel and its components into a revenue generating -product, please `support me on patreon `_ to +product, please `support me on patreon `_ to maintain the project and develop it further. diff --git a/pyexcel_ods/__init__.py b/pyexcel_ods/__init__.py index f24fee0..70c50de 100644 --- a/pyexcel_ods/__init__.py +++ b/pyexcel_ods/__init__.py @@ -8,16 +8,16 @@ # flake8: noqa # this line has to be place above all else # because of dynamic import -from pyexcel_io.plugins import IORegistry +from pyexcel_io.plugins import IOPluginInfoChain from pyexcel_io.io import get_data as read_data, isstream, store_data as write_data __FILE_TYPE__ = 'ods' -IORegistry(__name__).add_a_reader( - submodule='odsr.ODSBook', +IOPluginInfoChain(__name__).add_a_reader( + relative_plugin_class_path='odsr.ODSBook', file_types=[__FILE_TYPE__], stream_type='binary' ).add_a_writer( - submodule='odsw.ODSWriter', + relative_plugin_class_path='odsw.ODSWriter', file_types=[__FILE_TYPE__], stream_type='binary' ) diff --git a/pyexcel_ods/odsr.py b/pyexcel_ods/odsr.py index f7b965b..ce1ed70 100644 --- a/pyexcel_ods/odsr.py +++ b/pyexcel_ods/odsr.py @@ -124,10 +124,6 @@ class ODSSheet(SheetReader): class ODSBook(BookReader): """read ods book""" - file_types = ['ods'] - stream_type = 'binary' - library = 'pyexcel-ods' - def open(self, file_name, **keywords): """open ods file""" BookReader.open(self, file_name, **keywords) diff --git a/pyexcel_ods/odsw.py b/pyexcel_ods/odsw.py index c6b9651..c1a6af4 100644 --- a/pyexcel_ods/odsw.py +++ b/pyexcel_ods/odsw.py @@ -80,10 +80,6 @@ class ODSWriter(BookWriter): open document spreadsheet writer """ - file_types = ['ods'] - stream_type = 'binary' - library = 'pyexcel-ods' - def __init__(self): BookWriter.__init__(self) self._native_book = OpenDocumentSpreadsheet() From 4c35d8f90a57d381f0bf5cd0d25ce67f1eca49e0 Mon Sep 17 00:00:00 2001 From: chfw Date: Wed, 31 May 2017 23:39:12 +0100 Subject: [PATCH 09/15] verify odfpy does close file handle, https://github.com/pyexcel/pyexcel-xlsx/issues/14 --- tests/test_bug_fixes.py | 43 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/tests/test_bug_fixes.py b/tests/test_bug_fixes.py index 8bb936d..d39c14b 100644 --- a/tests/test_bug_fixes.py +++ b/tests/test_bug_fixes.py @@ -1,12 +1,14 @@ #!/usr/bin/python # -*- encoding: utf-8 -*- import os +import psutil +import pyexcel as pe from pyexcel_ods import get_data, save_data from nose.tools import raises, eq_ def test_bug_fix_for_issue_1(): - data = get_data(os.path.join("tests", "fixtures", "repeated.ods")) + data = get_data(get_fixtures("repeated.ods")) eq_(data["Sheet1"], [['repeated', 'repeated', 'repeated', 'repeated']]) @@ -81,20 +83,53 @@ def test_issue_13(): def test_issue_14(): # pyexcel issue 61 test_file = "issue_61.ods" - data = get_data(os.path.join("tests", "fixtures", test_file), + data = get_data(get_fixtures(test_file), skip_empty_rows=True) eq_(data['S-LMC'], [[u'aaa'], [0]]) def test_issue_6(): test_file = "12_day_as_time.ods" - data = get_data(os.path.join("tests", "fixtures", test_file), + data = get_data(get_fixtures(test_file), skip_empty_rows=True) eq_(data['Sheet1'][0][0].days, 12) def test_issue_19(): test_file = "pyexcel_81_ods_19.ods" - data = get_data(os.path.join("tests", "fixtures", test_file), + data = get_data(get_fixtures(test_file), skip_empty_rows=True) eq_(data['product.template'][1][1], 'PRODUCT NAME PMP') + + +def test_issue_83_ods_file_handle(): + # this proves that odfpy + # does not leave a file handle open at all + proc = psutil.Process() + test_file = get_fixtures("issue_61.ods") + open_files_l1 = proc.open_files() + + # start with a csv file + data = pe.iget_array(file_name=test_file) + open_files_l2 = proc.open_files() + delta = len(open_files_l2) - len(open_files_l1) + # cannot catch open file handle + assert delta == 0 + + # now the file handle get opened when we run through + # the generator + list(data) + open_files_l3 = proc.open_files() + delta = len(open_files_l3) - len(open_files_l1) + # cannot catch open file handle + assert delta == 0 + + # free the fish + pe.free_resource() + open_files_l4 = proc.open_files() + # this confirms that no more open file handle + eq_(open_files_l1, open_files_l4) + + +def get_fixtures(filename): + return os.path.join("tests", "fixtures", filename) From f5930fcf896f8f8c3ec799118ef553023f8ec9ea Mon Sep 17 00:00:00 2001 From: chfw Date: Wed, 31 May 2017 23:40:17 +0100 Subject: [PATCH 10/15] make sure pyexcel-ods is used for reading --- tests/test_bug_fixes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bug_fixes.py b/tests/test_bug_fixes.py index d39c14b..7d0478c 100644 --- a/tests/test_bug_fixes.py +++ b/tests/test_bug_fixes.py @@ -110,7 +110,7 @@ def test_issue_83_ods_file_handle(): open_files_l1 = proc.open_files() # start with a csv file - data = pe.iget_array(file_name=test_file) + data = pe.iget_array(file_name=test_file, library='pyexcel-ods') open_files_l2 = proc.open_files() delta = len(open_files_l2) - len(open_files_l1) # cannot catch open file handle From b896b3979ad88998f71bac07d2e4e797e392600f Mon Sep 17 00:00:00 2001 From: chfw Date: Thu, 1 Jun 2017 22:35:00 +0100 Subject: [PATCH 11/15] avoid updating setuptools 36.0 because it has a bug needing six --- .travis.yml | 1 - docs/source/conf.py | 2 +- tests/requirements.txt | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 23877d2..8f123a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ before_install: - if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then mv min_requirements.txt requirements.txt ; fi - - pip install --upgrade setuptools "pip==7.1" - test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ; - pip install -r tests/requirements.txt diff --git a/docs/source/conf.py b/docs/source/conf.py index 6f3829f..8f5fdc0 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,7 @@ extensions = [ ] intersphinx_mapping = { - 'pyexcel': ('http://pyexcel.readthedocs.org/en/latest/', None) + 'pyexcel': ('http://pyexcel.readthedocs.org/en/latest/', None), } spelling_word_list_filename = 'spelling_wordlist.txt' templates_path = ['_templates'] diff --git a/tests/requirements.txt b/tests/requirements.txt index f13a9b5..973f2b9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,5 @@ nose +mock;python_version<"3" codecov coverage flake8 From cafad5cbfaa2b7fe906ba8b5cfee7e5aa2be2d35 Mon Sep 17 00:00:00 2001 From: chfw Date: Thu, 1 Jun 2017 22:44:40 +0100 Subject: [PATCH 12/15] add test dependency --- .moban.d/tests/requirements.txt | 1 + tests/requirements.txt | 1 + tests/test_writer.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.moban.d/tests/requirements.txt b/.moban.d/tests/requirements.txt index 3f0c5aa..962ea54 100644 --- a/.moban.d/tests/requirements.txt +++ b/.moban.d/tests/requirements.txt @@ -1,5 +1,6 @@ {% extends 'tests/requirements.txt.jj2' %} {%block extras %} +psutil pyexcel pyexcel-xls {%endblock%} diff --git a/tests/requirements.txt b/tests/requirements.txt index 973f2b9..4b23de1 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,5 +3,6 @@ mock;python_version<"3" codecov coverage flake8 +psutil pyexcel pyexcel-xls diff --git a/tests/test_writer.py b/tests/test_writer.py index 1e5a799..5dec2db 100644 --- a/tests/test_writer.py +++ b/tests/test_writer.py @@ -19,10 +19,10 @@ class TestNativeODSWriter: reader = Reader() reader.open(self.testfile) content = reader.read_all() - reader.close() for key in content.keys(): content[key] = list(content[key]) assert content == self.content + reader.close() def tearDown(self): if os.path.exists(self.testfile): From 5a8e72b24b9ea75c995416fd59821d5565379b17 Mon Sep 17 00:00:00 2001 From: chfw Date: Tue, 13 Jun 2017 18:58:46 +0100 Subject: [PATCH 13/15] update dependencies --- .travis.yml | 3 +++ README.rst | 22 +++++++++++++++------- docs/source/conf.py | 2 +- pyexcel_ods.yaml | 4 ++-- pyexcel_ods/odsr.py | 13 ++++--------- requirements.txt | 2 +- setup.py | 2 +- 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f123a4..3f300e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,9 @@ python: - 2.7 - 2.6 before_install: + - cd $HOME + - "if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then deactivate && wget https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-5.7.1-linux_x86_64-portable.tar.bz2 -O - | tar -jxf - && echo 'Setting up aliases...' && ln -s pypy-5.7.1-linux_x86_64-portable pypy2-latest && export PATH=$HOME/pypy2-latest/bin/:$PATH && virtualenv --no-site-packages --python ~/pypy2-latest/bin/pypy pypy2-env && echo 'Creating custom env...' && source pypy2-env/bin/activate && python -V; fi" + - cd - - if [[ $TRAVIS_PYTHON_VERSION == "2.6" ]]; then pip install flake8==2.6.2; fi - if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then mv min_requirements.txt requirements.txt ; diff --git a/README.rst b/README.rst index 64b0e70..16ef068 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,21 @@ or clone it and install it: $ cd pyexcel-ods $ python setup.py install +Support the project +================================================================================ + +If your company has embedded pyexcel and its components into a revenue generating +product, please `support me on patreon `_ to +maintain the project and develop it further. + +If you are an individual, you are welcome to support me too on patreon and for however long +you feel like to. As a patreon, you will receive +`early access to pyexcel related contents `_. + +With your financial support, I will be able to invest +a little bit more time in coding, documentation and writing interesting posts. + + Usage ================================================================================ @@ -346,10 +361,3 @@ ODSReader is originally written by `Marco Conti >> import os >>> os.unlink("your_file.ods") >>> os.unlink("another_file.ods") - -Support the project -================================================================================ - -If your company has embedded pyexcel and its components into a revenue generating -product, please `support me on patreon `_ to -maintain the project and develop it further. diff --git a/docs/source/conf.py b/docs/source/conf.py index 8f5fdc0..01ee293 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,7 @@ master_doc = 'index' project = u'pyexcel-ods' copyright = u'2015-2017 Onni Software Ltd.' -version = '0.3.3' +version = '0.4.0' release = '0.4.0' exclude_patterns = [] pygments_style = 'sphinx' diff --git a/pyexcel_ods.yaml b/pyexcel_ods.yaml index 9d79aca..b780f92 100644 --- a/pyexcel_ods.yaml +++ b/pyexcel_ods.yaml @@ -2,9 +2,9 @@ overrides: "pyexcel.yaml" name: "pyexcel-ods" nick_name: ods version: 0.4.0 -release: 0.3.3 +release: 0.4.0 file_type: ods dependencies: - - pyexcel-io>=0.3.0 + - pyexcel-io>=0.4.0 - odfpy>=1.3.3 description: A wrapper library to read, manipulate and write data in ods format diff --git a/pyexcel_ods/odsr.py b/pyexcel_ods/odsr.py index ce1ed70..b37d109 100644 --- a/pyexcel_ods/odsr.py +++ b/pyexcel_ods/odsr.py @@ -22,7 +22,6 @@ # limitations under the License. # Thanks to grt for the fixes -import sys import math from odf.table import TableRow, TableCell, Table @@ -32,17 +31,10 @@ from odf.opendocument import load from pyexcel_io.book import BookReader from pyexcel_io.sheet import SheetReader +from pyexcel_io._compact import OrderedDict, PY2 import pyexcel_ods.converter as converter -PY2 = sys.version_info[0] == 2 - -PY27_BELOW = PY2 and sys.version_info[1] < 7 -if PY27_BELOW: - from ordereddict import OrderedDict -else: - from collections import OrderedDict - class ODSSheet(SheetReader): """native ods sheet""" @@ -168,6 +160,9 @@ class ODSBook(BookReader): sheet = ODSSheet(native_sheet, **self._keywords) return {sheet.name: sheet.to_array()} + def close(self): + self._native_book = None + def _load_from_memory(self): self._native_book = load(self._file_stream) diff --git a/requirements.txt b/requirements.txt index 606b659..bbd7824 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pyexcel-io>=0.3.0 +pyexcel-io>=0.4.0 odfpy>=1.3.3 diff --git a/setup.py b/setup.py index a7fba70..78ac3fa 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ CLASSIFIERS = [ ] INSTALL_REQUIRES = [ - 'pyexcel-io>=0.3.0', + 'pyexcel-io>=0.4.0', 'odfpy>=1.3.3', ] From ec2c312ce16a6376adc1a4d86ad028c96712d810 Mon Sep 17 00:00:00 2001 From: chfw Date: Wed, 14 Jun 2017 23:20:23 +0100 Subject: [PATCH 14/15] make _native book as none for writer --- pyexcel_ods/odsw.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyexcel_ods/odsw.py b/pyexcel_ods/odsw.py index c1a6af4..87856c5 100644 --- a/pyexcel_ods/odsw.py +++ b/pyexcel_ods/odsw.py @@ -96,3 +96,4 @@ class ODSWriter(BookWriter): """ self._native_book.write(self._file_alike_object) + self._native_book = None From ab98fe8849736284595ea1e06d26713c41aaf64f Mon Sep 17 00:00:00 2001 From: chfw Date: Wed, 14 Jun 2017 23:27:31 +0100 Subject: [PATCH 15/15] fix broken tests --- tests/test_bug_fixes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bug_fixes.py b/tests/test_bug_fixes.py index 7d0478c..58443b9 100644 --- a/tests/test_bug_fixes.py +++ b/tests/test_bug_fixes.py @@ -125,7 +125,7 @@ def test_issue_83_ods_file_handle(): assert delta == 0 # free the fish - pe.free_resource() + pe.free_resources() open_files_l4 = proc.open_files() # this confirms that no more open file handle eq_(open_files_l1, open_files_l4)