Skip to main content

iokit

Python library for serialization and file operations. Unifies multiple format codecs (JSON, YAML, Tar, etc.) with a single State interface that combines data, path, and timestamp.

Installation

Base install covers txt, bin, dat, json, gz, zip, tar:

pip install iokit

For all formats and web download support:

pip install iokit[ultra]

Missing formats will tell you what to install:

from iokit import Yaml
Yaml({"key": "value"}, "file")
ModuleNotFoundError: Missing required packages: PyYAML>=6.0.1. Install with: pip install PyYAML

Quick Start

Work with data as States. Each State carries the data, a path, and a timestamp. Load and save without thinking about formats.

JSON file:

from iokit import Json

state = Json({"key": "value"}, path="config.json")
print(state.path)      # config.json
print(state.size)      # 16
print(state.load())    # {'key': 'value'}

Text file:

from iokit import Txt

state = Txt("Hello, World!", "message")
state.save("/tmp/data", parents=True)

Load any file from disk:

from iokit import file

state = file("/path/to/file.txt")
content = state.load()

Common Operations

Chain transformations:

from iokit import Txt

state = Txt("Secret data", "notes")
encrypted = state.encrypt(password="secret")
compressed = encrypted.gzip()
compressed.save("/tmp")

Load compressed:

loaded = encrypted.load(password="secret").load()

Archives:

from iokit import Tar, Txt

file1 = Txt("First", "a")
file2 = Txt("Second", "b")

archive = Tar([file1, file2], "bundle")
states = list(archive.load())

Find states by pattern:

from iokit import filtrate, first

results = filtrate(archive.load(), "*.txt")
first_match = first(archive.load(), "a*")

Download:

from iokit import web

state = web("https://example.com/data.json", Json)
data = state.load()

A data: URL is decoded where it stands, without reaching the network. It carries no name for its payload, so the state is left with the bare extension of its media type:

state = web("data:application/json;base64,eyJhIjogMX0=")
assert state.path == ".json"
assert state.load() == {"a": 1}

Checksum:

state.digest("sha256").base64
state.digest("xxh128").base64url

Payloads of your own, filed under a format that knows nothing of them:

from dataclasses import dataclass
from typing import Any

from iokit import Json


@dataclass
class Person:
    name: str
    age: int


class PersonJson(Json[Person]):
    def dump(self, data: Person) -> dict[str, Any]:
        return {"name": data.name, "age": data.age}

    def parse(self, data: dict[str, Any]) -> Person:
        return Person(data["name"], data["age"])


state = PersonJson(Person("Joe", 32), "joe")
print(state.path)    # joe.json
print(state.load())  # Person(name='Joe', age=32)

The file stays an ordinary joe.json, and state.load() is a Person both at runtime and for the type checker. Every format takes the same pair: Txt, Csv, Npy, and the rest.

Storage

Store and retrieve records by uid:

from iokit.storage import LocalStorage

storage = LocalStorage("/data")
storage.push("records/data.json", data)

loaded = storage.pull("records/data.json")
storage.remove("records/data.json")

for uid in storage.index(prefix="records/"):
    print(uid)

State-aware storage with automatic encoding:

from iokit.storage import StateStorage

storage = StateStorage(
    LocalStorage("/data"),
    compression=6,
    password="secret"
)

storage.push("file.json", {"data": 123})
result = storage.pull("file.json")

Contributing

Found a bug or have an idea? Open an issue or submit a pull request.

Metadata

Release files for iokit 0.6.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 iokit 0.6.0
File Size Uploaded Provenance Actions
iokit-0.6.0.tar.gz 41.7 kB With provenance Details for iokit-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iokit 0.6.0
File Interpreter ABI Platform Actions
iokit-0.6.0-py3-none-any.whl Python 3 none any Details for iokit-0.6.0-py3-none-any.whl

Total release size: 98.7 kB

Release files / iokit-0.6.0.tar.gz

Download URL iokit-0.6.0.tar.gz
Size 41.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8fc2e2a3953c6d81bb878f117641e8c4b781702498838e12eccb19e0746f0a60
BLAKE2b-256 checksum
How to use checksums
64ffe7cd2f523dd0d6a50512964836f59e4bac5590274aedd91ccbd6df5de770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / iokit-0.6.0-py3-none-any.whl

Download URL iokit-0.6.0-py3-none-any.whl
Size 57.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e144c1b4be4b85b669c238ce22a37153c960033b30c8728e343cc206e13a4643
BLAKE2b-256 checksum
How to use checksums
aee550d4179c4fe44453c9e50d99630b75134902759d373876bb7b7a1a4cbc45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Security for iokit 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for iokit-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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