pyeio | pypi
- Description: Drop-in replacement for standard
iomodule with some extra utilities. - Purpose: Solves having to constantly
with openstuff. - Notes: Full docs may be added at some later point, along with some other file formats perhaps.
Install
pip install pyeio
or
uv add pyeio
Usage
import pyeio as io
Everything should work the same as io, but with the following additions:
Extra IO Functions
io.read
Read file content as string (utf-8) or bytes.
# Read as string (default)
content = io.read("file.txt")
# Read as bytes
data = io.read("file.bin", bytes)
io.write
Write string or bytes to a file. Raises an error if the file already exists unless overwrite=True.
# Write string
io.write("file.txt", "Hello, world!")
# Write bytes
io.write("file.bin", b"\x00\x01\x02")
# Overwrite existing file
io.write("file.txt", "New content", overwrite=True)
io.append
Append string or bytes to the end of a file.
# Append string
io.append("file.txt", "\nAnother line")
# Append bytes
io.append("file.bin", b"\x03\x04")
Formats
Additionally, json, toml, and yaml are included, with overloads/generics for handling pydantic models. Each of these exposes a read, and write function which more or less works the exact same way, along with a parse and serialize function.
Here are some examples:
# Read JSON file
data = io.json.read("config.json")
# Read JSON file into a Pydantic model
user = io.json.read("user.json", UserModel)
# Write JSON to file
io.json.write("output.json", {"key": "value"})
# Write with pretty printing
io.json.write("output.json", data, overwrite=True, indent=True)
# Parse JSON string/bytes
data = io.json.parse('{"key": "value"}')
user = io.json.parse(json_bytes, UserModel)
# Serialize to string/bytes
json_bytes = io.json.serialize(data) # returns bytes by default
json_str = io.json.serialize(data, str)
Metadata
Release files for pyeio 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyeio-0.2.3.tar.gz | 109.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyeio-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 128.4 kB
Release files / pyeio-0.2.3.tar.gz
| Download URL | pyeio-0.2.3.tar.gz |
|---|---|
| Size | 109.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f425aec549a57506af27594813e5411bfb33aba764c0e5a483bc9ae604a13f8
|
|
BLAKE2b-256 checksum How to use checksums |
350a7548d9148261a8f7b5c15595414b370c742c699d0eb6d7d560e2d1b0773c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.4
|
Release files / pyeio-0.2.3-py3-none-any.whl
| Download URL | pyeio-0.2.3-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3551f3e6748c1e01ccbb127f1ea6c3066ce897e43d527ddebbdf3d0af2746d3f
|
|
BLAKE2b-256 checksum How to use checksums |
024af63a014371bf327fb18d081ca4569d9ad3dcb140aa90466a5664f898e026
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.4
|
Security for pyeio 0.2.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.