Skip to content

Commit 03b87d5

Browse files
authored
Merge pull request #11 from pyexcel/dev
maintenance fix
2 parents cd8c4e3 + be84a6a commit 03b87d5

17 files changed

+154
-60
lines changed

.github/PULL_REQUEST_TEMPLATE.md

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ With your PR, here is a check list:
44
- [ ] Has all code lines tested?
55
- [ ] Has `make format` been run?
66
- [ ] Please update CHANGELOG.yml(not CHANGELOG.rst)
7-
- [ ] Passes all Travis CI builds
87
- [ ] Has fair amount of documentation if your change is complex
98
- [ ] Agree on NEW BSD License for your contribution

.github/workflows/lint.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
name: lint code
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python
12+
uses: actions/setup-python@v1
13+
with:
14+
python-version: 3.8
15+
- name: lint
16+
run: |
17+
pip --use-deprecated=legacy-resolver install flake8
18+
pip --use-deprecated=legacy-resolver install -r tests/requirements.txt
19+
flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long .
20+
python setup.py checkdocs

.github/workflows/moban-update.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ jobs:
88
- uses: actions/checkout@v2
99
with:
1010
ref: ${{ github.head_ref }}
11+
token: ${{ secrets.PAT }}
1112
- name: Set up Python
1213
uses: actions/setup-python@v1
1314
with:
1415
python-version: '3.7'
1516
- name: check changes
1617
run: |
18+
pip install markupsafe==2.0.1
1719
pip install moban gitfs2 pypifs moban-jinja2-github moban-ansible
1820
moban
1921
git status
2022
git diff --exit-code
2123
- name: Auto-commit
2224
if: failure()
23-
uses: docker://cdssnc/auto-commit-github-action
24-
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
uses: stefanzweifel/git-auto-commit-action@v4
2626
with:
27-
args: >-
27+
commit_message: >-
2828
This is an auto-commit, updating project meta data,
2929
such as changelog.rst, contributors.rst

.github/workflows/pythonpublish.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ on:
55
types: [created]
66

