Skip to content

Commit 4889372

Browse files
authored
Merge pull request #50 from pyexcel/dev
release 0.7.0
2 parents 698a55d + 242dbd7 commit 4889372

18 files changed

+129
-43
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
python-version: 3.8
1515
- name: lint
1616
run: |
17-
pip install flake8
18-
pip install -r tests/requirements.txt
17+
pip --use-deprecated=legacy-resolver install flake8
18+
pip --use-deprecated=legacy-resolver install -r tests/requirements.txt
1919
flake8 --exclude=.moban.d,docs,setup.py --builtins=unicode,xrange,long .
2020
python setup.py checkdocs

.github/workflows/moban-update.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ jobs:
2121
git diff --exit-code
2222
- name: Auto-commit
2323
if: failure()
24-
uses: docker://cdssnc/auto-commit-github-action
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
uses: stefanzweifel/git-auto-commit-action@v4
2725
with:
28-
args: >-
26+
commit_message: >-
2927
This is an auto-commit, updating project meta data,
3028
such as changelog.rst, contributors.rst

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
matrix:
1010
python-version: [3.6, 3.7, 3.8, 3.9]
1111
os: [macOs-latest, ubuntu-latest, windows-latest]
12+
exclude:
13+
- os: macos-latest
14+
python-version: 3.6
1215

1316
runs-on: ${{ matrix.os }}
1417
name: run tests
@@ -20,8 +23,8 @@ jobs:
2023
python-version: ${{ matrix.python-version }}
2124
- name: install
2225
run: |
23-
pip install -r requirements.txt
24-
pip install -r tests/requirements.txt
26+
pip --use-deprecated=legacy-resolver install -r requirements.txt
27+
pip --use-deprecated=legacy-resolver install -r tests/requirements.txt
2528
- name: test
2629
run: |
2730
pip freeze

.moban.d/custom_README.rst.jj2

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,33 @@
88
write data in {{file_type}} format and it can read xlsx and xlsm fromat.
99
You are likely to use it with `pyexcel <https://github.com/pyexcel/pyexcel>`_.
1010

11-
New flag: `detect_merged_cells` allows you to spread the same value among
11+
Oct 2021 - Update:
12+
===================
13+
14+
1. v0.6.3 removed the pin on xlrd < 2. If you have xlrd >= 2, this
15+
library will NOT read 'xlsx' format and you need to install pyexcel-xlsx. Othwise,
16+
this library can use xlrd < 2 to read xlsx format for you. So 'xlsx' support
17+
in this library will vary depending on the installed version of xlrd.
18+
19+
2. v0.6.3 can write datetime.timedelta. but when the value is read out,
20+
you will get datetime.datetime. so you as the developer decides what to do with it.
21+
22+
Past news
23+
===========
24+
25+
`detect_merged_cells` allows you to spread the same value among
1226
all merged cells. But be aware that this may slow down its reading
1327
performance.
1428

15-
New flag: `skip_hidden_row_and_column` allows you to skip hidden rows
29+
`skip_hidden_row_and_column` allows you to skip hidden rows
1630
and columns and is defaulted to **True**. It may slow down its reading
1731
performance. And it is only valid for 'xls' files. For 'xlsx' files,
1832
please use pyexcel-xlsx.
1933

2034
Warning
2135
================================================================================
2236

23-
xls file cannot contain more than 65,000 rows. You are risking the reputation
37+
**xls file cannot contain more than 65,000 rows**. You are risking the reputation
2438
of yourself/your company/
2539
`your country <https://www.bbc.co.uk/news/technology-54423988>`_ if you keep
2640
using xls and are not aware of its row limit.

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Change log
22
================================================================================
33

4+
0.7.0 - 07.10.2021
5+
--------------------------------------------------------------------------------
6+
7+
**Removed**
8+
9+
#. `#46 <https://github.com/pyexcel/pyexcel-xls/issues/46>`_: remove the hard
10+
pin on xlrd version < 2.0
11+
12+
**Added**
13+
14+
#. `#47 <https://github.com/pyexcel/pyexcel-xls/issues/47>`_: limit support to
15+
persist datetime.timedelta. see more details in doc
16+
417
0.6.2 - 12.12.2020
518
--------------------------------------------------------------------------------
619

CONTRIBUTORS.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11

22

3-
2 contributors
3+
3 contributors
44
================================================================================
55

66
In alphabetical order:
77

88
* `John Vandenberg <https://github.com/jayvdb>`_
99
* `Peter Carnesciali <https://github.com/pcarn>`_
10+
* `vinraspa <https://github.com/vinraspa>`_

LICENSE

Lines changed: 1 addition & 1 deletion
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-2021 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

README.rst

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,33 @@ pyexcel-xls - Let you focus on data, instead of xls format
3939
write data in xls format and it can read xlsx and xlsm fromat.
4040
You are likely to use it with `pyexcel <https://github.com/pyexcel/pyexcel>`_.
4141

