Skip to content

Commit 2cba8bd

Browse files
committed
update readme and release 0.0.11
1 parent 6aa223a commit 2cba8bd

File tree

4 files changed

+170
-28
lines changed

4 files changed

+170
-28
lines changed

.moban.d/README.rst

+84-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,88 @@
1-
{%extends 'README.rst.jj2' %}
2-
3-
{%block description%}
4-
**pyexcel-ods** is a tiny wrapper library to read, manipulate and write data in
5-
ods fromat using python 2.6 and python 2.7. You are likely to use it with
6-
`pyexcel <https://github.com/pyexcel/pyexcel>`_.
7-
`pyexcel-ods3 <https://github.com/pyexcel/pyexcel-ods3>`_ is a sister library that
8-
does the same thing but supports Python 3.3 and 3.4 and depends on lxml.
1+
{% extends "BASIC-README.rst.jj2" %}
2+
3+
{%block documentation_link%}
4+
{%endblock%}
5+
6+
{%block features %}
7+
**pyexcel-webio** is a tiny interface library to unify the web extensions that uses `pyexcel <https://github.com/pyexcel/pyexcel>`__ . You may use it to write a web extension for your faviourite Python web framework.
98
{%endblock%}
109

11-
{%block extras %}
12-
Credits
13-
================================================================================
1410

15-
ODSReader is originally written by `Marco Conti <https://github.com/marcoconti83/read-ods-with-odfpy>`_
11+
{%block usage%}
12+
Known extensions
13+
=======================
14+
15+
============== ============================
16+
framework plugin/middleware/extension
17+
============== ============================
18+
Flask `Flask-Excel`_
19+
Django `django-excel`_
20+
Pyramid `pyramid-excel`_
21+
============== ============================
22+
23+
.. _Flask-Excel: https://github.com/pyexcel/Flask-Excel
24+
.. _django-excel: https://github.com/pyexcel/django-excel
25+
.. _pyramid-excel: https://github.com/pyexcel/pyramid-excel
26+
27+
28+
Usage
29+
=========
30+
31+
This small section outlines the steps to adapt **pyexcel-webio** for your favourite web framework. For illustration purpose, I took **Flask** micro-framework as an example.
32+
33+
1. Inherit **ExcelInput** class and implement **load_single_sheet** and **load_book** methods depending on the parameters you will have. For example, **Flask.Request** put the incoming file in **Flask.Request.files** and the key is the field name in the html form::
34+
35+
from flask import Flask, Request
36+
import pyexcel as pe
37+
from pyexcel.ext import webio
38+
39+
class ExcelRequest(webio.ExcelInput, Request):
40+
def _get_file_tuple(self, field_name):
41+
filehandle = self.files[field_name]
42+
filename = filehandle.filename
43+
extension = filename.split(".")[1]
44+
return extension, filehandle
45+
46+
def load_single_sheet(self, field_name=None, sheet_name=None,
47+
**keywords):
48+
file_type, file_handle = self._get_file_tuple(field_name)
49+
return pe.get_sheet(file_type=file_type,
50+
content=file_handle.read(),
51+
sheet_name=sheet_name,
52+
**keywords)
53+
54+
def load_book(self, field_name=None, **keywords):
55+
file_type, file_handle = self._get_file_tuple(field_name)
56+
return pe.get_book(file_type=file_type,
57+
content=file_handle.read(),
58+
**keywords)
59+
60+
2. Plugin in a response method that has the following signature::
61+
62+
def your_func(content, content_type=None, status=200):
63+
....
64+
65+
or a response class has the same signature::
66+
67+
class YourClass:
68+
def __init__(self, content, content_type=None, status=200):
69+
....
70+
71+
For example, with **Flask**, it is just a few lines::
72+
73+
from flask import Response
74+
75+
76+
webio.ExcelResponse = Response
77+
78+
79+
3. Then make the proxy for **make_response** series by simply copying the following lines to your extension::
80+
81+
from pyexcel.ext.webio import (
82+
make_response,
83+
make_response_from_array,
84+
make_response_from_dict,
85+
make_response_from_records,
86+
make_response_from_book_dict
87+
)
1688
{%endblock%}

.moban.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ targets:
1515
- test.sh: test.sh.jj2
1616
- test.bat: test.sh.jj2
1717
- "tests/requirements.txt": "tests/requirements.txt"
18+
- README.rst: README.rst

CHANGELOG.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change log
22
================================================================================
33

4+
0.0.11 - 04.03.2017
5+
--------------------------------------------------------------------------------
6+
7+
Updated
8+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9+
10+
#. `#4 <https://github.com/pyexcel/pyexcel-webio/issues/4>`_: extra keywords
11+
were not passed on to pyexcel
12+
413
0.0.10 - 22.12.2016
514
--------------------------------------------------------------------------------
615

