Skip to content

Release 0.6.4 #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.4 - 31.10.2020
--------------------------------------------------------------------------------

**updated**

#. `#102 <https://github.com/pyexcel/pyexcel-io/issues/102>`_: skip columns from
imported excel sheet.

0.6.3 - 12.10.2020
--------------------------------------------------------------------------------

Expand Down
65 changes: 36 additions & 29 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pyexcel-io - Let you focus on data, instead of file formats
.. 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-io.svg?branch=master
Expand All @@ -21,7 +21,7 @@ pyexcel-io - Let you focus on data, instead of file formats
:target: https://anaconda.org/conda-forge/pyexcel-io

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

.. image:: https://anaconda.org/conda-forge/pyexcel-io/badges/downloads.svg
:target: https://anaconda.org/conda-forge/pyexcel-io
Expand Down Expand Up @@ -60,6 +60,8 @@ Known constraints

Fonts, colors and charts are not supported.

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

Introduction
================================================================================

Expand All @@ -74,44 +76,47 @@ sqlalchemy supported databases. Its supported file formats are extended to cover

.. table:: A list of file formats supported by external plugins

======================== ======================= ================= ==================
Package name Supported file formats Dependencies Python versions
======================== ======================= ================= ==================
`pyexcel-io`_ >=v0.6.0 csv, csvz [#f1]_, tsv, 3.6+
tsvz [#f2]_
`pyexcel-io`_ <=0.5.20 same as above 2.6, 2.7, 3.3,
3.4, 3.5, 3.6
pypy
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_, same as above
======================== ======================= =================
Package name Supported file formats Dependencies
======================== ======================= =================
`pyexcel-io`_ csv, csvz [#f1]_, tsv,
tsvz [#f2]_
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_,
xlsm(read only) `xlwt`_
`pyexcel-xlsx`_ xlsx `openpyxl`_ same as above
`pyexcel-ods3`_ ods `pyexcel-ezodf`_, 2.6, 2.7, 3.3, 3.4
lxml 3.5, 3.6
`pyexcel-ods`_ ods `odfpy`_ same as above
======================== ======================= ================= ==================
`pyexcel-xlsx`_ xlsx `openpyxl`_
`pyexcel-ods3`_ ods `pyexcel-ezodf`_,
lxml
`pyexcel-ods`_ ods `odfpy`_
======================== ======================= =================

.. table:: Dedicated file reader and writers

======================== ======================= ================= ==================
Package name Supported file formats Dependencies Python versions
======================== ======================= ================= ==================
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ Python 2 and 3
`pyexcel-xlsxr`_ xlsx(read only) lxml same as above
`pyexcel-xlsbr`_ xlsx(read only) pyxlsb same as above
`pyexcel-odsr`_ read only for ods, fods lxml same as above
`pyexcel-odsw`_ write only for ods loxun same as above
`pyexcel-htmlr`_ html(read only) lxml,html5lib same as above
`pyexcel-pdfr`_ pdf(read only) pdftables Python 2 only.
======================== ======================= ================= ==================
======================== ======================= =================
Package name Supported file formats Dependencies
======================== ======================= =================
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_
`pyexcel-libxlsxw`_ xlsx(write only) `libxlsxwriter`_
`pyexcel-xlsxr`_ xlsx(read only) lxml
`pyexcel-xlsbr`_ xlsb(read only) pyxlsb
`pyexcel-odsr`_ read only for ods, fods lxml
`pyexcel-odsw`_ write only for ods loxun
`pyexcel-htmlr`_ html(read only) lxml,html5lib
`pyexcel-pdfr`_ pdf(read only) camelot
======================== ======================= =================


Plugin shopping guide
------------------------

Since 2020, all pyexcel-io plugins have dropped the support for python version
lower than 3.6. If you want to use any python verions, please use pyexcel-io
and its plugins version lower than 0.6.0.


Except csv files, xls, xlsx and ods files are a zip of a folder containing a lot of
xml files
xml files

The dedicated readers for excel files can stream read
The dedicated readers for excel files can stream read


In order to manage the list of plugins installed, you need to use pip to add or remove
Expand All @@ -133,6 +138,7 @@ You need to append get_array(..., library='pyexcel-odsr').
.. _pyexcel-pdfr: https://github.com/pyexcel/pyexcel-pdfr

.. _pyexcel-xlsxw: https://github.com/pyexcel/pyexcel-xlsxw
.. _pyexcel-libxlsxw: https://github.com/pyexcel/pyexcel-libxlsxw
.. _pyexcel-xlsxr: https://github.com/pyexcel/pyexcel-xlsxr
.. _pyexcel-xlsbr: https://github.com/pyexcel/pyexcel-xlsbr
.. _pyexcel-htmlr: https://github.com/pyexcel/pyexcel-htmlr
Expand All @@ -143,6 +149,7 @@ You need to append get_array(..., library='pyexcel-odsr').
.. _XlsxWriter: https://github.com/jmcnamara/XlsxWriter
.. _pyexcel-ezodf: https://github.com/pyexcel/pyexcel-ezodf
.. _odfpy: https://github.com/eea/odfpy
.. _libxlsxwriter: http://libxlsxwriter.github.io/getting_started.html


.. rubric:: Footnotes
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-io
organisation: pyexcel
releases:
- changes:
- action: updated
details:
- "`#102`: skip columns from imported excel sheet."
version: 0.6.4
date: 31.10.2020
- changes:
- action: fixed
details:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

project = 'pyexcel-io'
copyright = '2015-2020 Onni Software Ltd.'
author = 'chfw'
author = 'C.W.'
# The short X.Y version
version = '0.6.3'
version = '0.6.4'
# The full version, including alpha/beta/rc tags
release = '0.6.3'
release = '0.6.4'

# -- General configuration ---------------------------------------------------

Expand Down
61 changes: 33 additions & 28 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
`pyexcel-io` - Let you focus on data, instead of file formats
================================================================================

:Author: chfw
:Author: C.W.
:Source code: http://github.com/pyexcel/pyexcel-io.git
:Issues: http://github.com/pyexcel/pyexcel-io/issues
:License: New BSD License
Expand Down Expand Up @@ -64,44 +64,47 @@ For individual excel file formats, please install them as you wish:

.. table:: A list of file formats supported by external plugins

======================== ======================= ================= ==================
Package name Supported file formats Dependencies Python versions
======================== ======================= ================= ==================
`pyexcel-io`_ >=v0.6.0 csv, csvz [#f1]_, tsv, 3.6+
tsvz [#f2]_
`pyexcel-io`_ <=0.5.20 same as above 2.6, 2.7, 3.3,
3.4, 3.5, 3.6
pypy
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_, same as above
======================== ======================= =================
Package name Supported file formats Dependencies
======================== ======================= =================
`pyexcel-io`_ csv, csvz [#f1]_, tsv,
tsvz [#f2]_
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_,
xlsm(read only) `xlwt`_
`pyexcel-xlsx`_ xlsx `openpyxl`_ same as above
`pyexcel-ods3`_ ods `pyexcel-ezodf`_, 2.6, 2.7, 3.3, 3.4
lxml 3.5, 3.6
`pyexcel-ods`_ ods `odfpy`_ same as above
======================== ======================= ================= ==================
`pyexcel-xlsx`_ xlsx `openpyxl`_
`pyexcel-ods3`_ ods `pyexcel-ezodf`_,
lxml
`pyexcel-ods`_ ods `odfpy`_
======================== ======================= =================

.. table:: Dedicated file reader and writers

======================== ======================= ================= ==================
Package name Supported file formats Dependencies Python versions
======================== ======================= ================= ==================
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ Python 2 and 3
`pyexcel-xlsxr`_ xlsx(read only) lxml same as above
`pyexcel-xlsbr`_ xlsx(read only) pyxlsb same as above
`pyexcel-odsr`_ read only for ods, fods lxml same as above
`pyexcel-odsw`_ write only for ods loxun same as above
`pyexcel-htmlr`_ html(read only) lxml,html5lib same as above
`pyexcel-pdfr`_ pdf(read only) pdftables Python 2 only.
======================== ======================= ================= ==================
======================== ======================= =================
Package name Supported file formats Dependencies
======================== ======================= =================
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_
`pyexcel-libxlsxw`_ xlsx(write only) `libxlsxwriter`_
`pyexcel-xlsxr`_ xlsx(read only) lxml
`pyexcel-xlsbr`_ xlsb(read only) pyxlsb
`pyexcel-odsr`_ read only for ods, fods lxml
`pyexcel-odsw`_ write only for ods loxun
`pyexcel-htmlr`_ html(read only) lxml,html5lib
`pyexcel-pdfr`_ pdf(read only) camelot
======================== ======================= =================


Plugin shopping guide
------------------------

Since 2020, all pyexcel-io plugins have dropped the support for python version
lower than 3.6. If you want to use any python verions, please use pyexcel-io
and its plugins version lower than 0.6.0.


Except csv files, xls, xlsx and ods files are a zip of a folder containing a lot of
xml files
xml files

The dedicated readers for excel files can stream read
The dedicated readers for excel files can stream read


In order to manage the list of plugins installed, you need to use pip to add or remove
Expand All @@ -123,6 +126,7 @@ You need to append get_array(..., library='pyexcel-odsr').
.. _pyexcel-pdfr: https://github.com/pyexcel/pyexcel-pdfr

.. _pyexcel-xlsxw: https://github.com/pyexcel/pyexcel-xlsxw
.. _pyexcel-libxlsxw: https://github.com/pyexcel/pyexcel-libxlsxw
.. _pyexcel-xlsxr: https://github.com/pyexcel/pyexcel-xlsxr
.. _pyexcel-xlsbr: https://github.com/pyexcel/pyexcel-xlsbr
.. _pyexcel-htmlr: https://github.com/pyexcel/pyexcel-htmlr
Expand All @@ -133,6 +137,7 @@ You need to append get_array(..., library='pyexcel-odsr').
.. _XlsxWriter: https://github.com/jmcnamara/XlsxWriter
.. _pyexcel-ezodf: https://github.com/pyexcel/pyexcel-ezodf
.. _odfpy: https://github.com/eea/odfpy
.. _libxlsxwriter: http://libxlsxwriter.github.io/getting_started.html


.. rubric:: Footnotes
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
6 changes: 3 additions & 3 deletions pyexcel-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ overrides: "pyexcel.yaml"
project: "pyexcel-io"
name: pyexcel-io
nick_name: io
version: 0.6.3
current_version: 0.6.3
release: 0.6.3
version: 0.6.4
current_version: 0.6.4
release: 0.6.4
copyright_year: 2015-2020
moban_command: false
is_on_conda: true
Expand Down
59 changes: 32 additions & 27 deletions pyexcel_io/database/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,61 +38,66 @@ def __init__(self):

def __init__(self, model):
DjangoModelExportAdapter.__init__(self, model)
self.__column_names = self.InOutParameter()
self.__column_name_mapping_dict = self.InOutParameter()
self.__row_initializer = self.InOutParameter()
self._column_names = self.InOutParameter()
self._column_name_mapping_dict = self.InOutParameter()
self._row_initializer = self.InOutParameter()
self._process_parameters()

@property
def row_initializer(self):
""" contructor for a database table entry """
return self.__row_initializer.output
return self._row_initializer.output

@property
def column_names(self):
""" the desginated database column names """
return self.__column_names.output
return self._column_names.output

@property
def column_name_mapping_dict(self):
""" if not the same, a mapping dictionary is looked up"""
return self.__column_name_mapping_dict.output
return self._column_name_mapping_dict.output

@row_initializer.setter
def row_initializer(self, a_function):
""" set the contructor """
self.__row_initializer.input = a_function
self._row_initializer.input = a_function
self._process_parameters()

@column_names.setter
def column_names(self, column_names):
""" set the column names """
self.__column_names.input = column_names
self._column_names.input = column_names
self._process_parameters()

@column_name_mapping_dict.setter
def column_name_mapping_dict(self, mapping_dict):
""" set the mapping dict """
self.__column_name_mapping_dict.input = mapping_dict
self._column_name_mapping_dict.input = mapping_dict
self._process_parameters()

def _process_parameters(self):
if self.__row_initializer.input is None:
self.__row_initializer.output = None
if self._row_initializer.input is None:
self._row_initializer.output = None
else:
self.__row_initializer.output = self.__row_initializer.input
if isinstance(self.__column_name_mapping_dict.input, list):
self.__column_names.output = self.__column_name_mapping_dict.input
self.__column_name_mapping_dict.output = None
elif isinstance(self.__column_name_mapping_dict.input, dict):
if self.__column_names.input:
self.__column_names.output = [
self.__column_name_mapping_dict.input[name]
for name in self.__column_names.input
]
self.__column_name_mapping_dict.output = None
if self.__column_names.output is None:
self.__column_names.output = self.__column_names.input
self._row_initializer.output = self._row_initializer.input
if isinstance(self._column_name_mapping_dict.input, list):
self._column_names.output = self._column_name_mapping_dict.input
self._column_name_mapping_dict.output = None
elif isinstance(self._column_name_mapping_dict.input, dict):

if self._column_names.input:
self._column_names.output = []
indices = []
for index, name in enumerate(self._column_names.input):
if name in self._column_name_mapping_dict.input:
self._column_names.output.append(
self._column_name_mapping_dict.input[name]
)
indices.append(index)
self._column_name_mapping_dict.output = indices
if self._column_names.output is None:
self._column_names.output = self._column_names.input


class DjangoModelExporter(object):
Expand All @@ -110,15 +115,15 @@ class DjangoModelImporter(object):
""" public interface for django model import """

def __init__(self):
self.__adapters = {}
self._adapters = {}

def append(self, import_adapter):
""" store model parameter for more than one model """
self.__adapters[import_adapter.get_name()] = import_adapter
self._adapters[import_adapter.get_name()] = import_adapter

def get(self, name):
""" get a parameter out """
return self.__adapters.get(name, None)
return self._adapters.get(name, None)


class SQLTableExportAdapter(DjangoModelExportAdapter):
Expand Down
Loading