Skip to content

Commit 1ffca2e

Browse files
committed
sync with pyexcel-commons
1 parent 3db7a72 commit 1ffca2e

File tree

4 files changed

+189
-63
lines changed

4 files changed

+189
-63
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ before_install:
4242
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
4343
mv min_requirements.txt requirements.txt ;
4444
fi
45-
- pip install --upgrade "setuptools" "pip==7.1"
45+
- pip install --upgrade setuptools "pip==7.1"
4646
- test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt
4747
- test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ;
4848
- pip install -r tests/requirements.txt

README.rst

Lines changed: 99 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ django-excel - Let you focus on data, instead of file formats
1111
.. image:: https://readthedocs.org/projects/django-excel/badge/?version=latest
1212
:target: http://django-excel.readthedocs.org/en/latest/
1313

14+
Known constraints
15+
==================
16+
17+
Fonts, colors and charts are not supported.
18+
1419
Here is a typical conversation between the developer and the user::
1520

1621
User: "I have uploaded an excel file"
@@ -35,7 +40,9 @@ difference among various excel formats: csv, xls, xlsx. Instead of training thos
3540
about file formats, this library helps web developers to handle most of the excel file
3641
formats by providing a common programming interface. To add a specific excel file format
3742
to you application, all you need is to install an extra pyexcel plugin. No code change
38-
to your application.
43+
to your application. Looking at the community, this library and its associated ones try
44+
to become a small and easy to install alternative to Pandas.
45+
3946

4047
The highlighted features are:
4148

@@ -47,25 +54,51 @@ The highlighted features are:
4754
the following plugins:
4855

4956
.. _file-format-list:
57+
.. _a-map-of-plugins-and-file-formats:
5058

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