42-
New flag: `detect_merged_cells` allows you to spread the same value among
42+
Oct 2021 - Update:
43+
===================
44+
45+
1. v0.6.3 removed the pin on xlrd < 2. If you have xlrd >= 2, this
46+
library will NOT read 'xlsx' format and you need to install pyexcel-xlsx. Othwise,
47+
this library can use xlrd < 2 to read xlsx format for you. So 'xlsx' support
48+
in this library will vary depending on the installed version of xlrd.
49+
50+
2. v0.6.3 can write datetime.timedelta. but when the value is read out,
51+
you will get datetime.datetime. so you as the developer decides what to do with it.
52+
53+
Past news
54+
===========
55+
56+
`detect_merged_cells` allows you to spread the same value among
4357
all merged cells. But be aware that this may slow down its reading
4458
performance.
4559

46-
New flag: `skip_hidden_row_and_column` allows you to skip hidden rows
60+
`skip_hidden_row_and_column` allows you to skip hidden rows
4761
and columns and is defaulted to **True**. It may slow down its reading
4862
performance. And it is only valid for 'xls' files. For 'xlsx' files,
4963
please use pyexcel-xlsx.
5064

5165
Warning
5266
================================================================================
5367

54-
xls file cannot contain more than 65,000 rows. You are risking the reputation
68+
**xls file cannot contain more than 65,000 rows**. You are risking the reputation
5569
of yourself/your company/
5670
`your country <https://www.bbc.co.uk/news/technology-54423988>`_ if you keep
5771
using xls and are not aware of its row limit.
@@ -353,7 +367,7 @@ Then install relevant development requirements:
353367
#. pip install -r tests/requirements.txt
354368

355369
Once you have finished your changes, please provide test case(s), relevant documentation
356-
and update CHANGELOG.rst.
370+
and update changelog.yml
357371

358372
.. note::
359373

@@ -372,7 +386,7 @@ On Linux/Unix systems, please launch your tests like this::
372386

373387
$ make
374388

375-
On Windows systems, please issue this command::
389+
On Windows, please issue this command::
376390

377391
> test.bat
378392

@@ -384,7 +398,7 @@ Please run::
384398

385399
$ make format
386400

387-
so as to beautify your code otherwise travis-ci may fail your unit test.
401+
so as to beautify your code otherwise your build may fail your unit test.
388402

389403

390404
Known Issues

changelog.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
name: pyexcel-xls
22
organisation: pyexcel
33
releases:
4+
- changes:
5+
- action: Removed
6+
details:
7+
- "`#46`: remove the hard pin on xlrd version < 2.0"
8+
- action: Added
9+
details:
10+
- "`#47`: limit support to persist datetime.timedelta. see more details in doc"
11+
date: 07.10.2021
12+
version: 0.7.0
413
- changes:
514
- action: Updated
615
details:

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
# -- Project information -----------------------------------------------------
2424

2525
project = 'pyexcel-xls'
26-
copyright = '2015-2020 Onni Software Ltd.'
26+
copyright = '2015-2021 Onni Software Ltd.'
2727
author = 'C.W.'
2828
# The short X.Y version
29-
version = '0.6.2'
29+
version = '0.7.0'
3030
# The full version, including alpha/beta/rc tags
31-
release = '0.6.2'
31+
release = '0.7.0'
3232

3333
# -- General configuration ---------------------------------------------------
3434

pyexcel-xls.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
overrides: "pyexcel.yaml"
22
name: "pyexcel-xls"
33
nick_name: xls
4-
version: 0.6.2
5-
current_version: 0.6.2
6-
release: 0.6.2
4+
version: 0.7.0
5+
current_version: 0.7.0
6+
release: 0.7.0
77
file_type: xls
88
is_on_conda: true
99
dependencies:
1010
- pyexcel-io>=0.6.2
11-
- xlrd<2
11+
- xlrd
1212
- xlwt
1313
test_dependencies:
1414
- pyexcel

