Metadata-Version: 2.4
Name: pafex
Version: 2.3
Summary: Minimal checksummed binary configuration handling.
Author-email: redomaitic <redomaitic@gmail.com>
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

Minimal checksummed binary configuration handling for Python. `Config`
layers user settings over `DEFAULT_CONFIG`; `load_config`/`save_config`
persist to a strict binary format with optional gzip/xz/zlib compression.
Standard library only.

## Install

```bash
pip install pafex
```

## Usage

```python
from pafex import Config, load_config, save_config

cfg = Config({'strict_mode': True, 'allowed_tags': {'p', 'a'}})
cfg.get('strict_mode')                    # True
cfg.get('strip_whitespace')               # default from DEFAULT_CONFIG
cfg.update({'max_depth': 3})              # new Config, original untouched

save_config(cfg, 'default.config', compression='gzip')
loaded = load_config('default.config')
loaded == cfg                             # True
```

Config file layout:

```
raw:   [8-byte MD5 checksum][4-byte size][config]
gzip:  [8-byte MD5 checksum][4-byte size][gzip.compress(config)]
xz:    [8-byte MD5 checksum][4-byte size][lzma.compress(config)]
zlib:  [8-byte MD5 checksum][4-byte size][zlib.compress(config)]
```

Writes are atomic (temp file + `os.replace`). With no explicit
path, `load_config`/`save_config` locate the caller's `default.config`
(caller's module directory first, then the package directory).

Errors raise `PafexError` subclasses: `ConfigLoadError` (read/parse
failures), `ConfigChecksumError` (integrity mismatch) and
`ConfigDecompressError` (corrupt compressed payload).
