🔥 remove the pinning on xlrd < 2. fix #46
This commit is contained in:
parent
78748634ee
commit
2f139848f8
|
@ -8,6 +8,16 @@
|
||||||
write data in {{file_type}} format and it can read xlsx and xlsm fromat.
|
write data in {{file_type}} format and it can read xlsx and xlsm fromat.
|
||||||
You are likely to use it with `pyexcel <https://github.com/pyexcel/pyexcel>`_.
|
You are likely to use it with `pyexcel <https://github.com/pyexcel/pyexcel>`_.
|
||||||
|
|
||||||
|
Update:
|
||||||
|
|
||||||
|
1. v0.6.3 removed the pin on xlrd < 2. If you have xlrd >= 2, this
|
||||||
|
library will NOT read 'xlsx' format and you need to install pyexcel-xlsx. Othwise,
|
||||||
|
this library can use xlrd < 2 to read xlsx format for you. So 'xlsx' support
|
||||||
|
in this library will vary depending on the installed version of xlrd.
|
||||||
|
|
||||||
|
2. 0.6.3 can write datetime.timedelta. but when the value is read out,
|
||||||
|
you will get datetime.datetime. so you as the developer decides what to do with it.
|
||||||
|
|
||||||
New flag: `detect_merged_cells` allows you to spread the same value among
|
New flag: `detect_merged_cells` allows you to spread the same value among
|
||||||
all merged cells. But be aware that this may slow down its reading
|
all merged cells. But be aware that this may slow down its reading
|
||||||
performance.
|
performance.
|
||||||
|
@ -20,7 +30,7 @@ please use pyexcel-xlsx.
|
||||||
Warning
|
Warning
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
xls file cannot contain more than 65,000 rows. You are risking the reputation
|
**xls file cannot contain more than 65,000 rows**. You are risking the reputation
|
||||||
of yourself/your company/
|
of yourself/your company/
|
||||||
`your country <https://www.bbc.co.uk/news/technology-54423988>`_ if you keep
|
`your country <https://www.bbc.co.uk/news/technology-54423988>`_ if you keep
|
||||||
using xls and are not aware of its row limit.
|
using xls and are not aware of its row limit.
|
||||||
|
|
|
@ -4,6 +4,7 @@ releases:
|
||||||
- changes:
|
- changes:
|
||||||
- action: Updated
|
- action: Updated
|
||||||
details:
|
details:
|
||||||
|
- "`#46`: remove the hard pin on xlrd version < 2.0"
|
||||||
- "`#47`: limit support to persist datetime.timedelta. see more details in doc"
|
- "`#47`: limit support to persist datetime.timedelta. see more details in doc"
|
||||||
date: tbd
|
date: tbd
|
||||||
version: 0.6.3
|
version: 0.6.3
|
||||||
|
|
|
@ -8,7 +8,7 @@ file_type: xls
|
||||||
is_on_conda: true
|
is_on_conda: true
|
||||||
dependencies:
|
dependencies:
|
||||||
- pyexcel-io>=0.6.2
|
- pyexcel-io>=0.6.2
|
||||||
- xlrd<2
|
- xlrd
|
||||||
- xlwt
|
- xlwt
|
||||||
test_dependencies:
|
test_dependencies:
|
||||||
- pyexcel
|
- pyexcel
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
|
|
||||||
The lower level xls/xlsx/xlsm file format handler using xlrd/xlwt
|
The lower level xls/xlsx/xlsm file format handler using xlrd/xlwt
|
||||||
|
|
||||||
:copyright: (c) 2016-2020 by Onni Software Ltd
|
:copyright: (c) 2016-2021 by Onni Software Ltd
|
||||||
:license: New BSD License
|
:license: New BSD License
|
||||||
"""
|
"""
|
||||||
|
import xlrd
|
||||||
|
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
from pyexcel_io.io import get_data as read_data
|
from pyexcel_io.io import get_data as read_data
|
||||||
|
@ -19,20 +20,37 @@ from pyexcel_io.plugins import IOPluginInfoChainV2
|
||||||
|
|
||||||
__FILE_TYPE__ = "xls"
|
__FILE_TYPE__ = "xls"
|
||||||
|
|
||||||
|
|
||||||
|
def xlrd_version_2_or_greater():
|
||||||
|
xlrd_version = getattr(xlrd, "__version__")
|
||||||
|
|
||||||
|
if xlrd_version:
|
||||||
|
major = int(xlrd_version.split(".")[0])
|
||||||
|
if major >= 2:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
XLRD_VERSION_2_OR_ABOVE = xlrd_version_2_or_greater()
|
||||||
|
supported_file_formats = [__FILE_TYPE__, "xlsx", "xlsm"]
|
||||||
|
if XLRD_VERSION_2_OR_ABOVE:
|
||||||
|
supported_file_formats.remove("xlsx")
|
||||||
|
|
||||||
|
|
||||||
IOPluginInfoChainV2(__name__).add_a_reader(
|
IOPluginInfoChainV2(__name__).add_a_reader(
|
||||||
relative_plugin_class_path="xlsr.XLSInFile",
|
relative_plugin_class_path="xlsr.XLSInFile",
|
||||||
locations=["file"],
|
locations=["file"],
|
||||||
file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
|
file_types=supported_file_formats,
|
||||||
stream_type="binary",
|
stream_type="binary",
|
||||||
).add_a_reader(
|
).add_a_reader(
|
||||||
relative_plugin_class_path="xlsr.XLSInMemory",
|
relative_plugin_class_path="xlsr.XLSInMemory",
|
||||||
locations=["memory"],
|
locations=["memory"],
|
||||||
file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
|
file_types=supported_file_formats,
|
||||||
stream_type="binary",
|
stream_type="binary",
|
||||||
).add_a_reader(
|
).add_a_reader(
|
||||||
relative_plugin_class_path="xlsr.XLSInContent",
|
relative_plugin_class_path="xlsr.XLSInContent",
|
||||||
locations=["content"],
|
locations=["content"],
|
||||||
file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
|
file_types=supported_file_formats,
|
||||||
stream_type="binary",
|
stream_type="binary",
|
||||||
).add_a_writer(
|
).add_a_writer(
|
||||||
relative_plugin_class_path="xlsw.XLSWriter",
|
relative_plugin_class_path="xlsw.XLSWriter",
|
||||||
|
|
|
@ -10,7 +10,7 @@ from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import pyexcel as pe
|
import pyexcel as pe
|
||||||
from _compact import OrderedDict
|
from _compact import OrderedDict
|
||||||
from pyexcel_xls import save_data
|
from pyexcel_xls import XLRD_VERSION_2_OR_ABOVE, save_data
|
||||||
from pyexcel_xls.xlsr import xldate_to_python_date
|
from pyexcel_xls.xlsr import xldate_to_python_date
|
||||||
from pyexcel_xls.xlsw import XLSWriter as Writer
|
from pyexcel_xls.xlsw import XLSWriter as Writer
|
||||||
|
|
||||||
|
@ -97,6 +97,8 @@ def test_issue_20():
|
||||||
|
|
||||||
|
|
||||||
def test_issue_151():
|
def test_issue_151():
|
||||||
|
if XLRD_VERSION_2_OR_ABOVE:
|
||||||
|
raise SkipTest()
|
||||||
s = pe.get_sheet(
|
s = pe.get_sheet(
|
||||||
file_name=get_fixture("pyexcel_issue_151.xlsx"),
|
file_name=get_fixture("pyexcel_issue_151.xlsx"),
|
||||||
skip_hidden_row_and_column=False,
|
skip_hidden_row_and_column=False,
|
||||||
|
|
Loading…
Reference in New Issue