77
jobs:
8-
deploy:
8+
pypi-publish:
9+
name: upload release to PyPI
910
runs-on: ubuntu-latest
11+
# Specifying a GitHub environment is optional, but strongly encouraged
12+
environment: pypi
13+
permissions:
14+
# IMPORTANT: this permission is mandatory for trusted publishing
15+
id-token: write
1016
steps:
17+
# retrieve your distributions here
1118
- uses: actions/checkout@v1
1219
- name: Set up Python
1320
uses: actions/setup-python@v1
@@ -16,11 +23,9 @@ jobs:
1623
- name: Install dependencies
1724
run: |
1825
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
20-
- name: Build and publish
21-
env:
22-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
26+
pip install setuptools wheel
27+
- name: Build
2428
run: |
2529
python setup.py sdist bdist_wheel
26-
twine upload dist/*
30+
- name: Publish package distributions to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run unit tests on Windows, Ubuntu and Mac
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
test:
8+
name: ${{ matrix.os }} / ${{ matrix.python_version }}
9+
runs-on: ${{ matrix.os }}-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [Ubuntu]
14+
python_version: ["3.9.16"]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python_version }}
22+
architecture: x64
23+
24+
- name: install
25+
run: |
26+
pip --use-deprecated=legacy-resolver install -r requirements.txt
27+
pip --use-deprecated=legacy-resolver install -r tests/requirements.txt
28+
- name: test
29+
run: |
30+
pip freeze
31+
nosetests --verbosity=3 --with-coverage --cover-package pyexcel_xlsxr --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst pyexcel_xlsxr
32+
- name: Upload coverage
33+
uses: codecov/codecov-action@v1
34+
with:
35+
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

.readthedocs.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.12"
12+
13+
# Build documentation in the docs/ directory with Sphinx
14+
sphinx:
15+
configuration: docs/source/conf.py
16+
17+
# Optionally build your docs in additional formats such as PDF
18+
formats:
19+
- pdf
20+
21+
python:
22+
install:
23+
- requirements: docs/requirements.txt

.travis.yml

-20
This file was deleted.

CHANGELOG.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Change log
22
================================================================================
33

4+
0.6.1 - 11.11.2024
5+
--------------------------------------------------------------------------------
6+
7+
**Updated**
8+
9+
#. #9: Potential fix for incorrect reading of data with empty cells when used
10+
with pyexcel
11+
412
0.6.0 - 10.10.2020
513
--------------------------------------------------------------------------------
614

CONTRIBUTORS.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22

3-
No contributors yet
4-
=======================
3+
1 contributors
4+
================================================================================
55

6-
* Your github link will be listed here after your PR is merged
6+
In alphabetical order:
7+
8+
* `Mark Skelton <https://github.com/mtskelton>`_

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015-2020 by Onni Software Ltd. and its contributors
1+
Copyright (c) 2015-2024 by Onni Software Ltd. and its contributors
22
All rights reserved.
33

44
Redistribution and use in source and binary forms of the software as well
@@ -13,7 +13,7 @@ that the following conditions are met:
1313
and/or other materials provided with the distribution.
1414

1515
* Neither the name of 'pyexcel-xlsxr' nor the names of the contributors
16-
may not be used to endorse or promote products derived from this software
16+
may be used to endorse or promote products derived from this software
1717
without specific prior written permission.
1818

1919
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND

README.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ pyexcel-xlsxr - Let you focus on data, instead of xlsx format
55
.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png
66
:target: https://www.patreon.com/chfw
77

8-
.. image:: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg
8+
.. image:: https://raw.githubusercontent.com/pyexcel/pyexcel-mobans/master/images/awesome-badge.svg
99
:target: https://awesome-python.com/#specific-formats-processing
1010

11-
.. image:: https://travis-ci.org/pyexcel/pyexcel-xlsxr.svg?branch=master
12-
:target: http://travis-ci.org/pyexcel/pyexcel-xlsxr
13-
1411
.. image:: https://codecov.io/gh/pyexcel/pyexcel-xlsxr/branch/master/graph/badge.svg
1512
:target: https://codecov.io/gh/pyexcel/pyexcel-xlsxr
1613

1714
.. image:: https://badge.fury.io/py/pyexcel-xlsxr.svg
1815
:target: https://pypi.org/project/pyexcel-xlsxr
1916

2017

21-
.. image:: https://pepy.tech/badge/pyexcel-xlsxr/month
22-
:target: https://pepy.tech/project/pyexcel-xlsxr/month
18+
2319

2420

2521
.. image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg
@@ -71,6 +67,8 @@ Known constraints
7167

7268
Fonts, colors and charts are not supported.
7369

70+
Nor to read password protected xls, xlsx and ods files.
71+
7472
Installation
7573
================================================================================
7674

@@ -314,7 +312,7 @@ Then install relevant development requirements:
314312
#. pip install -r tests/requirements.txt
315313

316314
Once you have finished your changes, please provide test case(s), relevant documentation
317-
and update CHANGELOG.rst.
315+
and update changelog.yml
318316

319317
.. note::
320318

@@ -333,7 +331,7 @@ On Linux/Unix systems, please launch your tests like this::
333331

334332
$ make
335333

336-
On Windows systems, please issue this command::
334+
On Windows, please issue this command::
337335

338336
> test.bat
339337

@@ -345,7 +343,7 @@ Please run::
345343

346344
$ make format
347345

348-
so as to beautify your code otherwise travis-ci may fail your unit test.
346+
so as to beautify your code otherwise your build may fail your unit test.
349347

350348

351349

changelog.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: pyexcel-xlsxr
22
organisation: pyexcel
33
releases:
4+
- changes:
5+
- action: Updated
6+
details:
7+
- '#9: Potential fix for incorrect reading of data with empty cells when used with pyexcel '
8+
date: 11.11.2024
9+
version: 0.6.1
410
- changes:
511
- action: Updated
612
details:

lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pip install flake8
2-
flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long . && python setup.py checkdocs
2+
flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long . && python setup.py checkdocs

pyexcel-xlsxr.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
overrides: "pyexcel.yaml"
22
name: "pyexcel-xlsxr"
33
nick_name: "xlsxr"
4-
version: "0.6.0"
5-
current_version: "0.6.0"
6-
release: "0.6.0"
4+
version: "0.6.1"
5+
current_version: "0.6.1"
6+
release: "0.6.1"
7+
copyright_year: 2015-2024
78
file_type: xlsx
89
nodocs: true
910
dependencies:

pyexcel_xlsxr/_version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = '0.6.0'
2-
__author__ = 'chfw'
1+
__version__ = '0.6.1'
2+
__author__ = 'C.W.'

pyexcel_xlsxr/messy_xlsx.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ def __repr__(self):
182182
return str(self.value)
183183

184184

185+
def column_to_number(column):
186+
column = re.sub("[^A-Z]", "", column)
187+
cl = len(column) - 1
188+
return sum(
189+
[(ord(c.upper()) - 64) + (26 * (cl - i)) for i, c in enumerate(column)]
190+
)
191+
192+
185193
def parse_row(row_xml_string, book):
186194
if b"x14ac" in row_xml_string:
187195
row_xml_string = row_xml_string.replace(
@@ -191,11 +199,20 @@ def parse_row(row_xml_string, book):
191199
cells = []
192200
cell = Cell()
193201

202+
last_column_number = None
194203
for action, element in etree.iterparse(partial):
195-
196204
if element.tag in ["v", "t"]:
197205
cell.value = element.text
198206
elif element.tag in ["c"]:
207+
ref = element.attrib.get("r")
208+
if ref:
209+
column_number = column_to_number(ref)
210+
if last_column_number is not None:
211+
padding = column_number - last_column_number - 1
212+
if padding > 0:
213+
cells += [Cell() for _ in range(padding)]
214+
last_column_number = column_number
215+
199216
local_type = element.attrib.get("t")
200217
cell.column_type = local_type
201218
style_int = element.attrib.get("s")

setup.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
3232

3333
NAME = "pyexcel-xlsxr"
34-
AUTHOR = "chfw"
35-
VERSION = "0.6.0"
34+
AUTHOR = "C.W."
35+
VERSION = "0.6.1"
3636
3737
LICENSE = "New BSD"
3838
DESCRIPTION = (
3939
"Read xlsx file using partial xml"
4040
)
4141
URL = "https://github.com/pyexcel/pyexcel-xlsxr"
42-
DOWNLOAD_URL = "%s/archive/0.6.0.tar.gz" % URL
42+
DOWNLOAD_URL = "%s/archive/0.6.1.tar.gz" % URL
4343
FILES = ["README.rst", "CHANGELOG.rst"]
4444
KEYWORDS = [
4545
"python",
@@ -73,13 +73,14 @@
7373
}
7474
# You do not need to read beyond this line
7575
PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)
76-
GS_COMMAND = ("gs pyexcel-xlsxr v0.6.0 " +
77-
"Find 0.6.0 in changelog for more details")
76+
HERE = os.path.abspath(os.path.dirname(__file__))
77+
78+
GS_COMMAND = ("gease pyexcel-xlsxr v0.6.1 " +
79+
"Find 0.6.1 in changelog for more details")
7880
NO_GS_MESSAGE = ("Automatic github release is disabled. " +
7981
"Please install gease to enable it.")
8082
UPLOAD_FAILED_MSG = (
8183
'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND)
82-
HERE = os.path.abspath(os.path.dirname(__file__))
8384

8485

8586
class PublishCommand(Command):
@@ -125,7 +126,6 @@ def run(self):
125126
"publish": PublishCommand
126127
})
127128

128-
129129
def has_gease():
130130
"""
131131
test if github release command is installed

0 commit comments

Comments
 (0)