Motivation
When you’re processing load test timings (or any latency distribution), you typically want buckets like p50/p95/p99 quickly. percently provides a small, fast Rust implementation exposed to Python.
Features
- Fast: Rust core
- Simple API: one call to compute a percentile
- Python-friendly: works with regular lists/iterables of floats
Installation
Using uv:
uv add percently
Using pip:
pip install percently
🧮 Usage
import percently
data = [10.5, 22.0, 18.7, 19.2, 30.1, 25.3]
# Calculate the 95th percentile (f64)
p95 = percently.percentile(data, 95)
print(f"95th percentile: {p95:.2f}")
Streaming (iterative) percentile estimates
If you have a generator/iterable and want running percentile estimates without loading all values into memory, use stream.
import percently
def timings():
for i in range(1, 1_000_001):
yield float(i % 10_000) / 10_000.0
# Yield an updated p95 estimate every 1000 samples (approximate, bounded memory)
for est in percently.stream(timings(), 95, every=1000):
last = est
print("final approx p95:", last)
Notes:
stream(..., 0, ...)yields the running min (exact)stream(..., 100, ...)yields the running max (exact)- All values must be finite floats (no NaN/inf)
Development
Build/install locally (editable) with maturin:
uv sync
uv run maturin develop
Releasing
This repo is configured for signed release commits/tags and tag-based publishing:
- Create a signed tag (e.g.
0.1.4) - GitHub Actions (tag-triggered) builds wheels/sdist and publishes to PyPI
Recommended (cargo-style) tool: cargo-release
cargo install cargo-release
# Patch release: bumps Cargo.toml version, commits (signed), creates signed tag, pushes
cargo release patch --execute
License
MIT — see LICENSE.
Metadata
Release files for percently 0.1.4
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 |
|---|---|---|---|---|
| percently-0.1.4.tar.gz | 68.4 kB | Without provenance | Details for percently-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| percently-0.1.4-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details for percently-0.1.4-cp312-cp312-macosx_11_0_arm64.whl |
Total release size: 270.0 kB
Release files / percently-0.1.4.tar.gz
| Download URL | percently-0.1.4.tar.gz |
|---|---|
| Size | 68.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1233c61c94e002ea659ed8ac34f0b397b24ba69703e34454d6cd0bb7c17c82ad
|
|
BLAKE2b-256 checksum How to use checksums |
ff4ad9b41795758ea340e2ea13af2a2097e4d36abd1fa8ece2557b8dbc7bdb9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / percently-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | percently-0.1.4-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 201.5 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
993b07d643cf305c58672567e16470aa6e01eb0fb9078844a967ba19158e93f4
|
|
BLAKE2b-256 checksum How to use checksums |
cd11a7cb2f17da40c522936ecce49716a8baaccb2546aefb481e7f755549c49b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Security for percently 0.1.4
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.