hanzo-async
Unified async I/O for Hanzo AI - high-performance with uvloop fallback.
Features
- Automatic uvloop configuration - Falls back to asyncio on Windows
- Async file I/O - Read, write, append with aiofiles
- Async path operations - exists, is_file, mkdir, etc.
- Async subprocess execution - run_command, run_shell
- Consistent patterns - Same API across all Hanzo packages
Installation
pip install hanzo-async
# With uvloop support (recommended for macOS/Linux)
pip install hanzo-async[uvloop]
Quick Start
from hanzo_async import (
# Loop configuration
configure_loop,
using_uvloop,
# File operations
read_file,
write_file,
read_json,
write_json,
# Path operations
path_exists,
is_file,
is_dir,
mkdir,
# Process operations
run_command,
run_shell,
)
# Check if using uvloop
if using_uvloop():
print("Using uvloop for high-performance async")
# Async file operations
async def example():
# Read/write files
content = await read_file("/path/to/file.txt")
await write_file("/path/to/output.txt", content)
# JSON handling
data = await read_json("/path/to/config.json")
data["updated"] = True
await write_json("/path/to/config.json", data)
# Path operations
if await path_exists("/path/to/file"):
if await is_file("/path/to/file"):
await unlink("/path/to/file")
await mkdir("/path/to/new/dir", parents=True, exist_ok=True)
# Run commands
stdout, stderr, code = await run_command("ls", "-la")
stdout, stderr, code = await run_shell("echo $HOME && pwd")
API Reference
Loop Configuration
configure_loop()- Configure uvloop (auto-called on import)using_uvloop()- Check if uvloop is activeget_loop()- Get current event loop
File Operations
read_file(path)- Read file contentwrite_file(path, content)- Write content to fileappend_file(path, content)- Append to fileread_json(path)- Read and parse JSONwrite_json(path, data)- Write JSON to fileread_lines(path)- Read file as lineswrite_lines(path, lines)- Write lines to fileread_bytes(path)- Read file as byteswrite_bytes(path, content)- Write bytes to file
Path Operations
path_exists(path)- Check if path existsis_file(path)- Check if path is fileis_dir(path)- Check if path is directorymkdir(path, parents=False, exist_ok=False)- Create directoryrmdir(path)- Remove empty directoryunlink(path, missing_ok=False)- Remove filestat(path)- Get file/directory statslistdir(path)- List directory contentsglob(pattern, root_dir=None, recursive=False)- Find filesrename(src, dst)- Rename/move filecopy(src, dst)- Copy filecopytree(src, dst)- Copy directory treermtree(path)- Remove directory tree
Process Operations
run_command(*args)- Run command with argsrun_shell(command)- Run shell commandcheck_command(command)- Check if command existswhich(command)- Find command pathstart_background(*args)- Start background process
Why hanzo-async?
- Consistent async patterns - All Hanzo packages use the same I/O patterns
- High performance - uvloop provides 2-4x faster async on Unix
- Automatic fallback - Works on Windows with standard asyncio
- No event loop blocking - All operations are truly async
- Easy to use - Simple function-based API
License
MIT
Metadata
Release files for hanzo-async 0.1.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 | Actions |
|---|---|---|---|---|
| hanzo_async-0.1.3.tar.gz | 8.6 kB | Without provenance | Details for hanzo_async-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hanzo_async-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for hanzo_async-0.1.3-py3-none-any.whl |
Total release size: 17.3 kB
Release files / hanzo_async-0.1.3.tar.gz
| Download URL | hanzo_async-0.1.3.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47180370268cd1f3be3f3b8f20f4de38f3123c5031f1dcdba114a610c4fb8840
|
|
BLAKE2b-256 checksum How to use checksums |
ba2cfd628adf5bce8a36559f8b867f35876d3938b9869b9c5e410072f36d09ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / hanzo_async-0.1.3-py3-none-any.whl
| Download URL | hanzo_async-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c5b17469b612b9994a04d986295600b8cc7b22ea3e7fc9ff34107a20ba1f0c1
|
|
BLAKE2b-256 checksum How to use checksums |
d8dc6f30fdefa0ef99b89d8edb7c1af3f1d480d2c4dbaffd705235de1105547d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for hanzo-async 0.1.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.