Skip to content

Commit e616a3a

Browse files
committed
🤝 take latest code from setupmobans, carrying LICENSE file, pyexcel/pyexcel#103, update docs pyexcel/pyexcel#104
1 parent b2e2194 commit e616a3a

File tree

4 files changed

+134
-65
lines changed

4 files changed

+134
-65
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include README.rst
2+
include LICENSE
23
include CHANGELOG.rst
34
prune mysite
45
prune polls

README.rst

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ product, please `support me on patreon <https://www.patreon.com/bePatron?u=55376
2525
maintain the project and develop it further.
2626

2727
If you are an individual, you are welcome to support me too on patreon and for however long
28-
you feel like to. As a patreon, you will receive
28+
you feel like. As a patreon, you will receive
2929
`early access to pyexcel related contents <https://www.patreon.com/pyexcel/posts>`_.
3030

3131
With your financial support, I will be able to invest
@@ -56,15 +56,16 @@ well as on file system. This library can turn the excel data into a list of list
5656
a list of records(dictionaries), dictionaries of lists. And vice versa. Hence it
5757
lets you focus on data in Django based web development, instead of file formats.
5858

59-
The idea originated from the common usability problem when developing an excel file
60-
driven web applications for non-technical office workers: such as office assistant,
61-
human resource administrator. The fact is that not all people know the
62-
difference among various excel formats: csv, xls, xlsx. Instead of training those people
59+
The idea originated from the common usability problem: when an excel file
60+
driven web application is delivered for non-developer users (ie: team assistant,
61+
human resource administrator etc). The fact is that not everyone knows (or cares) about the
62+
differences between various excel formats: csv, xls, xlsx are all the same to them. Instead of training those users
6363
about file formats, this library helps web developers to handle most of the excel file
64-
formats by providing a common programming interface. To add a specific excel file format
65-
to you application, all you need is to install an extra pyexcel plugin. No code change
66-
to your application. Looking at the community, this library and its associated ones try
67-
to become a small and easy to install alternative to Pandas.
64+
formats by providing a common programming interface. To add a specific excel file format type
65+
to you application, all you need is to install an extra pyexcel plugin. Hence no code changes
66+
to your application and no issues with excel file formats any more. Looking at the
67+
community, this library and its associated ones try to become a small and easy to
68+
install alternative to Pandas.
6869

6970

7071
The highlighted features are:
@@ -90,26 +91,22 @@ The highlighted features are:
9091
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_, same as above
9192
xlsm(read only) `xlwt`_
9293
`pyexcel-xlsx`_ xlsx `openpyxl`_ same as above
93-
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ same as above
9494
`pyexcel-ods3`_ ods `pyexcel-ezodf`_, 2.6, 2.7, 3.3, 3.4
9595
lxml 3.5, 3.6
9696
`pyexcel-ods`_ ods `odfpy`_ same as above
97+
======================== ======================= ================= ==================
98+
99+
.. table:: Dedicated file reader and writers
100+
101+
======================== ======================= ================= ==================
102+
Package name Supported file formats Dependencies Python versions
103+
======================== ======================= ================= ==================
104+
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ Python 2 and 3
97105
`pyexcel-odsr`_ read only for ods, fods lxml same as above
98106
`pyexcel-htmlr`_ html(read only) lxml,html5lib same as above
99-
`pyexcel-text`_ write only:rst, `tabulate`_ 2.6, 2.7, 3.3, 3.4
100-
mediawiki, html, 3.5, 3.6, pypy
101-
latex, grid, pipe,
102-
orgtbl, plain simple
103-
read only: ndjson
104-
r/w: json
105-
`pyexcel-handsontable`_ handsontable in html `handsontable`_ same as above
106-
`pyexcel-pygal`_ svg chart `pygal`_ 2.7, 3.3, 3.4, 3.5
107-
3.6, pypy
108-
`pyexcel-sortable`_ sortable table in html `csvtotable`_ same as above
109-
`pyexcel-gantt`_ gantt chart in html `frappe-gantt`_ except pypy, same
110-
as above
111107
======================== ======================= ================= ==================
112108