pyexcel_xls/__init__.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
55
The lower level xls/xlsx/xlsm file format handler using xlrd/xlwt
66
7-
:copyright: (c) 2016-2020 by Onni Software Ltd
7+
:copyright: (c) 2016-2021 by Onni Software Ltd
88
:license: New BSD License
99
"""
10+
import xlrd
1011

1112
# flake8: noqa
1213
from pyexcel_io.io import get_data as read_data
@@ -19,20 +20,37 @@
1920

2021
__FILE_TYPE__ = "xls"
2122

23+
24+
def xlrd_version_2_or_greater():
25+
xlrd_version = getattr(xlrd, "__version__")
26+
27+
if xlrd_version:
28+
major = int(xlrd_version.split(".")[0])
29+
if major >= 2:
30+
return True
31+
return False
32+
33+
34+
XLRD_VERSION_2_OR_ABOVE = xlrd_version_2_or_greater()
35+
supported_file_formats = [__FILE_TYPE__, "xlsx", "xlsm"]
36+
if XLRD_VERSION_2_OR_ABOVE:
37+
supported_file_formats.remove("xlsx")
38+
39+
2240
IOPluginInfoChainV2(__name__).add_a_reader(
2341
relative_plugin_class_path="xlsr.XLSInFile",
2442
locations=["file"],
25-
file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
43+
file_types=supported_file_formats,
2644
stream_type="binary",
2745
).add_a_reader(
2846
relative_plugin_class_path="xlsr.XLSInMemory",
2947
locations=["memory"],
30-
file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
48+
file_types=supported_file_formats,
3149
stream_type="binary",
3250
).add_a_reader(
3351
relative_plugin_class_path="xlsr.XLSInContent",
3452
locations=["content"],
35-
file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
53+
file_types=supported_file_formats,
3654
stream_type="binary",
3755
).add_a_writer(
3856
relative_plugin_class_path="xlsw.XLSWriter",

pyexcel_xls/xlsr.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The lower level xls/xlsm file format handler using xlrd
66
7-
:copyright: (c) 2016-2020 by Onni Software Ltd
7+
:copyright: (c) 2016-2021 by Onni Software Ltd
88
:license: New BSD License
99
"""
1010
import datetime
@@ -152,9 +152,7 @@ def __init__(self, file_type, **keywords):
152152
def read_sheet(self, index):
153153
native_sheet = self.content_array[index]
154154
sheet = XLSheet(
155-
native_sheet,
156-
date_mode=self.xls_book.datemode,
157-
**self._keywords
155+
native_sheet, date_mode=self.xls_book.datemode, **self._keywords
158156
)
159157
return sheet
160158

pyexcel_xls/xlsw.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The lower level xls file format handler using xlwt
66
7-
:copyright: (c) 2016-2020 by Onni Software Ltd
7+
:copyright: (c) 2016-2021 by Onni Software Ltd
88
:license: New BSD License
99
"""
1010
import datetime
@@ -16,6 +16,7 @@
1616

1717
DEFAULT_DATE_FORMAT = "DD/MM/YY"
1818
DEFAULT_TIME_FORMAT = "HH:MM:SS"
19+
DEFAULT_LONGTIME_FORMAT = "[HH]:MM:SS"
1920
DEFAULT_DATETIME_FORMAT = "%s %s" % (DEFAULT_DATE_FORMAT, DEFAULT_TIME_FORMAT)
2021
EMPTY_SHEET_NOT_ALLOWED = "xlwt does not support a book without any sheets"
2122

@@ -52,6 +53,10 @@ def write_row(self, array):
5253
value = xlrd.xldate.xldate_from_datetime_tuple(tmp_array, 0)
5354
style = XFStyle()
5455
style.num_format_str = DEFAULT_DATETIME_FORMAT
56+
elif isinstance(value, datetime.timedelta):
57+
value = value.days + value.seconds / 86_400
58+
style = XFStyle()
59+
style.num_format_str = DEFAULT_LONGTIME_FORMAT
5560
elif isinstance(value, datetime.date):
5661
tmp_array = [value.year, value.month, value.day]
5762
value = xlrd.xldate.xldate_from_date_tuple(tmp_array, 0)
@@ -83,7 +88,7 @@ def __init__(
8388
_, # file_type not used
8489
encoding="ascii",
8590
style_compression=2,
86-
**keywords
91+
**keywords,
8792
):
8893
self.file_alike_object = file_alike_object
8994
self.work_book = Workbook(

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pyexcel-io>=0.6.2
2-
xlrd<2
2+
xlrd
33
xlwt

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232

3333
NAME = "pyexcel-xls"
3434
AUTHOR = "C.W."
35-
VERSION = "0.6.2"
35+
VERSION = "0.7.0"
3636
3737
LICENSE = "New BSD"
3838
DESCRIPTION = (
3939
"A wrapper library to read, manipulate and write data in xls format. It" +
4040
"reads xlsx and xlsm format"
4141
)
4242
URL = "https://github.com/pyexcel/pyexcel-xls"
43-
DOWNLOAD_URL = "%s/archive/0.6.2.tar.gz" % URL
43+
DOWNLOAD_URL = "%s/archive/0.7.0.tar.gz" % URL
4444
FILES = ["README.rst","CONTRIBUTORS.rst", "CHANGELOG.rst"]
4545
KEYWORDS = [
4646
"python",
@@ -69,7 +69,7 @@
6969

7070
INSTALL_REQUIRES = [
7171
"pyexcel-io>=0.6.2",
72-
"xlrd<2",
72+
"xlrd",
7373
"xlwt",
7474
]
7575
SETUP_COMMANDS = {}
@@ -81,8 +81,8 @@
8181
PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)
8282
HERE = os.path.abspath(os.path.dirname(__file__))
8383

84-
GS_COMMAND = ("gease pyexcel-xls v0.6.2 " +
85-
"Find 0.6.2 in changelog for more details")
84+
GS_COMMAND = ("gease pyexcel-xls v0.7.0 " +
85+
"Find 0.7.0 in changelog for more details")
8686
NO_GS_MESSAGE = ("Automatic github release is disabled. " +
8787
"Please install gease to enable it.")
8888
UPLOAD_FAILED_MSG = (

0 commit comments

Comments
 (0)