Metadata-Version: 2.4
Name: crabxl
Version: 0.1.2
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
Requires-Dist: ruff>=0.16.10,<0.17 ; extra == 'dev'
Requires-Dist: pytest>=9.1.1,<10 ; extra == 'test'
Requires-Dist: openpyxl==3.1.5 ; extra == 'test'
Requires-Dist: pillow>=12.3 ; extra == 'test'
Requires-Dist: lxml>=6.1.3 ; extra == 'test'
Provides-Extra: dev
Provides-Extra: test
License-File: LICENSE
Summary: Fast, low-memory Python library for reading, writing and editing Excel XLSX files, with the openpyxl API.
Keywords: xlsx,excel,spreadsheet,openpyxl
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/crabxl/crabxl-python/blob/main/CHANGELOG.md
Project-URL: Homepage, https://crabxl.com
Project-URL: Issues, https://github.com/crabxl/crabxl-python/issues
Project-URL: Repository, https://github.com/crabxl/crabxl-python

<div align="center">

# CrabXL for Python

**A Rust-powered XLSX library with an openpyxl-compatible interface.**

[![PyPI](https://img.shields.io/pypi/v/crabxl)](https://pypi.org/project/crabxl/)
[![Python](https://img.shields.io/badge/Python-3.11–3.15-blue?logo=python&logoColor=white)](https://pypi.org/project/crabxl/#files)
[![CI](https://github.com/crabxl/crabxl-python/actions/workflows/python.yml/badge.svg)](https://github.com/crabxl/crabxl-python/actions/workflows/python.yml)
[![License](https://img.shields.io/github/license/crabxl/crabxl-python)](LICENSE)

[Rust engine](https://github.com/crabxl/crabxl) · [Status](internal/STATUS.md) · [Report an issue](https://github.com/crabxl/crabxl-python/issues)

</div>

## About

CrabXL supports reading, creating, and editing XLSX files, including streaming
`read_only` and `write_only` modes. Supported calls follow openpyxl conventions:
use `import crabxl as openpyxl` to migrate compatible code. Processing runs in the
shared Rust engine; openpyxl is not a runtime dependency.

The public openpyxl 3.1.5 API is supported and the unchanged openpyxl test
suite passes for it. Before version 1.0, a minor version can change the API. Invalid input raises
explicit errors. Formula calculation is not provided. See the
[migration guide](docs/migration.md) and [supported features](docs/support.md).

## Installation

```sh
python -m pip install crabxl
```

Wheels are available for **CPython 3.11–3.15** on Linux x86_64/ARM64, Windows
x86_64, and macOS Intel/Apple Silicon. Python 3.15 validation currently uses its
release candidate. Source builds require Rust 1.99 or newer and Maturin.

## Usage

### Create and edit

```python
from crabxl import Workbook, load_workbook

book = Workbook()
sheet = book.active
sheet["A1"] = "Hello"
sheet.append([1, 2, 3])
book.save("example.xlsx")
book.close()

book = load_workbook("example.xlsx")
try:
    book.active["A1"] = "Updated"
    book.save("updated.xlsx")
finally:
    book.close()
```

### Streaming modes

```python
from crabxl import Workbook, load_workbook

book = load_workbook("input.xlsx", read_only=True)
try:
    for row in book.active.iter_rows(values_only=True):
        print(row)
finally:
    book.close()

book = Workbook(write_only=True)
sheet = book.create_sheet("Values")
sheet.append([1, "hello", "=A1+1"])
book.save("output.xlsx")
book.close()
```

Read-only mode streams bounded batches. Write-only mode spools rows to disk and
can be saved once; it does not support random cell access.

### Memory and compression

All save modes accept `compression_level`: **0** stores without compression,
**1–9** use Deflate, and the default is **6**.

```python
from crabxl import AutoMemory, ResourceOptions, SharedStringOptions, load_workbook

options = ResourceOptions(
    auto_memory=AutoMemory(maximum_bytes=64 * 1024**2),
    shared_strings=SharedStringOptions(storage="auto", cache_bytes=1024**2),
)
book = load_workbook("input.xlsx", resource_options=options)
try:
    book.active["A1"] = 42
    book.save("output.xlsx", compression_level=3)
finally:
    book.close()
```

Use `max_memory_bytes` for an explicit managed allowance, or `AutoMemory` to tune
Auto selection. `ResourceOptions` also exposes input limits, SST RAM/disk
strategies, cache and temporary-storage limits, and edit-overlay bounds.
Ordinary loaded workbooks share one retained allowance across source catalogs,
models, overlays and SST/cache; I/O working space remains additional. These
settings do not cap process RSS. See [memory limits](docs/guide/memory.md).

## Documentation

- [Quick start](docs/quick-start.md)
- [Migration from openpyxl](docs/migration.md)
- [Guide](docs/guide/tutorial.md), adapted from the openpyxl documentation
- [Compatibility](docs/compatibility.md): the openpyxl test suite results
- [Project status](internal/STATUS.md)
- [Changelog](CHANGELOG.md)

## Contributing

Read [CONTRIBUTING.md](CONTRIBUTING.md) before you open a pull request. Report
security problems as described in [SECURITY.md](SECURITY.md).

## License

Distributed under the [MIT License](LICENSE). Third-party notices and test
provenance are listed in [third_party](third_party).

