Metadata-Version: 2.4
Name: getarcx
Version: 0.1.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
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: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Summary: Python bindings for the ARCX archive format — fast selective extraction
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# arcx

Python bindings for the [ARCX](https://github.com/highpass-studio/arcx) archive format. Native Rust speed via PyO3.

## Install

```bash
pip install arcx
```

### Build from source

Requires Rust toolchain and [maturin](https://github.com/PyO3/maturin):

```bash
pip install maturin
maturin develop --release
```

## Usage

### Pack a directory

```python
import arcx

arcx.pack("my_project/", "my_project.arcx")
```

### Get a single file

```python
data = arcx.get("archive.arcx", "src/main.rs")
print(len(data), "bytes")
```

### List files

```python
files = arcx.list("archive.arcx")
for f in files:
    print(f["path"], f["size"], f["sha256"])
```

### Extract all files

```python
arcx.extract("archive.arcx", "output_dir/")
```

### Archive info

```python
info = arcx.info("archive.arcx")
print(f"{info['files']} files, {info['blocks']} blocks, ratio={info['ratio']:.1%}")
```

### Archive class (context manager)

For multiple operations on the same archive, use the `Archive` class to keep the manifest cached in memory:

```python
with arcx.Archive("archive.arcx") as ar:
    data = ar.get("src/main.rs")
    files = ar.list()
    ar.extract("output/")
    info = ar.info()
```

## API Reference

### Functions

| Function | Description |
|----------|-------------|
| `arcx.pack(input_dir, output)` | Pack a directory into an `.arcx` archive |
| `arcx.get(archive, file_path) -> bytes` | Extract a single file as bytes |
| `arcx.list(archive) -> list[dict]` | List files (each dict has `path`, `size`, `sha256`) |
| `arcx.extract(archive, output_dir)` | Extract all files to a directory |
| `arcx.info(archive) -> dict` | Archive metadata (`files`, `blocks`, `chunks`, `ratio`, etc.) |

### Archive class

| Method | Description |
|--------|-------------|
| `Archive(path)` | Open an archive (use as context manager) |
| `.get(file_path) -> bytes` | Extract a single file |
| `.list() -> list[dict]` | List all files |
| `.extract(output_dir)` | Extract all files |
| `.info() -> dict` | Archive metadata |

## License

MIT

