Metadata-Version: 2.4
Name: pyrofile
Version: 0.2.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS
Requires-Dist: pytest>=7 ; extra == 'dev'
Requires-Dist: torch>=2.0 ; extra == 'dev'
Provides-Extra: dev
License-File: LICENSE
Summary: File-like object for accessing local and cloud storage
Author-email: Nate Prewitt <nate.prewitt@gmail.com>
License: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/nateprewitt/pyrofile
Project-URL: Issues, https://github.com/nateprewitt/pyrofile/issues
Project-URL: Source, https://github.com/nateprewitt/pyrofile

# pyrofile

File-like object for accessing local and cloud storage.
Built in Rust with growing support for major cloud storage platforms.

## Install

```bash
pip install pyrofile
```

## Usage

```python
from pyrofile import PyroFile

# Local filesystem
with PyroFile("/tmp/model.pt", "w") as f:
    f.write(data)

with PyroFile("/tmp/model.pt", "r") as f:
    data = f.read()

# Azure Blob Storage
with PyroFile("az://account/container/model.pt", "w") as f:
    f.write(data)
```

Works with `torch.save` and `torch.load`:

```python
import torch
from pyrofile import PyroFile

with PyroFile("az://account/container/checkpoint.pt", "w") as f:
    torch.save(model.state_dict(), f)

with PyroFile("az://account/container/checkpoint.pt", "r") as f:
    state = torch.load(f, weights_only=True)
```

## Backends

| Backend | URI scheme | Status |
|---------|-----------|--------|
| Local filesystem | `/path/to/file` | Stable |
| Azure Blob Storage | `az://account/container/blob` | Preview |
| Amazon S3 | `s3://bucket/key` | Planned |
| Google Cloud Storage | `gs://bucket/object` | Planned |

## Development

```bash
python -m venv .venv && source .venv/bin/activate
python -m pip install maturin pytest
maturin develop --release --features azure
cargo test --lib
python -m pytest tests/python/test_local.py
python -m pytest tests/python/test_azure_integration.py
```

