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()

Checksum:

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

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.

License

MIT

Download files

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

Source Distribution

iokit-0.5.0.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

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

iokit-0.5.0-py3-none-any.whl (51.8 kB view details)

Uploaded Python 3

File details

Details for the file iokit-0.5.0.tar.gz.

File metadata

  • Download URL: iokit-0.5.0.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for iokit-0.5.0.tar.gz
Algorithm Hash digest
SHA256 82adf00d6da4e1e68eeb79a9449d4dc731ca951bede06a77cb52dc1c21c1ec22
MD5 01b33d9569d82bb6a05e65e174e89418
BLAKE2b-256 476fb58c0b4b896a59b21ccd603ee236b6d19d28737830fb1bce6760939fff4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for iokit-0.5.0.tar.gz:

Publisher: publish.yml on rilshok/iokit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iokit-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: iokit-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 51.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for iokit-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b952304335633cd662961e2dfe707d6ba221c3eaf847194ecf5766c5be566dd5
MD5 25430f03c2017be6bd228cb37ec3f9eb
BLAKE2b-256 810de9b5aea13849343f4595e3aa3b3673295c363b3898ccfa18e8fd35f7144f

See more details on using hashes here.

Provenance

The following attestation bundles were made for iokit-0.5.0-py3-none-any.whl:

Publisher: publish.yml on rilshok/iokit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.2

2 files

0.5.1

2 files

This release

0.5.0 This release

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

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