Skip to main content

Easiest-possible IO for basic file types.

Project description

dummio

IO for dummies! We make IO as easy as possible by providing a unified save/load interface, using the most common and recommendable default options for IO between various object types and file types. (Users may pass additional keyword arguments to the underlying IO methods.)

Simple IO calls

dummio simplifies IO calls for some file types. For example, instead of

with open(file_path, 'r', encoding='utf-8') as file:
    data = json.load(file)

you can simply

data = dummio.json.load(file_path)

Standardized IO interface

In some coding applications it is desirable to pass an IO module as an argument to a function. Here it is convenient to pass a dummio submodule, since all dummio submodules have the same save and load interface, having equivalent signatures (except for differences hidden in **kwargs).

Supported object and file types

So far we support:

  • text, pickle, and dill
  • simple dictionaries:
    • json
    • yaml
  • pandas dataframes:
    • csv
    • feather
    • parquet
  • onnx.ModelProto instances
  • pydantic models (relying on the built-in json serialization methods)

Filepaths passed to save and load methods can be of type str, pathlib.Path, or universal_pathlib.UPath such that many of these methods will "just work" against cloud paths like UPath("s3://bucket/key"), UPath("gs://bucket/key"), or UPath("az://container/key").

Dependencies

dummio has no required dependencies. For example, calling from dummio.pandas import df_parquet will raise a helpful message to install pandas if you have not already done so.

Examples

Basic IO methods can be accessed directly as dummio.text, dummio.json, etc:.

import dummio

text = "hello world"
data = {"key": text}
path = "io_example_file"

# Text
dummio.text.save(text, path=path)
assert text == dummio.text.load(path)

# YAML
dummio.yaml.save(data)
assert data == dummio.yaml.load(path)

Installation

We're on pypi, so pip install dummio.

If working directly on this repo, consider using the simplest-possible virtual environment.

Project details


Download files

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

Source Distribution

dummio-1.5.4.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dummio-1.5.4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file dummio-1.5.4.tar.gz.

File metadata

  • Download URL: dummio-1.5.4.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for dummio-1.5.4.tar.gz
Algorithm Hash digest
SHA256 091e3f9132e918f9ecbe5f45ad03171d76961216c7f2cfdeb011d9372769c3a4
MD5 63f920c9aab7554b145d33a0503e4a94
BLAKE2b-256 a4fd15ce480adb39ad9992ec48917c664066e9b06eb0f2de40a88e1414df6e22

See more details on using hashes here.

File details

Details for the file dummio-1.5.4-py3-none-any.whl.

File metadata

  • Download URL: dummio-1.5.4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for dummio-1.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3a8e1c5ad09efe47fab54ecf045e96fedcc2fd5e564c8384872042af828d9e1a
MD5 0be9caf372d24f2d1fbb6d8712aaf55b
BLAKE2b-256 2929c849b9e8a3a55a21c3e3c1014f7e795d63ab5c77576a9fa6c93c6bc8e059

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page