This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Mutable record type for dealing with flat files like CSV or pipe delimited data.

Dealing with flat files is painful. Instead, use vinyl to declaratively describe and validate common flat file formats. Vinyl gives you the convenience of attribute-style access like a namedtuple, but in a mutable data type suitable for easily transforming data.

import os
import csv
from vinyl.record import Record
from vinyl.fields import VarCharField, FixedCharField

# declare the data format
class TestRecord(Record):
    customer_name = VarCharField(max_length=50)
    customer_number = FixedCharField(field_length=10, pad_with='0', justify='right' )
    start_time = FixedCharField(value='00:00:00', field_length=8)

# create an instance
record = TestRecord()

# read data from a file
with open(os.path.join(os.path.dirname(__file__), 'example.txt')) as f:
    reader = csv.reader(f)
    # copy a row of CSV data to the recordinstance
    record._load(*reader.next())

    # check the name was read correctly
    assert record.customer_name == 'a customer name with max length=50'

    # set a different customer number
    record.customer_number = '3'

    # number is reformatted according to the field settings
    assert record.customer_number == '0000000003'

    # a static field
    assert record.start_time == '00:00:00'

    print repr(record)
    # >>> TestRecord(customer_name=u'a customer name with max length=50',
    #                customer_number=u'0000000003', start_time=u'00:00:00')

Support

For issues and source control, use github:

https://github.com/mrj0/vinyl/

Release History

Release History

0.6

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
vinyl-0.6.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Dec 14, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting