Flow metrics library for kanban forecasting
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
quando
See the justfile for common development commands (setup, testing, linting, etc.) using uv. Install just with uv pip install just if needed.
quando
Kanban flow metrics for Python. Answers the eternal question: "quando vai ficar pronto?" — when will it be done?
quando computes Service Level Expectations (SLE) and Monte Carlo forecasts from your team's historical delivery data.
This library was built to support the talk "Quando vai ficar pronto?", which walks through SLE and Monte Carlo forecasting for software teams using kanban.
Installation
pip install quando-forecast
Quick start
from datetime import date
from quando import Quando
# Historical delivery data: list of (start_date, end_date) tuples
items = [
(date(2024, 1, 1), date(2024, 1, 3)), # 3 days
(date(2024, 1, 5), date(2024, 1, 5)), # 1 day (same-day delivery)
(date(2024, 1, 8), date(2024, 1, 14)), # 7 days
# ... more historical items
]
w = Quando(items)
SLE — how long does one item take?
w.percentile(85) # → int: 85% of items finish within this many days
w.percentile(50) # → int: median lead time
sle = w.sle() # → SLE(p50=3, p85=7, p95=9)
sle.p85 # → int: named access
p50, p85, p95 = sle # or unpack as a tuple
Monte Carlo — forecasting multiple items
# How many days to deliver 10 items?
result = w.forecast_days(n_items=10)
result.percentile(85) # → int: days needed with 85% confidence
result.sle() # → SLE(p50=..., p85=..., p95=...)
result.distribution # → np.ndarray of raw simulation results (for plotting)
# How many items fit in a 2-week sprint?
result = w.forecast_items(n_days=10)
result.percentile(50) # → int: median items delivered in 10 days
Both methods accept num_simulations (default 10_000) and seed for reproducibility:
result = w.forecast_days(n_items=10, num_simulations=50_000, seed=42)
Loading from a CSV
w = Quando.from_csv("delivery_data.csv")
The CSV is expected to have started_at and finished_at columns (header is optional). Both date (2024-01-15) and datetime (2024-01-15 09:00:00) formats are accepted.
started_at,finished_at
2024-01-01,2024-01-03
2024-01-05,2024-01-05
2024-01-08,2024-01-14
Custom column names are supported:
w = Quando.from_csv("export.csv", started_col="start_date", finished_col="end_date")
API
Quando(items)
Constructs a flow dataset from a sequence of (start, end) tuples.
startandendcan bedatetime.dateordatetime.datetime(time component is ignored)- Lead time is counted in calendar days inclusive: same-day = 1, Mon→Fri = 5
- Raises
ValueErrorifitemsis empty or any tuple hasend < start
Quando.from_csv(path, *, started_col="started_at", finished_col="finished_at")
Constructs from a CSV file. Handles mixed date/datetime formats and drops unparseable rows.
.lead_times -> list[int]
The computed lead time in calendar days for each item.
.throughput -> np.ndarray
Items delivered per calendar day across the full date range, including zero-throughput days. Used internally by the Monte Carlo methods.
.percentile(p: float) -> int
Returns the p-th percentile of the lead time distribution, ceiling-rounded. p is 0–100 (e.g. 85, not 0.85).
.sle() -> SLE
Returns SLE(p50, p85, p95) — the three standard confidence thresholds. Can be unpacked or accessed by name (.p50, .p85, .p95).
.forecast_days(n_items, *, num_simulations=10_000, seed=None) -> SimulationResult
Monte Carlo simulation: given n_items to deliver, returns the distribution of how many days it will take. Samples from the historical daily throughput distribution, accumulating until n_items are done.
.forecast_items(n_days, *, num_simulations=10_000, seed=None) -> SimulationResult
Monte Carlo simulation: given a fixed n_days window, returns the distribution of how many items can be delivered. Useful for sprint planning.
SimulationResult
Returned by both forecast methods.
| Attribute / Method | Description |
|---|---|
.distribution |
np.ndarray of raw simulation results — use for histograms or custom analysis |
.percentile(p) |
p-th percentile of the simulation, ceiling-rounded |
.sle() |
Convenience SLE(p50, p85, p95) from the simulation |
repr(result)
# SimulationResult(p50=8, p85=12, p95=15, n=10000)
What is SLE?
A Service Level Expectation is a probabilistic commitment based on past performance: "X% of our work items finish within N days."
"Our SLE is 7 days @ 85% confidence"
→ 85% of items in our history finished in 7 days or fewer.
P85 is the recommended default for external commitments — it gives a 15% error rate by design, which is honest and achievable. P50 is useful internally; P95 for high-stakes items.
What is Monte Carlo forecasting?
Monte Carlo simulation answers questions about groups of items by repeatedly sampling from your historical throughput distribution. Each run simulates a possible future; after thousands of runs, the distribution of outcomes tells you the probability of hitting a deadline.
forecast_days(n_items=10)→ "With 85% confidence, 10 items will take N days"forecast_items(n_days=10)→ "With 85% confidence, we'll deliver N items in a 2-week sprint"
Zero-throughput days (weekends, interruptions) are included in the sampling pool, which produces honest, conservative estimates.
Related
- quando-vai-ficar-pronto — the companion talk and Jupyter notebook that demonstrates SLE and Monte Carlo forecasting end-to-end
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quando_forecast-0.2.0.tar.gz.
File metadata
- Download URL: quando_forecast-0.2.0.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69e3521c524d7a448aff6d65b0c69e33e0d6a1d3a055d16d891b6352bc9c33e4
|
|
| MD5 |
ef0e34bd1fefbb26e1107df421e55972
|
|
| BLAKE2b-256 |
66141389aa1c19b1ffa86059240c7691df3f8fd1a6a31710ae37e8f3c2b75865
|
File details
Details for the file quando_forecast-0.2.0-py3-none-any.whl.
File metadata
- Download URL: quando_forecast-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96080b52253d3920faae45a6a1da4f0bf911240d8e794cdb5f02b93f71399ae4
|
|
| MD5 |
a92121adfd6ac3c4f3e352ddace05c50
|
|
| BLAKE2b-256 |
dfb3501beac494c3604c7c647d04a6293b0723522d32706af21ce036aad5d4fd
|