Package: outputty
outputtyis a simple Python library that helps you importing, filtering
and exporting data. It is composed by a mainTableclass and a lot of
plugins that helps importing and exporting data to/fromTable.You can write your own plugin easily (seeoutputty/plugin_*.pyfor
examples). Some examples of plugins are: CSV, text, HTML and histogram.InstallationAs simple as executing:pip install outputtyNote: aspiptries to compile everything andoutputtydepends onMySQL-Pythonpackage (which needs compilation), you need to have
libmysqlclient’s headers, compilers and related stuff. To install it on
Debian/Ubuntu, just execute:apt-get install build-essential libmysqlclient-devExampleCode time!:>>> from outputty import Table
>>> my_table = Table(headers=['name', 'age']) # headers are the columns
>>> my_table.append(('Álvaro Justen', 24)) # a row as tuple
>>> my_table.append({'name': 'Other User', 'age': 99}) # a row as dict
>>> print my_table # a text representation of Table
+---------------+-----+
|      name     | age |
+---------------+-----+
| Álvaro Justen |  24 |
|    Other User |  99 |
+---------------+-----+

>>> print 'First row:', my_table[0] # Table is indexable
First row: [u'\xc1lvaro Justen', 24]

>>> print 'Sum of ages:', sum(my_table['age']) # you can get columns too
Sum of ages: 123

>>> my_table.write('csv', 'my-table.csv') # CSV plugin will save its contents in a file
>>> # let's see what's in the file...
>>> print open('my-table.csv').read()
"name","age"
"Álvaro Justen","24"
"Other User","99"

>>> # let's use HTML plugin!
>>> print my_table.write('html') # without filename ``write`` will return a string
<table>
  <thead>
    <tr class="header">
      <th>name</th>
      <th>age</th>
    </tr>
  </thead>
  <tbody>
    <tr class="odd">
      <td>Álvaro Justen</td>
      <td>24</td>
    </tr>
    <tr class="even">
      <td>Other User</td>
      <td>99</td>
    </tr>
  </tbody>
</table>Tablehavea lotof other features. To learn more (by examples), readoutputty tutorialand seeexamplesfolder. Enjoy!New FeaturesYes, there are a lot of features to add (it’s just the begining). If you
want to contribute, please see ouroutputty wishlist.You can also use theoutputty Issue Tracking System on GitHubto report bugs.ContributingIf you want to contribute to this project, please:Install dependencies for development runningpip install-rrequirements/development.txt.Executemake testto run all tests – please runall testsbeforepushing.To run just one test file execute:nosetests--with-coverage--cover-packageoutputtytests/test_your-test-file.pyTry to have a test-coverage of 100%.UseTest-driven development.Usenvie’s gitflow- to learn, readA Successful Git branching model.Create/update documentation (README/docstrings/man page)Do NOTeditREADME.rstandtutorial.rst, editREADME-template.rstortutorial-template.rstinstead and runmakecreate-docsto create the newREADME.rstandtutorial.rst(before committing). The tutorial will be created based on
files inexamplesfolder.New PluginsIf you want to create a new plugin to import/export from/to some new
resource, please see filesoutputty/plugin_*.pyas examples. They are so
simple, please follow these steps:Create a file namedoutputty/plugin_name.py, wherenameis the name of
your plugin.Createreadand/orwritefunctions in this file. These functions receive
theTableobject and optional parameters.read: should read data from the resource specified in parameters and put
this data inTable(usingTable.appendorTable.extend).write: should read data fromTable(iterating over it, using slicing
etc.) and write this data to the resource specified in parameters.Call your plugin executingmy_table.write('name',optional_parameters...)ormy_table.read('name',optional_parameters...)(wherenameis your
plugin’s name) - when you execute itoutputtywill calloutputty.plugin_name.read/outputty.plugin_name.write.Encoding and DecodingYour plugin’sreadfunctionmustput all data inside in unicode and your
plugin’swritefunction will receive aTableobject with all data in
unicode (it should not change this). But if you need to decode/encode
before/after doing some actions in your plugin, you can useTable.decode()andTable.encode().ContributorsThis software is written and maintained byÁlvaro Justenbut received a lot of
contributions. My sincerely thanks to:Fundação Getúlio Vargasfor letting me invest my time
on it.Douglas Andradefor showing metextwrap.dedentand writting more legible tests.Flávio Coelhofor creatinghistogramand
giving a lot of suggestions.Renne Rochafor creatingorder_by.Tatiana Al-Chueyrfor designing and coding
architecture proposals and suggestions for the plugin API (including the
architecture we are using).Flávio Amieirofor a lot of suggestions
and interpretations about design.Related Softwareoutputty-like:tablib: format-agnostic tabular
dataset library.PyTables: package for managing hierarchical
datasets and designed to efficiently and easily cope with extremely large
amounts of data.csvstudio: Python tool to analyze
csv files.csvsimple: a simple tool to
handle CSV data.toolshed: less boiler-plate.buzhug: a fast, pure-Python
database engine.Data analysis:pyf: framework and platform dedicated to large
data processing, mining, transforming, reporting and more.pygrametl: Python framework which offers
commonly used functionality for development of Extract-Transform-Load
(ETL) processes.etlpyseems to be a dead project.orange: data visualization and analysis for
novice and experts.Ruffus: lightweight python module to run
computational pipelines.webstore: web-api enabled datastore
backed onto sql databasesCommand-line tools:fabulous: library designed to
make the output of terminal applications look fabulous.termcolor: ANSII Color
formatting for output in terminal.clint: Python Command-line
Application Tools.Other:pyspread: non-traditional
spreadsheet application.