Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install wq.io

How to install wq.io

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install wq.io
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.2.0 Available View build log
 
License
MIT
Dependencies
Depended by
Lastest release
version 0.2.0 on Jan 9th, 2014
wq.io

wq.io is a collection of Python libraries for consuming (input) and generating (output) external data resources in various formats. It thereby facilitates interoperability between the wq framework and other systems and formats.

The basic idea behind wq.io is to avoid having to remember the unique usage of e.g. csv, xlrd, or lxml every time one needs to work with an external dataset. Instead, wq.io abstracts these libraries into a consistent interface that works as an iterable of namedtuples.

Example

from wq.io import load_file
data = load_file('example.xls')
for row in data:
    print row.name, row.date
Extending wq.io

The actual process is broken into several steps (load, parse, and map) which are handed by various mixins. These are mixed with the BaseIO class to provide a usable class that can load and iterate over files.

Example

from wq.io import make_io
from wq.io.loaders import FileLoader
from wq.io.parsers import JsonParser

class MyJsonParser(JsonParser):
    def parse(self):
    # custom parsing code ...

MyJsonFileIO = make_io(FileLoader, MyJsonParser)

for record in MyJsonFileIO(filename='file.json'):
    print record.id

loaders

Load an external resource from the local filesystem or from the web into a file-like object. On export, loaders prepare the file-like object for writing and perform any needed wrap-up operations.

parsers

Parse the file (usually using the standard python library for that file type) and convert the recordset into a simple list of dictionaries. On export, parsers coonvert the dictionary list back into the source format and write out to the file.

mappers

Rename field names and values if needed and optionally convert the dictionaries into other object types (such as a namedtuple). On export, mappers convert the mapped object back into a simple dictionary and map the field names and values back to the format expected by the file.

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.