This repository has been archived by the owner on Sep 5, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kenneth Reitz
committed
Oct 29, 2010
1 parent
6dc7bb1
commit 2a72d85
Showing
11 changed files
with
444 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# application builds | ||
build/* | ||
dist/* | ||
MANIFEST | ||
|
||
# python skin | ||
*.pyc | ||
*.pyo | ||
|
||
# osx noise | ||
.DS_Store | ||
profile | ||
|
||
# pycharm noise | ||
.idea | ||
.idea/* | ||
|
||
# vi noise | ||
*.swp | ||
docs/_build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Pyandoc is written and maintained by Kenneth Reitz and | ||
various contributors: | ||
|
||
Development Lead | ||
```````````````` | ||
|
||
- Kenneth Reitz <me@kennethreitz.com> | ||
|
||
|
||
Patches and Suggestions | ||
``````````````````````` | ||
|
||
- A lucky someone! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2010 Kenneth Reitz. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include HISTORY.rst README.rst LICENSE AUTHORS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
Tablib includes some vendorized python libraries: pyyaml, simplejson, and xlwt. | ||
|
||
|
||
|
||
PyYAML License | ||
============== | ||
|
||
Copyright (c) 2006 Kirill Simonov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
||
|
||
SimpleJSON License | ||
================== | ||
|
||
Copyright (c) 2006 Bob Ippolito | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
||
|
||
|
||
XLWT License | ||
============ | ||
|
||
Portions copyright © 2007, Stephen John Machin, Lingfo Pty Ltd | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. None of the names of Stephen John Machin, Lingfo Pty Ltd and any | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS | ||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. | ||
""" | ||
|
||
""" | ||
Copyright (C) 2005 Roman V. Kiseliov | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
3. All advertising materials mentioning features or use of this | ||
software must display the following acknowledgment: | ||
"This product includes software developed by | ||
Roman V. Kiseliov <roman@kiseliov.ru>." | ||
|
||
4. Redistributions of any form whatsoever must retain the following | ||
acknowledgment: | ||
"This product includes software developed by | ||
Roman V. Kiseliov <roman@kiseliov.ru>." | ||
|
||
THIS SOFTWARE IS PROVIDED BY Roman V. Kiseliov ``AS IS'' AND ANY | ||
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Roman V. Kiseliov OR | ||
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
Roman V. Kiseliov | ||
Russia | ||
Kursk | ||
Libknecht St., 4 | ||
|
||
+7(0712)56-09-83 | ||
|
||
<roman@kiseliov.ru> | ||
Subject: pyExcelerator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
Tablib: format-agnostic tabular dataset library | ||
=============================================== | ||
|
||
:: | ||
|
||
_____ ______ ___________ ______ | ||
__ /_______ ____ /_ ___ /___(_)___ /_ | ||
_ __/_ __ `/__ __ \__ / __ / __ __ \ | ||
/ /_ / /_/ / _ /_/ /_ / _ / _ /_/ / | ||
\__/ \__,_/ /_.___/ /_/ /_/ /_.___/ | ||
|
||
|
||
|
||
Tablib is a format-agnostic tabular dataset library, written in Python. | ||
|
||
Output formats supported: | ||
|
||
- Excel (Sets + Books) | ||
- JSON (Sets + Books) | ||
- YAML (Sets + Books) | ||
- CSV (Sets) | ||
|
||
Import formats supported: | ||
|
||
- JSON (Sets + Books) | ||
- YAML (Sets + Books) | ||
- CSV (Sets) | ||
|
||
Note that tablib *purposefully* excludes XML support. It always will. | ||
|
||
Overview | ||
-------- | ||
|
||
`tablib.Dataset()` | ||
A Dataset is a table of tabular data. It may or may not have a header row. They can be build and maniuplated as raw Python datatypes (Lists of tuples|dictonaries). Datasets can be imported from JSON, YAML, and CSV; they can be exported to Excel (XLS), JSON, YAML, and CSV. | ||
|
||
`tablib.Databook()` | ||
A Databook is a set of Datasets. The most common form of a Databook is an Excel file with multiple spreadsheets. Databooks can be imported from JSON and YAML; they can be exported to Excel (XLS), JSON, and YAML. | ||
|
||
Usage | ||
----- | ||
|
||
|
||
Populate fresh data files: :: | ||
headers = ('first_name', 'last_name') | ||
|
||
data = [ | ||
('John', 'Adams'), | ||
('George', 'Washington') | ||
] | ||
data = tablib.Dataset(*data, headers=headers) | ||
|
||
|
||
Intelligently add new rows: :: | ||
|
||
>>> data.append(('Henry', 'Ford')) | ||
|
||
Intelligently add new columns: :: | ||
|
||
>>> data.append(col=('age', 90, 67, 83)) | ||
Slice rows: :: | ||
|
||
>>> print data[:2] | ||
[('John', 'Adams', 90), ('George', 'Washington', 67)] | ||
|
||
Slice columns by header: :: | ||
|
||
>>> print data['first_name'] | ||
['John', 'George', 'Henry'] | ||
|
||
Easily delete rows: :: | ||
|
||
>>> del data[1] | ||
|
||
Exports | ||
------- | ||
|
||
Drumroll please........... | ||
|
||
JSON! | ||
+++++ | ||
:: | ||
|
||
>>> print data.json | ||
[ | ||
{ | ||
"last_name": "Adams", | ||
"age": 90, | ||
"first_name": "John" | ||
}, | ||
{ | ||
"last_name": "Ford", | ||
"age": 83, | ||
"first_name": "Henry" | ||
} | ||
] | ||
|
||
YAML! | ||
+++++ | ||
:: | ||
|
||
>>> print data.yaml | ||
- {age: 90, first_name: John, last_name: Adams} | ||
- {age: 83, first_name: Henry, last_name: Ford} | ||
CSV... | ||
++++++ | ||
:: | ||
|
||
>>> print data.csv | ||
first_name,last_name,age | ||
John,Adams,90 | ||
Henry,Ford,83 | ||
EXCEL! | ||
++++++ | ||
:: | ||
|
||
>>> open('people.xls', 'wb').write(data.xls) | ||
|
||
It's that easy. | ||
|
||
Imports! | ||
-------- | ||
|
||
JSON | ||
++++ | ||
|
||
:: | ||
|
||
>>> data.json = '[{"last_name": "Adams","age": 90,"first_name": "John"}]' | ||
>>> print data[0] | ||
('John', 'Adams', 90) | ||
|
||
|
||
YAML | ||
++++ | ||
:: | ||
|
||
>>> data.yaml = '- {age: 90, first_name: John, last_name: Adams}' | ||
>>> print data[0] | ||
('John', 'Adams', 90) | ||
|
||
CSV | ||
+++ | ||
:: | ||
|
||
>>> data.csv = 'age, first_name, last_name\n90, John, Adams' | ||
>>> print data[0] | ||
('John', 'Adams', 90) | ||
>>> print data.yaml | ||
- {age: 90, first_name: John, last_name: Adams} | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
To install tablib, simply: :: | ||
|
||
$ pip install tablib | ||
Or, if you absolutely must: :: | ||
|
||
$ easy_install tablib | ||
|
||
Contribute | ||
---------- | ||
|
||
If you'd like to contribute, simply fork `the repository`_, commit your changes to the **develop** branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS_. | ||
|
||
|
||
Roadmap | ||
------- | ||
- Release CLI Interface | ||
- Auto-detect import format | ||
- Add possible other exports (SQL?) | ||
- Ability to assign types to rows (set, regex=, &c.) | ||
|
||
.. _`the repository`: http://github.com/kennethreitz/tablib | ||
.. _AUTHORS: http://github.com/kennethreitz/tablib/blob/master/AUTHORS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Get inital work implimented |
Oops, something went wrong.