109+
113110
.. _pyexcel-io: https://github.com/pyexcel/pyexcel-io
114111
.. _pyexcel-xls: https://github.com/pyexcel/pyexcel-xls
115112
.. _pyexcel-xlsx: https://github.com/pyexcel/pyexcel-xlsx
@@ -126,6 +123,25 @@ The highlighted features are:
126123
.. _pyexcel-ezodf: https://github.com/pyexcel/pyexcel-ezodf
127124
.. _odfpy: https://github.com/eea/odfpy
128125

126+
.. table:: Other data renderers
127+
128+
======================== ======================= ================= ==================
129+
Package name Supported file formats Dependencies Python versions
130+
======================== ======================= ================= ==================
131+
`pyexcel-text`_ write only:rst, `tabulate`_ 2.6, 2.7, 3.3, 3.4
132+
mediawiki, html, 3.5, 3.6, pypy
133+
latex, grid, pipe,
134+
orgtbl, plain simple
135+
read only: ndjson
136+
r/w: json
137+
`pyexcel-handsontable`_ handsontable in html `handsontable`_ same as above
138+
`pyexcel-pygal`_ svg chart `pygal`_ 2.7, 3.3, 3.4, 3.5
139+
3.6, pypy
140+
`pyexcel-sortable`_ sortable table in html `csvtotable`_ same as above
141+
`pyexcel-gantt`_ gantt chart in html `frappe-gantt`_ except pypy, same
142+
as above
143+
======================== ======================= ================= ==================
144+
129145
.. _pyexcel-text: https://github.com/pyexcel/pyexcel-text
130146
.. _tabulate: https://bitbucket.org/astanin/python-tabulate
131147
.. _pyexcel-handsontable: https://github.com/pyexcel/pyexcel-handsontable
@@ -186,7 +202,8 @@ Tested Django Versions
186202

187203
Installation
188204
================================================================================
189-
You can install it via pip:
205+
206+
You can install django-excel via pip:
190207

191208
.. code-block:: bash
192209
@@ -219,9 +236,10 @@ Here is the example viewing function codes:
219236

220237
.. code-block:: python
221238
222-
from django.shortcuts import render
239+
from django.shortcuts import render_to_response
223240
from django.http import HttpResponseBadRequest
224241
from django import forms
242+
from django.template import RequestContext
225243
import django_excel as excel
226244
227245
class UploadFileForm(forms.Form):
@@ -237,20 +255,14 @@ Here is the example viewing function codes:
237255
return HttpResponseBadRequest()
238256
else:
239257
form = UploadFileForm()
240-
return render(request, 'upload_form.html', {'form': form})
258+
return render_to_response('upload_form.html',
259+
{'form': form},
260+
context_instance=RequestContext(request))
241261
242262
def download(request):
243263
sheet = excel.pe.Sheet([[1, 2],[3, 4]])
244264
return excel.make_response(sheet, "csv")
245265
246-
.. code-block:: html
247-
248-
<form action="/upload-file/" enctype="multipart/form-data" method="post">
249-
{% csrf_token %}
250-
{{ form }}
251-
<input type="submit" value="Submit" />
252-
</form>
253-
254266
Development guide
255267
================================================================================
256268

docs/source/index.rst

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ well as on file system. This library can turn the excel data into a list of list
3030
a list of records(dictionaries), dictionaries of lists. And vice versa. Hence it
3131
lets you focus on data in Django based web development, instead of file formats.
3232

