Skip to content

Commit

Permalink
Merge pull request #11 from pyexcel/dev
Browse files Browse the repository at this point in the history
maintenance fix
  • Loading branch information
chfw authored Nov 11, 2024
2 parents cd8c4e3 + be84a6a commit 03b87d5
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 60 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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 --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
8 changes: 4 additions & 4 deletions .github/workflows/moban-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 12 additions & 7 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
35 changes: 35 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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:
os: [Ubuntu]
python_version: ["3.9.16"]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
architecture: x64

- name: install
run: |
pip --use-deprecated=legacy-resolver install -r requirements.txt
pip --use-deprecated=legacy-resolver 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 }}
23 changes: 23 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
--------------------------------------------------------------------------------

Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/mtskelton>`_
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2020 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
Expand All @@ -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
Expand Down
16 changes: 7 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ 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://codecov.io/gh/pyexcel/pyexcel-xlsxr/branch/master/graph/badge.svg
:target: https://codecov.io/gh/pyexcel/pyexcel-xlsxr

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


.. image:: https://pepy.tech/badge/pyexcel-xlsxr/month
:target: https://pepy.tech/project/pyexcel-xlsxr/month



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

Fonts, colors and charts are not supported.

Nor to read password protected xls, xlsx and ods files.

Installation
================================================================================

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

Expand All @@ -333,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

Expand All @@ -345,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.



Expand Down
6 changes: 6 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions pyexcel-xlsxr.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
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"
copyright_year: 2015-2024
file_type: xlsx
nodocs: true
dependencies:
Expand Down
4 changes: 2 additions & 2 deletions pyexcel_xlsxr/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.6.0'
__author__ = 'chfw'
__version__ = '0.6.1'
__author__ = 'C.W.'
19 changes: 18 additions & 1 deletion pyexcel_xlsxr/messy_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")

NAME = "pyexcel-xlsxr"
AUTHOR = "chfw"
VERSION = "0.6.0"
AUTHOR = "C.W."
VERSION = "0.6.1"
EMAIL = "[email protected]"
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",
Expand Down Expand Up @@ -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 " +
"Find 0.6.0 in changelog for more details")
HERE = os.path.abspath(os.path.dirname(__file__))

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 = (
'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND)
HERE = os.path.abspath(os.path.dirname(__file__))


class PublishCommand(Command):
Expand Down Expand Up @@ -125,7 +126,6 @@ def run(self):
"publish": PublishCommand
})


def has_gease():
"""
test if github release command is installed
Expand Down

0 comments on commit 03b87d5

Please sign in to comment.