Skip to main content

ShortIO library is intended to avoid context manager boilerplate in simple io operations.

Project description

ShortIO

ShortIO library is intended to avoid context manager boilerplate in simple io operations. The library supports plain text, JSON, pickle and YAML (PyYAML impl).

Inspired by ilio.

Installation

pip install shortio

Usage

Plain text read & write:

from shortio import read, write

s = read('filename')
write('filename', s)

Binary data read & write:

from shortio import read, write

s = read('filename', 'rb')
write('filename', s, 'wb')

JSON data read & write:

from shortio import read_json, write_json

d = read_json('filename.json')
write_json('filename.json', d)

Pickle data read & write:

from shortio import read_pickle, write_pickle

d = read_pickle('filename.pkl')
write_pickle('filename.pkl', d)

YAML data read & write:

Since python does not support YAML out of the box you have to install PyYAML.

pip install PyYAML>=5.1
from shortio import read_yaml, write_yaml

d = read_yaml('filename.yaml')
write_yaml('filename.yaml', d)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for shortio, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size shortio-0.1.0-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page