Input Output Kit
Project description
I/O Kit Python Library
IOKit is a Python library that offers a suite of utilities for managing a wide range of input/output operations. Central to its design is the concept of a State, where each state signifies a unit of data that can be loaded, saved, or transformed. Each state corresponds to a valid file state, represented as a bytes-like object.
IOKit abstracts and unifies serialization and deserialization operations from various libraries into a single, cohesive interface. This allows for direct manipulation of the file's state in memory, eliminating the need for disk interaction. Consequently, it facilitates the (de)serialization of data in multiple formats, such as json, yaml, txt, tar, gzip, among others. This abstraction not only simplifies data handling but also enhances efficiency by reducing disk I/O operations.
Installation
You can install the IOkit library using pip:
pip install iokit
Usage
Here are some examples of how to use the I/O Kit library:
Text File Handling
from iokit import Txt
text = "Hello, World!"
state = Txt(text, name="text")
print(state)
print(state.load())
text.txt (13B)
Hello, World!
JSON
from iokit import Json
data = {"key": "value"}
state = Json(data, name="single")
print(state)
print(state.load())
single.json (16B)
{'key': 'value'}
YAML
from iokit import Yaml
data = {"key": "value"}
state = Yaml(data, name="single")
print(state)
print(state.load())
single.yaml (11B)
{'key': 'value'}
GZip Compression
from iokit import Txt, Gzip
data = "Hello, World! "* 1000
state = Gzip(Txt(data, name="data"))
print(state)
print(len(state.load().load()))
data.txt.gz (133B)
14000
Tar Archive
from iokit import Tar, Txt
state1 = Txt("First file", name="text1")
state2 = Txt("Second file", name="text2")
archive = Tar([state1, state2], name="archive")
states = archive.load()
print(states)
print(states[0].load())
print(states[1].load())
[text1.txt (10B), text2.txt (11B)]
First file
Second file
Find State
from iokit import Tar, find_state
state1 = Txt("First file", name="text1")
state2 = Txt("Second file", name="text2")
archive = Tar([state1, state2], name="archive")
state = find_state(archive.load(), "?e*2.txt")
print(state.load())
Second file
Byte input handling
from iokit import State
state = State(b"{\"first\": 1, \"second\": 2}", name="data.json")
print(state.load())
{'first': 1, 'second': 2}
Contributing
Contributions to the IOkit library are welcome. Please feel free to submit a pull request or open an issue on the GitHub repository.
License
The IOkit library is licensed under the MIT License. You can use it for commercial and non-commercial projects without any restrictions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iokit-0.3.4.tar.gz.
File metadata
- Download URL: iokit-0.3.4.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc49841b309f3aa4512ad3b10848606d16a875f528d1a5f2374bc06721f5d949
|
|
| MD5 |
9d291061fc6dad7dabcccf0b324ae928
|
|
| BLAKE2b-256 |
c2e700e2cf9a9c98254a598b9fe4ef6afbef05c93ec127be4847255ede377bba
|
Provenance
The following attestation bundles were made for iokit-0.3.4.tar.gz:
Publisher:
publish.yml on rilshok/iokit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iokit-0.3.4.tar.gz -
Subject digest:
cc49841b309f3aa4512ad3b10848606d16a875f528d1a5f2374bc06721f5d949 - Sigstore transparency entry: 208519159
- Sigstore integration time:
-
Permalink:
rilshok/iokit@04d1b3637c2dbd5ef15e47bed33fb6675cba966c -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/rilshok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@04d1b3637c2dbd5ef15e47bed33fb6675cba966c -
Trigger Event:
push
-
Statement type:
File details
Details for the file iokit-0.3.4-py3-none-any.whl.
File metadata
- Download URL: iokit-0.3.4-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8f8436551681a35440c2d147363b25d3ad4997acbfb7780fd29dd2d0dd187a3
|
|
| MD5 |
18c9f22d507b06a7f1cb3a1ae6ed9308
|
|
| BLAKE2b-256 |
8fc7488868456cc31a5b309ef0d27d55ed8d344bec3d438f7b35959c82efc962
|
Provenance
The following attestation bundles were made for iokit-0.3.4-py3-none-any.whl:
Publisher:
publish.yml on rilshok/iokit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iokit-0.3.4-py3-none-any.whl -
Subject digest:
c8f8436551681a35440c2d147363b25d3ad4997acbfb7780fd29dd2d0dd187a3 - Sigstore transparency entry: 208519162
- Sigstore integration time:
-
Permalink:
rilshok/iokit@04d1b3637c2dbd5ef15e47bed33fb6675cba966c -
Branch / Tag:
refs/tags/v0.3.4 - Owner: https://github.com/rilshok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@04d1b3637c2dbd5ef15e47bed33fb6675cba966c -
Trigger Event:
push
-
Statement type: