Metadata-Version: 2.4
Name: rahuketu
Version: 0.1.0
Summary: Zero-free encoding framework: signed bijective numeration (Rahu) and arithmetic coding (Ketu).
Project-URL: Homepage, https://github.com/DecipherPunk/rahuketu
Author-email: Ramakrishnan <human@setc.dev>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: arithmetic-coding,bijective-numeration,encoding,rahuketu
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# rahuketu

rahuketu is a small zero-free encoding package. It combines a signed bijective
number path (Rahu) with an arithmetic-coding path (Ketu), and records both as a
log-space trace. Pure Python, no dependencies.

## Install

```
pip install rahuketu
```

## Usage

```python
from rahuketu import Alphabet, roundtrip, trace

ab = Alphabet.lowercase()

r = roundtrip("hello", ab)
assert r["agrees"]            # encode -> decode is lossless

steps = trace("hello", ab)
last = steps[-1]
print(last.tau, last.upsilon, last.redundancy)
```

## Components

- `Alphabet` - no-zero symbol/digit mapping (digits in `[1, b]`).
- `Rahu` - signed bijective numeration (`RahuState`, `rahu_encode`, `rahu_decode`).
- `Ketu` - arithmetic coding as `(midpoint, scale)` (`KetuState`, `ketu_encode`, `ketu_decode`).
- `trace` - records `(tau, upsilon, a)` over the input.
- `roundtrip` - checks lossless encode/decode.

## Provenance / AI assistance

Built by Ramakrishnan (ORCID 0009-0006-0905-7275). Signed and bijective
numeration and arithmetic coding are classical methods. The zero-free Rahu-Ketu
framing and this implementation are original. AI tools helped with tests,
automation, and QA. The idea and direction are the author's.

## License

Apache-2.0. See `LICENSE` and `NOTICE`.