33-
The idea originated from the common usability problem when developing an excel file
34-
driven web applications for non-technical office workers: such as office assistant,
35-
human resource administrator. The fact is that not all people know the
36-
difference among various excel formats: csv, xls, xlsx. Instead of training those people
33+
The idea originated from the common usability problem: when an excel file
34+
driven web application is delivered for non-developer users (ie: team assistant,
35+
human resource administrator etc). The fact is that not everyone knows (or cares) about the
36+
differences between various excel formats: csv, xls, xlsx are all the same to them. Instead of training those users
3737
about file formats, this library helps web developers to handle most of the excel file
38-
formats by providing a common programming interface. To add a specific excel file format
39-
to you application, all you need is to install an extra pyexcel plugin. No code change
40-
to your application. Looking at the community, this library and its associated ones try
41-
to become a small and easy to install alternative to Pandas.
38+
formats by providing a common programming interface. To add a specific excel file format type
39+
to you application, all you need is to install an extra pyexcel plugin. Hence no code changes
40+
to your application and no issues with excel file formats any more. Looking at the
41+
community, this library and its associated ones try to become a small and easy to
42+
install alternative to Pandas.
4243

4344

4445
The highlighted features are:
@@ -64,26 +65,22 @@ The highlighted features are:
6465
`pyexcel-xls`_ xls, xlsx(read only), `xlrd`_, same as above
6566
xlsm(read only) `xlwt`_
6667
`pyexcel-xlsx`_ xlsx `openpyxl`_ same as above
67-
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ same as above
6868
`pyexcel-ods3`_ ods `pyexcel-ezodf`_, 2.6, 2.7, 3.3, 3.4
6969
lxml 3.5, 3.6
7070
`pyexcel-ods`_ ods `odfpy`_ same as above
71+
======================== ======================= ================= ==================
72+
73+
.. table:: Dedicated file reader and writers
74+
75+
======================== ======================= ================= ==================
76+
Package name Supported file formats Dependencies Python versions
77+
======================== ======================= ================= ==================
78+
`pyexcel-xlsxw`_ xlsx(write only) `XlsxWriter`_ Python 2 and 3
7179
`pyexcel-odsr`_ read only for ods, fods lxml same as above
7280
`pyexcel-htmlr`_ html(read only) lxml,html5lib same as above
73-
`pyexcel-text`_ write only:rst, `tabulate`_ 2.6, 2.7, 3.3, 3.4
74-
mediawiki, html, 3.5, 3.6, pypy
75-
latex, grid, pipe,
76-
orgtbl, plain simple
77-
read only: ndjson
78-
r/w: json
79-
`pyexcel-handsontable`_ handsontable in html `handsontable`_ same as above
80-
`pyexcel-pygal`_ svg chart `pygal`_ 2.7, 3.3, 3.4, 3.5
81-
3.6, pypy
82-
`pyexcel-sortable`_ sortable table in html `csvtotable`_ same as above
83-
`pyexcel-gantt`_ gantt chart in html `frappe-gantt`_ except pypy, same
84-
as above
8581
======================== ======================= ================= ==================
8682

83+
8784
.. _pyexcel-io: https://github.com/pyexcel/pyexcel-io
8885
.. _pyexcel-xls: https://github.com/pyexcel/pyexcel-xls
8986
.. _pyexcel-xlsx: https://github.com/pyexcel/pyexcel-xlsx
@@ -100,6 +97,25 @@ The highlighted features are:
10097
.. _pyexcel-ezodf: https://github.com/pyexcel/pyexcel-ezodf
10198
.. _odfpy: https://github.com/eea/odfpy
10299

100+
.. table:: Other data renderers
101+
102+
======================== ======================= ================= ==================
103+
Package name Supported file formats Dependencies Python versions
104+
======================== ======================= ================= ==================
105+
`pyexcel-text`_ write only:rst, `tabulate`_ 2.6, 2.7, 3.3, 3.4
106+
mediawiki, html, 3.5, 3.6, pypy
107+
latex, grid, pipe,
108+
orgtbl, plain simple
109+
read only: ndjson
110+
r/w: json
111+
`pyexcel-handsontable`_ handsontable in html `handsontable`_ same as above
112+
`pyexcel-pygal`_ svg chart `pygal`_ 2.7, 3.3, 3.4, 3.5
113+
3.6, pypy
114+
`pyexcel-sortable`_ sortable table in html `csvtotable`_ same as above
115+
`pyexcel-gantt`_ gantt chart in html `frappe-gantt`_ except pypy, same
116+
as above
117+
======================== ======================= ================= ==================
118+
103119
.. _pyexcel-text: https://github.com/pyexcel/pyexcel-text
104120
.. _tabulate: https://bitbucket.org/astanin/python-tabulate
105121
.. _pyexcel-handsontable: https://github.com/pyexcel/pyexcel-handsontable
@@ -139,7 +155,8 @@ and export from SQL databases, information analysis and persistence. It uses
139155
Installation
140156
-------------------
141157

