From 80bd1e45e69a7fa880ff8402d59fcb4a61cd8721 Mon Sep 17 00:00:00 2001 From: chfw Date: Sat, 28 Nov 2020 22:36:22 +0000 Subject: [PATCH 1/7] :fire: remove travis build from ci. credit goes to #234 --- .github/PULL_REQUEST_TEMPLATE.md | 1 - .github/workflows/lint.yml | 20 ++++++++++++++++++++ .github/workflows/tests.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 20 -------------------- README.rst | 10 ++++++---- lint.sh | 2 +- pyexcel_xlsxr/_version.py | 2 +- setup.py | 8 ++++---- 8 files changed, 64 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6017f21..8996445 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,6 +4,5 @@ With your PR, here is a check list: - [ ] Has all code lines tested? - [ ] Has `make format` been run? - [ ] Please update CHANGELOG.yml(not CHANGELOG.rst) -- [ ] Passes all Travis CI builds - [ ] Has fair amount of documentation if your change is complex - [ ] Agree on NEW BSD License for your contribution diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..03122a1 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,20 @@ +name: lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + name: lint code + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: lint + run: | + pip install flake8 + pip install -r tests/requirements.txt + flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long . + python setup.py checkdocs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b1dac13 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +name: run_tests + +on: [push, pull_request] + +jobs: + test: + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + os: [macOs-latest, ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os }} + name: run tests + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: install + run: | + pip install -r requirements.txt + pip install -r tests/requirements.txt + - name: test + run: | + pip freeze + nosetests --verbosity=3 --with-coverage --cover-package pyexcel_xlsxr --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst pyexcel_xlsxr + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + name: ${{ matrix.os }} Python ${{ matrix.python-version }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 421fab5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: false -language: python -notifications: - email: false -python: - - 3.8 - - 3.7 - - 3.6 -before_install: - - 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 ; - fi - - 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 -script: - - make test -after_success: - codecov diff --git a/README.rst b/README.rst index d55f3d6..522045b 100644 --- a/README.rst +++ b/README.rst @@ -5,11 +5,11 @@ pyexcel-xlsxr - Let you focus on data, instead of xlsx format .. image:: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png :target: https://www.patreon.com/chfw -.. image:: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg +.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel-mobans/master/images/awesome-badge.svg :target: https://awesome-python.com/#specific-formats-processing -.. image:: https://travis-ci.org/pyexcel/pyexcel-xlsxr.svg?branch=master - :target: http://travis-ci.org/pyexcel/pyexcel-xlsxr +.. image:: https://github.com/pyexcel/pyexcel-xlsxr/workflows/run_tests/badge.svg + :target: http://github.com/pyexcel/pyexcel-xlsxr/actions .. image:: https://codecov.io/gh/pyexcel/pyexcel-xlsxr/branch/master/graph/badge.svg :target: https://codecov.io/gh/pyexcel/pyexcel-xlsxr @@ -19,7 +19,7 @@ pyexcel-xlsxr - Let you focus on data, instead of xlsx format .. image:: https://pepy.tech/badge/pyexcel-xlsxr/month - :target: https://pepy.tech/project/pyexcel-xlsxr/month + :target: https://pepy.tech/project/pyexcel-xlsxr .. image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg @@ -71,6 +71,8 @@ Known constraints Fonts, colors and charts are not supported. +Nor to read password protected xls, xlsx and ods files. + Installation ================================================================================ diff --git a/lint.sh b/lint.sh index 891aa63..d31eeaa 100644 --- a/lint.sh +++ b/lint.sh @@ -1,2 +1,2 @@ pip install flake8 -flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long . && python setup.py checkdocs +flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long . && python setup.py checkdocs \ No newline at end of file diff --git a/pyexcel_xlsxr/_version.py b/pyexcel_xlsxr/_version.py index 34ce970..d876429 100644 --- a/pyexcel_xlsxr/_version.py +++ b/pyexcel_xlsxr/_version.py @@ -1,2 +1,2 @@ __version__ = '0.6.0' -__author__ = 'chfw' +__author__ = 'C.W.' diff --git a/setup.py b/setup.py index 6766e86..fca8343 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ locale.setlocale(locale.LC_ALL, "en_US.UTF-8") NAME = "pyexcel-xlsxr" -AUTHOR = "chfw" +AUTHOR = "C.W." VERSION = "0.6.0" EMAIL = "info@pyexcel.org" LICENSE = "New BSD" @@ -73,13 +73,14 @@ } # 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-xlsxr v0.6.0 " + +HERE = os.path.abspath(os.path.dirname(__file__)) + +GS_COMMAND = ("gease pyexcel-xlsxr v0.6.0 " + "Find 0.6.0 in changelog for more details") NO_GS_MESSAGE = ("Automatic github release is disabled. " + "Please install gease to enable it.") UPLOAD_FAILED_MSG = ( 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND) -HERE = os.path.abspath(os.path.dirname(__file__)) class PublishCommand(Command): @@ -125,7 +126,6 @@ def run(self): "publish": PublishCommand }) - def has_gease(): """ test if github release command is installed From 057cea8dc4d8edcc3a09c5b7c9c023ea77153cda Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Mon, 11 Apr 2022 21:25:42 +0200 Subject: [PATCH 2/7] Potential fix for incorrect reading of data with empty cells when used with pyexcel --- pyexcel_xlsxr/messy_xlsx.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pyexcel_xlsxr/messy_xlsx.py b/pyexcel_xlsxr/messy_xlsx.py index 22fdba8..22193be 100644 --- a/pyexcel_xlsxr/messy_xlsx.py +++ b/pyexcel_xlsxr/messy_xlsx.py @@ -182,6 +182,14 @@ def __repr__(self): return str(self.value) +def column_to_number(column): + column = re.sub("[^A-Z]", "", column) + cl = len(column) - 1 + return sum( + [(ord(c.upper()) - 64) + (26 * (cl - i)) for i, c in enumerate(column)] + ) + + def parse_row(row_xml_string, book): if b"x14ac" in row_xml_string: row_xml_string = row_xml_string.replace( @@ -191,11 +199,20 @@ def parse_row(row_xml_string, book): cells = [] cell = Cell() + last_column_number = None for action, element in etree.iterparse(partial): - if element.tag in ["v", "t"]: cell.value = element.text elif element.tag in ["c"]: + ref = element.attrib.get("r") + if ref: + column_number = column_to_number(ref) + if last_column_number is not None: + padding = column_number - last_column_number - 1 + if padding > 0: + cells += [Cell() for _ in range(padding)] + last_column_number = column_number + local_type = element.attrib.get("t") cell.column_type = local_type style_int = element.attrib.get("s") From 3deb0d01d787585124aa02795e01330b5d3e174f Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 11 Nov 2024 08:37:07 +0000 Subject: [PATCH 3/7] :books: update project metadata --- .github/workflows/lint.yml | 4 ++-- .github/workflows/moban-update.yml | 8 ++++---- .github/workflows/pythonpublish.yml | 19 ++++++++++++------- .github/workflows/tests.yml | 25 ++++++++++++++----------- CONTRIBUTORS.rst | 8 +++++--- LICENSE | 4 ++-- README.rst | 12 ++++-------- 7 files changed, 43 insertions(+), 37 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 03122a1..3789494 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: python-version: 3.8 - name: lint run: | - pip install flake8 - pip install -r tests/requirements.txt + pip --use-deprecated=legacy-resolver install flake8 + pip --use-deprecated=legacy-resolver install -r tests/requirements.txt flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long . python setup.py checkdocs diff --git a/.github/workflows/moban-update.yml b/.github/workflows/moban-update.yml index 706fd82..4038e3d 100644 --- a/.github/workflows/moban-update.yml +++ b/.github/workflows/moban-update.yml @@ -8,22 +8,22 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} + token: ${{ secrets.PAT }} - name: Set up Python uses: actions/setup-python@v1 with: python-version: '3.7' - name: check changes run: | + pip install markupsafe==2.0.1 pip install moban gitfs2 pypifs moban-jinja2-github moban-ansible moban git status git diff --exit-code - name: Auto-commit if: failure() - uses: docker://cdssnc/auto-commit-github-action - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: stefanzweifel/git-auto-commit-action@v4 with: - args: >- + commit_message: >- This is an auto-commit, updating project meta data, such as changelog.rst, contributors.rst diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 9e7ec42..4ccaa8d 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -5,9 +5,16 @@ on: types: [created] jobs: - deploy: + pypi-publish: + name: upload release to PyPI runs-on: ubuntu-latest + # Specifying a GitHub environment is optional, but strongly encouraged + environment: pypi + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write steps: + # retrieve your distributions here - uses: actions/checkout@v1 - name: Set up Python uses: actions/setup-python@v1 @@ -16,11 +23,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + pip install setuptools wheel + - name: Build run: | python setup.py sdist bdist_wheel - twine upload dist/* + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b1dac13..c004ba3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,27 +1,30 @@ -name: run_tests +name: Run unit tests on Windows, Ubuntu and Mac on: [push, pull_request] jobs: + test: + name: ${{ matrix.os }} / ${{ matrix.python_version }} + runs-on: ${{ matrix.os }}-latest strategy: - fail-fast: false - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - os: [macOs-latest, ubuntu-latest, windows-latest] + fail-fast: false + matrix: + os: [Ubuntu] + python_version: ["3.9.16"] - runs-on: ${{ matrix.os }} - name: run tests steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python_version }} + architecture: x64 + - name: install run: | - pip install -r requirements.txt - pip install -r tests/requirements.txt + pip --use-deprecated=legacy-resolver install -r requirements.txt + pip --use-deprecated=legacy-resolver install -r tests/requirements.txt - name: test run: | pip freeze diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 423f980..16c04e4 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -1,6 +1,8 @@ -No contributors yet -======================= +1 contributors +================================================================================ -* Your github link will be listed here after your PR is merged +In alphabetical order: + +* `Mark Skelton `_ diff --git a/LICENSE b/LICENSE index ba2effe..92fd315 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2020 by Onni Software Ltd. and its contributors +Copyright (c) 2015-2022 by Onni Software Ltd. and its contributors All rights reserved. Redistribution and use in source and binary forms of the software as well @@ -13,7 +13,7 @@ that the following conditions are met: and/or other materials provided with the distribution. * Neither the name of 'pyexcel-xlsxr' nor the names of the contributors - may not be used to endorse or promote products derived from this software + may 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 522045b..1ce7bf7 100644 --- a/README.rst +++ b/README.rst @@ -8,9 +8,6 @@ pyexcel-xlsxr - Let you focus on data, instead of xlsx format .. image:: https://raw.githubusercontent.com/pyexcel/pyexcel-mobans/master/images/awesome-badge.svg :target: https://awesome-python.com/#specific-formats-processing -.. image:: https://github.com/pyexcel/pyexcel-xlsxr/workflows/run_tests/badge.svg - :target: http://github.com/pyexcel/pyexcel-xlsxr/actions - .. image:: https://codecov.io/gh/pyexcel/pyexcel-xlsxr/branch/master/graph/badge.svg :target: https://codecov.io/gh/pyexcel/pyexcel-xlsxr @@ -18,8 +15,7 @@ pyexcel-xlsxr - Let you focus on data, instead of xlsx format :target: https://pypi.org/project/pyexcel-xlsxr -.. image:: https://pepy.tech/badge/pyexcel-xlsxr/month - :target: https://pepy.tech/project/pyexcel-xlsxr + .. image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg @@ -316,7 +312,7 @@ Then install relevant development requirements: #. pip install -r tests/requirements.txt Once you have finished your changes, please provide test case(s), relevant documentation -and update CHANGELOG.rst. +and update changelog.yml .. note:: @@ -335,7 +331,7 @@ On Linux/Unix systems, please launch your tests like this:: $ make -On Windows systems, please issue this command:: +On Windows, please issue this command:: > test.bat @@ -347,7 +343,7 @@ Please run:: $ make format -so as to beautify your code otherwise travis-ci may fail your unit test. +so as to beautify your code otherwise your build may fail your unit test. From 39f53dcf7d517ca445bfd15358ac5a12048dd407 Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 11 Nov 2024 08:41:41 +0000 Subject: [PATCH 4/7] :books: update change log --- changelog.yml | 6 ++++++ pyexcel-xlsxr.yml | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/changelog.yml b/changelog.yml index 58c8ddf..37d7ac6 100644 --- a/changelog.yml +++ b/changelog.yml @@ -1,6 +1,12 @@ name: pyexcel-xlsxr organisation: pyexcel releases: +- changes: + - action: Updated + details: + - '#9: Potential fix for incorrect reading of data with empty cells when used with pyexcel ' + date: 11.11.2024 + version: 0.6.1 - changes: - action: Updated details: diff --git a/pyexcel-xlsxr.yml b/pyexcel-xlsxr.yml index 80a9e3e..caedee6 100644 --- a/pyexcel-xlsxr.yml +++ b/pyexcel-xlsxr.yml @@ -1,9 +1,9 @@ overrides: "pyexcel.yaml" name: "pyexcel-xlsxr" nick_name: "xlsxr" -version: "0.6.0" -current_version: "0.6.0" -release: "0.6.0" +version: "0.6.1" +current_version: "0.6.1" +release: "0.6.1" file_type: xlsx nodocs: true dependencies: From f855545e2d55cad162d918935df6ebded78fd3d3 Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 11 Nov 2024 08:42:07 +0000 Subject: [PATCH 5/7] This is an auto-commit, updating project meta data, such as changelog.rst, contributors.rst --- .readthedocs.yml | 23 +++++++++++++++++++++++ CHANGELOG.rst | 8 ++++++++ pyexcel_xlsxr/_version.py | 2 +- setup.py | 8 ++++---- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..9e00174 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# Optionally build your docs in additional formats such as PDF +formats: + - pdf + +python: + install: + - requirements: docs/requirements.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 332cd64..885aaf6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Change log ================================================================================ +0.6.1 - 11.11.2024 +-------------------------------------------------------------------------------- + +**Updated** + +#. #9: Potential fix for incorrect reading of data with empty cells when used + with pyexcel + 0.6.0 - 10.10.2020 -------------------------------------------------------------------------------- diff --git a/pyexcel_xlsxr/_version.py b/pyexcel_xlsxr/_version.py index d876429..91ed185 100644 --- a/pyexcel_xlsxr/_version.py +++ b/pyexcel_xlsxr/_version.py @@ -1,2 +1,2 @@ -__version__ = '0.6.0' +__version__ = '0.6.1' __author__ = 'C.W.' diff --git a/setup.py b/setup.py index fca8343..8073b20 100644 --- a/setup.py +++ b/setup.py @@ -32,14 +32,14 @@ NAME = "pyexcel-xlsxr" AUTHOR = "C.W." -VERSION = "0.6.0" +VERSION = "0.6.1" EMAIL = "info@pyexcel.org" LICENSE = "New BSD" DESCRIPTION = ( "Read xlsx file using partial xml" ) URL = "https://github.com/pyexcel/pyexcel-xlsxr" -DOWNLOAD_URL = "%s/archive/0.6.0.tar.gz" % URL +DOWNLOAD_URL = "%s/archive/0.6.1.tar.gz" % URL FILES = ["README.rst", "CHANGELOG.rst"] KEYWORDS = [ "python", @@ -75,8 +75,8 @@ PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable) HERE = os.path.abspath(os.path.dirname(__file__)) -GS_COMMAND = ("gease pyexcel-xlsxr v0.6.0 " + - "Find 0.6.0 in changelog for more details") +GS_COMMAND = ("gease pyexcel-xlsxr v0.6.1 " + + "Find 0.6.1 in changelog for more details") NO_GS_MESSAGE = ("Automatic github release is disabled. " + "Please install gease to enable it.") UPLOAD_FAILED_MSG = ( From 12aed925ea0005dd64b9b186804d88ea3e8a4229 Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 11 Nov 2024 08:53:04 +0000 Subject: [PATCH 6/7] :books: update change log --- pyexcel-xlsxr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyexcel-xlsxr.yml b/pyexcel-xlsxr.yml index caedee6..ced3766 100644 --- a/pyexcel-xlsxr.yml +++ b/pyexcel-xlsxr.yml @@ -4,6 +4,7 @@ nick_name: "xlsxr" version: "0.6.1" current_version: "0.6.1" release: "0.6.1" +copyright_year: 2015-2024 file_type: xlsx nodocs: true dependencies: From be84a6af07c8592609b33213852e641559347011 Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 11 Nov 2024 08:53:48 +0000 Subject: [PATCH 7/7] This is an auto-commit, updating project meta data, such as changelog.rst, contributors.rst --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 92fd315..1720954 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2022 by Onni Software Ltd. and its contributors +Copyright (c) 2015-2024 by Onni Software Ltd. and its contributors All rights reserved. Redistribution and use in source and binary forms of the software as well