53-
================ ========================================
54-
Plugins Supported file formats
55-
================ ========================================
56-
`pyexcel-xls`_ xls, xlsx(r), xlsm(r)
57-
`pyexcel-xlsx`_ xlsx
58-
`pyexcel-ods3`_ ods (python 2.6, 2.7, 3.3, 3.4)
59-
`pyexcel-ods`_ ods (python 2.6, 2.7)
60-
`pyexcel-text`_ (write only)json, rst, mediawiki, html
61-
latex, grid, pipe, orgtbl, plain simple
62-
================ ========================================
63-
61+
================= ======================= ============= ==================
62+
Package name Supported file formats Dependencies Python versions
63+
================= ======================= ============= ==================
64+
`pyexcel-io`_ csv, csvz [#f1]_, tsv, 2.6, 2.7, 3.3,
65+
tsvz [#f2]_ 3.4, 3.5,
66+
pypy, pypy3
67+
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_, same as above
68+
xlsm(read only) `xlwt`_
69+
`pyexcel-xlsx`_ xlsx `openpyxl`_ same as above
70+
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ same as above
71+
`pyexcel-ods3`_ ods `ezodf`_, 2.6, 2.7, 3.3, 3.4
72+
lxml 3.5
73+
`pyexcel-ods`_ ods `odfpy`_ same as above
74+
`pyexcel-text`_ (write only)json, rst, `tabulate`_ 2.6, 2.7, 3.3, 3.4
75+
mediawiki, html, 3.5, pypy, pypy3
76+
latex, grid, pipe,
77+
orgtbl, plain simple
78+
================= ======================= ============= ==================
79+
80+
.. _pyexcel-io: https://github.com/pyexcel/pyexcel-io
6481
.. _pyexcel-xls: https://github.com/pyexcel/pyexcel-xls
6582
.. _pyexcel-xlsx: https://github.com/pyexcel/pyexcel-xlsx
6683
.. _pyexcel-ods: https://github.com/pyexcel/pyexcel-ods
6784
.. _pyexcel-ods3: https://github.com/pyexcel/pyexcel-ods3
85+
.. _pyexcel-xlsxw: https://github.com/pyexcel/pyexcel-xlsxw
86+
87+
.. _xlrd: https://github.com/python-excel/xlrd
88+
.. _xlwt: https://github.com/python-excel/xlwt
89+
.. _openpyxl: https://bitbucket.org/openpyxl/openpyxl
90+
.. _XlsxWriter: https://github.com/jmcnamara/XlsxWriter
91+
.. _ezodf: https://github.com/T0ha/ezodf
92+
.. _odfpy: https://github.com/eea/odfpy
93+
6894
.. _pyexcel-text: https://github.com/pyexcel/pyexcel-text
95+
.. _tabulate: https://bitbucket.org/astanin/python-tabulate
96+
97+
.. rubric:: Footnotes
98+
99+
.. [#f1] zipped csv file
100+
.. [#f2] zipped tsv file
101+
69102
70103
This library makes information processing involving various excel files as easy as
71104
processing array, dictionary when processing file upload/download, data import into
@@ -77,10 +110,6 @@ and export from SQL databases, information analysis and persistence. It uses
77110
#. to provide the same interface for information persistence at server side: saving a uploaded excel file to and loading a saved excel file from file system.
78111

79112

80-
Known constraints
81-
==================
82-
83-
Fonts, colors and charts are not supported.
84113

85114
Tested Django Versions
86115
========================
@@ -103,13 +132,6 @@ Tested Django Versions
103132

104133
Installation
105134
================================================================================
106-
107-
Recently, pyexcel(0.2.2+) and its plugins(0.2.0+) started using newer version of setuptools. Please upgrade your setup tools before install latest pyexcel components:
108-
109-
.. code-block:: bash
110-
111-
$ pip install --upgrade setuptools
112-
113135
You can install it via pip:
114136

115137
.. code-block:: bash
@@ -169,6 +191,60 @@ Here is the example viewing function codes:
169191
sheet = excel.pe.Sheet([[1, 2],[3, 4]])
170192
return excel.make_response(sheet, "csv")
171193
194+
Development guide
195+
================================================================================
196+
197+
Development steps for code changes
198+
199+
#. git clone https://github.com/pyexcel/django-excel.git
200+
#. cd django-excel
201+
202+
Upgrade your setup tools and pip. They are needed for development and testing only:
203+
204+
#. pip install --upgrade setuptools "pip==7.1"
205+
206+
Then install relevant development requirements:
207+
208+
#. pip install -r rnd_requirements.txt # if such a file exists
209+
#. pip install -r requirements.txt
210+
#. pip install -r tests/requirements.txt
211+
212+
213+
In order to update test environment, and documentation, additional setps are
214+
required:
215+
216+
#. pip install moban
217+
#. git clone https://github.com/pyexcel/pyexcel-commons.git
218+
#. make your changes in `.moban.d` directory, then issue command `moban`
219+
220+
What is rnd_requirements.txt
221+
-------------------------------
222+
223+
Usually, it is created when a dependent library is not released. Once the dependecy is installed(will be released), the future version of the dependency in the requirements.txt will be valid.
224+
225+
What is pyexcel-commons
226+
---------------------------------
227+
228+
Many information that are shared across pyexcel projects, such as: this developer guide, license info, etc. are stored in `pyexcel-commons` project.
229+
230+
What is .moban.d
231+
---------------------------------
232+
233+
`.moban.d` stores the specific meta data for the library.
234+
235+
How to test your contribution
236+
------------------------------
237+
238+
Although `nose` and `doctest` are both used in code testing, it is adviable that unit tests are put in tests. `doctest` is incorporated only to make sure the code examples in documentation remain valid across different development releases.
239+
240+
On Linux/Unix systems, please launch your tests like this::
241+
242+
$ make test
243+
244+
On Windows systems, please issue this command::
245+
246+
> test.bat
247+
172248
License
173249
================================================================================
174250

doc/source/index.rst

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to django-excel's documentation!
6+
`django-excel` - Let you focus on data, instead of file formats
77
================================================================================
88

99
:Author: C.W.
10+
:Source code: http://github.com/pyexcel/django-excel.git
1011
:Issues: http://github.com/pyexcel/django-excel/issues
1112
:License: New BSD License
1213
:Development: |release|
@@ -37,7 +38,9 @@ difference among various excel formats: csv, xls, xlsx. Instead of training thos
3738
about file formats, this library helps web developers to handle most of the excel file
3839
formats by providing a common programming interface. To add a specific excel file format
3940
to you application, all you need is to install an extra pyexcel plugin. No code change
40-
to your application.
41+
to your application. Looking at the community, this library and its associated ones try
42+
to become a small and easy to install alternative to Pandas.
43+
4144

4245
The highlighted features are:
4346

@@ -49,25 +52,51 @@ The highlighted features are:
4952
the following plugins:
5053

5154
.. _file-format-list:
55+
.. _a-map-of-plugins-and-file-formats:
5256

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

55-
================ ========================================
56-
Plugins Supported file formats
57-
================ ========================================
58-
`pyexcel-xls`_ xls, xlsx(r), xlsm(r)
59-
`pyexcel-xlsx`_ xlsx
60-
`pyexcel-ods3`_ ods (python 2.6, 2.7, 3.3, 3.4)
61-
`pyexcel-ods`_ ods (python 2.6, 2.7)
62-
`pyexcel-text`_ (write only)json, rst, mediawiki, html
63-
latex, grid, pipe, orgtbl, plain simple
64-
================ ========================================
65-
59+
================= ======================= ============= ==================
60+
Package name Supported file formats Dependencies Python versions
61+
================= ======================= ============= ==================
62+
`pyexcel-io`_ csv, csvz [#f1]_, tsv, 2.6, 2.7, 3.3,
63+
tsvz [#f2]_ 3.4, 3.5,
64+
pypy, pypy3
65+
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_, same as above
66+
xlsm(read only) `xlwt`_
67+
`pyexcel-xlsx`_ xlsx `openpyxl`_ same as above
68+
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ same as above
69+
`pyexcel-ods3`_ ods `ezodf`_, 2.6, 2.7, 3.3, 3.4
70+
lxml 3.5
71+
`pyexcel-ods`_ ods `odfpy`_ same as above
72+
`pyexcel-text`_ (write only)json, rst, `tabulate`_ 2.6, 2.7, 3.3, 3.4
73+
mediawiki, html, 3.5, pypy, pypy3
74+
latex, grid, pipe,
75+
orgtbl, plain simple
76+
================= ======================= ============= ==================
77+
78+
.. _pyexcel-io: https://github.com/pyexcel/pyexcel-io
6679
.. _pyexcel-xls: https://github.com/pyexcel/pyexcel-xls
6780
.. _pyexcel-xlsx: https://github.com/pyexcel/pyexcel-xlsx
6881
.. _pyexcel-ods: https://github.com/pyexcel/pyexcel-ods
6982
.. _pyexcel-ods3: https://github.com/pyexcel/pyexcel-ods3
83+
.. _pyexcel-xlsxw: https://github.com/pyexcel/pyexcel-xlsxw
84+
85+
.. _xlrd: https://github.com/python-excel/xlrd
86+
.. _xlwt: https://github.com/python-excel/xlwt
87+
.. _openpyxl: https://bitbucket.org/openpyxl/openpyxl
88+
.. _XlsxWriter: https://github.com/jmcnamara/XlsxWriter
89+
.. _ezodf: https://github.com/T0ha/ezodf
90+
.. _odfpy: https://github.com/eea/odfpy
91+
7092
.. _pyexcel-text: https://github.com/pyexcel/pyexcel-text
93+
.. _tabulate: https://bitbucket.org/astanin/python-tabulate
94+
95+
.. rubric:: Footnotes
96+
97+
.. [#f1] zipped csv file
98+
.. [#f2] zipped tsv file
99+
71100
72101
This library makes information processing involving various excel files as easy as
73102
processing array, dictionary when processing file upload/download, data import into
@@ -82,13 +111,6 @@ and export from SQL databases, information analysis and persistence. It uses
82111
Installation
83112
-------------------
84113

85-
86-
Recently, pyexcel(0.2.2+) and its plugins(0.2.0+) started using newer version of setuptools. Please upgrade your setup tools before install latest pyexcel components:
87-
88-
.. code-block:: bash
89-
90-
$ pip install --upgrade setuptools
91-
92114
You can install it via pip:
93115

94116
.. code-block:: bash

setup.py

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
from ez_setup import use_setuptools
55
use_setuptools()
66
from setuptools import setup, find_packages
7+
from platform import python_implementation
8+
import sys
9+
PY2 = sys.version_info[0] == 2
10+
PY26 = PY2 and sys.version_info[1] < 7
711

812
NAME = 'django-excel'
913
AUTHOR = 'C.W.'
1014
VERSION = '0.0.6'
1115
EMAIL = 'wangc_2011 (at) hotmail.com'
1216
LICENSE = 'New BSD'
13-
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
1417
DESCRIPTION = (
1518
'A django middleware that provides one application programming interfac' +
1619
'e to read and write data in different excel file formats' +
@@ -24,18 +27,6 @@
2427
'Django'
2528
]
2629

27-
INSTALL_REQUIRES = [
28-
'pyexcel>=0.2.2',
29-
'pyexcel-webio>=0.0.7',
30-
'Django>=1.6.1',
31-
]
32-
33-
EXTRAS_REQUIRE = {
34-
'xls': ['pyexcel-xls>=0.1.0'],
35-
'xlsx': ['pyexcel-xlsx>=0.1.0'],
36-
'ods': ['pyexcel-ods3>=0.1.0'],
37-
}
38-
3930
CLASSIFIERS = [
4031
'Topic :: Office/Business',
4132
'Topic :: Utilities',
@@ -58,19 +49,56 @@
5849
'Programming Language :: Python :: 3.5'
5950
]
6051

52+
INSTALL_REQUIRES = [
53+
'pyexcel>=0.2.2',
54+
'pyexcel-webio>=0.0.7',
55+
'Django>=1.6.1',
56+
]
57+
58+
59+
PACKAGES = find_packages(exclude=['ez_setup', 'examples', 'tests'])
60+
EXTRAS_REQUIRE = {
61+
'xls': ['pyexcel-xls>=0.1.0'],
62+
'xlsx': ['pyexcel-xlsx>=0.1.0'],
63+
'ods': ['pyexcel-ods3>=0.1.0'],
64+
}
65+
6166

6267
def read_files(*files):
6368
"""Read files into setup"""
6469
text = ""
6570
for single_file in files:
66-
text = text + read(single_file) + "\n"
71+
content = read(single_file)
72+
text = text + content + "\n"
6773
return text
6874

6975

7076
def read(afile):
7177
"""Read a file into setup"""
7278
with open(afile, 'r') as opened_file:
73-
return opened_file.read()
79+
content = filter_out_test_code(opened_file)
80+
content = "".join(list(content))
81+
return content
82+
83+
84+
def filter_out_test_code(file_handle):
85+
found_test_code = False
86+
for line in file_handle.readlines():
87+
if line.startswith('.. testcode:'):
88+
found_test_code = True
89+
continue
90+
if found_test_code is True:
91+
if line.startswith(' '):
92+
continue
93+
else:
94+
empty_line = line.strip()
95+
if len(empty_line) == 0:
96+
continue
97+
else:
98+
found_test_code = False
99+
yield line
100+
else:
101+
yield line
74102

75103

76104
if __name__ == '__main__':
@@ -80,14 +108,14 @@ def read(afile):
80108
version=VERSION,
81109
author_email=EMAIL,
82110
description=DESCRIPTION,
83-
install_requires=INSTALL_REQUIRES,
111+
long_description=read_files('README.rst', 'CHANGELOG.rst'),
112+
license=LICENSE,
84113
keywords=KEYWORDS,
85114
extras_require=EXTRAS_REQUIRE,
115+
tests_require=['nose'],
116+
install_requires=INSTALL_REQUIRES,
86117
packages=PACKAGES,
87118
include_package_data=True,
88-
long_description=read_files('README.rst', 'CHANGELOG.rst'),
89119
zip_safe=False,
90-
tests_require=['nose'],
91-
license=LICENSE,
92120
classifiers=CLASSIFIERS
93121
)

0 commit comments

Comments
 (0)