batch-evenly
Distribute items into evenly-sized batches.
Installation
pip install batch-evenly
Usage
from batch_evenly import batch_evenly
# Distribute 10 items into 3 batches of at most 4 items each
for i, batch in batch_evenly(range(10), max_batch_size=4):
print(f"Batch {i+1} ({len(batch)} items): {batch}")
# Output:
# Batch 1 (4 items): [0, 1, 2, 3]
# Batch 2 (3 items): [4, 5, 6]
# Batch 3 (3 items): [7, 8, 9]
Features
- Yields evenly sized batches (e.g. in the example,
[4, 3, 3]instead of[4, 4, 2]) - Works with any iterable
- Optional support for batching Pandas DataFrames by row iteration
- Zero required dependencies
License
MIT
Metadata
Release files for batch-evenly 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| batch_evenly-0.1.0.tar.gz | 52.4 kB | Without provenance | Details for batch_evenly-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| batch_evenly-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for batch_evenly-0.1.0-py3-none-any.whl |
Total release size: 56.2 kB
Release files / batch_evenly-0.1.0.tar.gz
| Download URL | batch_evenly-0.1.0.tar.gz |
|---|---|
| Size | 52.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b3dcaf3112a01fad8a36912b2ceab312d0af37fd0ef1c636e293ea6f9b6bc87
|
|
BLAKE2b-256 checksum How to use checksums |
1f5673cff4fb434b1db85f5c56607eebeddccbdecc1d9614efbe4b07aa03479d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / batch_evenly-0.1.0-py3-none-any.whl
| Download URL | batch_evenly-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f157463ee9e19afdb65bf4019bda122d3ba312c6a5f3e2aa1f1faf043e44229a
|
|
BLAKE2b-256 checksum How to use checksums |
8096c22bda9bdb07e486cdcf25eb816909c47f91b573c0568852a423420f964a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for batch-evenly 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.