Metadata-Version: 2.4
Name: cfb
Version: 0.9.3
Summary: Microsoft Compound File Binary File Format IO
Author-email: Alex Rembish <alex@rembish.org>
License-Expression: BSD-2-Clause
Project-URL: Homepage, https://github.com/rembish/cfb
Project-URL: Repository, https://github.com/rembish/cfb
Project-URL: Changelog, https://github.com/rembish/cfb/blob/master/CHANGELOG.md
Project-URL: Issues, https://github.com/rembish/cfb/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
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: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: typing_extensions
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black>=24; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pre-commit>=3; extra == "dev"
Requires-Dist: tox>=4; extra == "dev"
Requires-Dist: build>=1; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Dynamic: license-file

# cfb

Read-only access to Microsoft Compound File Binary (CFB/OLE2) files from Python.

## Installation

```bash
pip install cfb
```

### Development

```bash
make install     # create .venv and install with dev dependencies
```

## Usage

```python
from cfb import CfbIO
from cfb.directory.entry import SEEK_END

doc = CfbIO("tests/data/simple.doc")

# Read the root entry buffer.
root = doc.root
print(root.read())

# Access entries by name and seek within them.
entry = doc["1Table"]
entry.seek(100, SEEK_END)
print(entry.read(100))

# Access entries by directory ID.
sibling = doc[1].left
sibling.seek(0)
print(sibling.read(64))
```

All objects are lazy-loaded, so opening a large file only reads data when
you explicitly access it.

## Development

```bash
make install     # create .venv and install all dev dependencies
make format      # run black
make lint        # run ruff
make typecheck   # run mypy
make test        # run pytest with coverage
make tox         # run tests across Python 3.8, 3.10, and 3.12
make clean       # remove build artefacts and the virtualenv
```

## License

BSD 2-Clause — see `LICENSE.txt`.