README.rst

+76-16
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
1-
==============
2-
pyexcel-webio
3-
==============
1+
================================================================================
2+
pyexcel-webio - Let you focus on data, instead of file formats
3+
================================================================================
44

5-
.. image:: https://api.travis-ci.org/pyexcel/pyexcel-webio.png
6-
:target: http://travis-ci.org/pyexcel/pyexcel-webio
5+
.. image:: https://api.travis-ci.org/pyexcel/pyexcel-webio.svg?branch=master
6+
:target: http://travis-ci.org/pyexcel/pyexcel-webio
77

88
.. image:: https://codecov.io/github/pyexcel/pyexcel-webio/coverage.png
99
:target: https://codecov.io/github/pyexcel/pyexcel-webio
1010

1111

12+
Known constraints
13+
==================
14+
15+
Fonts, colors and charts are not supported.
16+
1217
**pyexcel-webio** is a tiny interface library to unify the web extensions that uses `pyexcel <https://github.com/pyexcel/pyexcel>`__ . You may use it to write a web extension for your faviourite Python web framework.
1318

1419

20+
1521
Installation
16-
============
22+
================================================================================
23+
You can install it via pip:
1724

18-
You can install it via pip::
25+
.. code-block:: bash
1926
2027
$ pip install pyexcel-webio
2128
2229
23-
or clone it and install it::
30+
or clone it and install it:
31+
32+
.. code-block:: bash
2433
2534
$ git clone http://github.com/pyexcel/pyexcel-webio.git
2635
$ cd pyexcel-webio
@@ -42,6 +51,7 @@ Pyramid `pyramid-excel`_
4251
.. _django-excel: https://github.com/pyexcel/django-excel
4352
.. _pyramid-excel: https://github.com/pyexcel/pyramid-excel
4453

54+
4555
Usage
4656
=========
4757

@@ -59,15 +69,15 @@ This small section outlines the steps to adapt **pyexcel-webio** for your favour
5969
filename = filehandle.filename
6070
extension = filename.split(".")[1]
6171
return extension, filehandle
62-
72+
6373
def load_single_sheet(self, field_name=None, sheet_name=None,
6474
**keywords):
6575
file_type, file_handle = self._get_file_tuple(field_name)
6676
return pe.get_sheet(file_type=file_type,
6777
content=file_handle.read(),
6878
sheet_name=sheet_name,
6979
**keywords)
70-
80+
7181
def load_book(self, field_name=None, **keywords):
7282
file_type, file_handle = self._get_file_tuple(field_name)
7383
return pe.get_book(file_type=file_type,
@@ -103,12 +113,62 @@ This small section outlines the steps to adapt **pyexcel-webio** for your favour
103113
make_response_from_book_dict
104114
)
105115

106-
License
107-
==========
116+
Development guide
117+
================================================================================
108118

109-
New BSD License
119+
Development steps for code changes
120+
121+
#. git clone https://github.com/pyexcel/pyexcel-webio.git
122+
#. cd pyexcel-webio
123+
124+
Upgrade your setup tools and pip. They are needed for development and testing only:
125+
126+
#. pip install --upgrade setuptools "pip==7.1"
127+
128+
Then install relevant development requirements:
129+
130+
#. pip install -r rnd_requirements.txt # if such a file exists
131+
#. pip install -r requirements.txt
132+
#. pip install -r tests/requirements.txt
133+
134+
135+
In order to update test environment, and documentation, additional steps are
136+
required:
110137

111-
Dependencies
112-
============
138+
#. pip install moban
139+
#. git clone https://github.com/pyexcel/pyexcel-commons.git commons
140+
#. make your changes in `.moban.d` directory, then issue command `moban`
113141

114-
* pyexcel >= 0.1.7
142+
What is rnd_requirements.txt
143+
-------------------------------
144+
145+
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.
146+
147+
What is pyexcel-commons
148+
---------------------------------
149+
150+
Many information that are shared across pyexcel projects, such as: this developer guide, license info, etc. are stored in `pyexcel-commons` project.
151+
152+
What is .moban.d
153+
---------------------------------
154+
155+
`.moban.d` stores the specific meta data for the library.
156+
157+
How to test your contribution
158+
------------------------------
159+
160+
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.
161+
162+
On Linux/Unix systems, please launch your tests like this::
163+
164+
$ make
165+
166+
On Windows systems, please issue this command::
167+
168+
> test.bat
169+
170+
171+
License
172+
================================================================================
173+
174+
New BSD License

0 commit comments

Comments
 (0)