Metadata-Version: 2.5
Name: a-kits
Version: 0.0.2
Summary: Split any iterable into fixed-size or evenly sized batches.
Project-URL: Homepage, https://github.com/lqxnjk/a-kits
Author: lqxnjk
License: MIT
License-File: LICENSE
Keywords: batch,chunk,iterable,pagination,split
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# a-kits

Two ways to cut a sequence into batches: by fixed size, or into a fixed number
of near-equal parts. Useful for pagination, bulk API calls and worker sharding.

## Install

```console
pip install a-kits
```

## Usage

```python
from a_kits import split_equal, split_fixed

split_fixed(range(5), 2)      # [[0, 1], [2, 3], [4]]
split_equal(range(7), 3)      # [[0, 1, 2], [3, 4], [5, 6]]
split_equal([1, 2], 3)        # [[1], [2], []]
```

## Guarantees

| Function | Guarantee |
| --- | --- |
| `split_fixed` | every part except the last has exactly `m_batch` items |
| `split_equal` | exactly `m_share` parts, sizes differ by at most one, order preserved |

Both accept any iterable and return lists. A non-positive size raises
`ValueError` instead of silently returning something useless.

## License

MIT
