Skip to main content
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.

Release files for wq.io 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wq.io 0.2.0
File Size Uploaded
wq.io-0.2.0.tar.gz 9.7 kB Details

Release files / wq.io-0.2.0.tar.gz

Download URL wq.io-0.2.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0b1db04d34df56bfef7c07afd4dd53c7af569c4d044103c23460c23aa5071e8b
BLAKE2b-256 checksum
How to use checksums
2839e38aeaf6748f2b1fbd0f7663166baffafd9e798b78ca9cdf24643cd2e48c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.1.0

1 release file

1.0.0

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

This release

0.2.0 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page