142-
You can install it via pip:
158+
159+
You can install django-excel via pip:
143160

144161
.. code-block:: bash
145162
@@ -191,7 +208,7 @@ product, please `support me on patreon <https://www.patreon.com/bePatron?u=55376
191208
maintain the project and develop it further.
192209

193210
If you are an individual, you are welcome to support me too on patreon and for however long
194-
you feel like to. As a patreon, you will receive
211+
you feel like. As a patreon, you will receive
195212
`early access to pyexcel related contents <https://www.patreon.com/pyexcel/posts>`_.
196213

197214
With your financial support, I will be able to invest

setup.py

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
try:
2-
from setuptools import setup, find_packages
3-
except ImportError:
4-
from ez_setup import use_setuptools
5-
use_setuptools()
6-
from setuptools import setup, find_packages
1+
# Template by setupmobans
2+
import os
73
import sys
4+
import codecs
5+
from shutil import rmtree
6+
from setuptools import setup, find_packages, Command
87
PY2 = sys.version_info[0] == 2
98
PY26 = PY2 and sys.version_info[1] < 7
109

@@ -20,7 +19,7 @@
2019
)
2120
URL = 'https://github.com/pyexcel/django-excel'
2221
DOWNLOAD_URL = '%s/archive/0.0.9.tar.gz' % URL
23-
FILES = ['README.rst', 'CHANGELOG.rst']
22+
FILES = ['README.rst', 'CHANGELOG.rst']
2423
KEYWORDS = [
2524
'API',
2625
'Django',
@@ -67,6 +66,42 @@
6766
'xlsx': ['pyexcel-xlsx>=0.4.0'],
6867
'ods': ['pyexcel-ods3>=0.4.0'],
6968
}
69+
PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi'.format(
70+
sys.executable)
71+
GS_COMMAND = ('gs django-excel v0.0.9 ' +
72+
"Find 0.0.9 in changelog for more details")
73+
here = os.path.abspath(os.path.dirname(__file__))
74+
75+
76+
class PublishCommand(Command):
77+
"""Support setup.py upload."""
78+
79+
description = 'Build and publish the package on github and pypi'
80+
user_options = []
81+
82+
@staticmethod
83+
def status(s):
84+
"""Prints things in bold."""
85+
print('\033[1m{0}\033[0m'.format(s))
86+
87+
def initialize_options(self):
88+
pass
89+
90+
def finalize_options(self):
91+
pass
92+
93+
def run(self):
94+
try:
95+
self.status('Removing previous builds...')
96+
rmtree(os.path.join(here, 'dist'))
97+
except OSError:
98+
pass
99+
100+
self.status('Building Source and Wheel (universal) distribution...')
101+
if os.system(GS_COMMAND) == 0:
102+
os.system(PUBLISH_COMMAND)
103+
104+
sys.exit()
70105

71106

72107
def read_files(*files):
@@ -80,7 +115,7 @@ def read_files(*files):
80115

81116
def read(afile):
82117
"""Read a file into setup"""
83-
with open(afile, 'r') as opened_file:
118+
with codecs.open(afile, 'r', 'utf-8') as opened_file:
84119
content = filter_out_test_code(opened_file)
85120
content = "".join(list(content))
86121
return content
@@ -128,5 +163,9 @@ def filter_out_test_code(file_handle):
128163
packages=PACKAGES,
129164
include_package_data=True,
130165
zip_safe=False,
131-
classifiers=CLASSIFIERS
166+
classifiers=CLASSIFIERS,
167+
setup_requires=['gease'],
168+
cmdclass={
169+
'publish': PublishCommand,
170+
}
132171
)

0 commit comments

Comments
 (0)