Skip to main content

demandplan

PyPI Python License CI

Production-grade demand planning library: probabilistic forecasting, intermittent demand methods, hierarchical reconciliation, and inventory decisions — built end-to-end from literature research through adversarial audit to a published, continuously-validated PyPI package.

28-day probabilistic forecast on a real Walmart SKU

Why this exists

Most forecasting libraries answer "how do I run model X?" — this one answers "which method wins on my data, how uncertain is it, and what do I reorder because of it?"

  • Measured selection, not rules. Champion–challenger backtests pick a method per SKU; no hardcoded segmentation thresholds (ADR-0001).
  • Quantiles are the contract. Every forecaster returns predictive distributions, because inventory decisions consume tails (newsvendor), not points.
  • Claims are validated adversarially. Golden-reference tests against vetted implementations, ground-truth simulations, real Walmart M5 data — details in the case study.

Validation stack

Evidence Result
Real M5 Walmart data (270 SKUs, full hierarchy) +30% FVA vs naive · coherence error 5e-13 across 283 nodes
Ground-truth client simulation safety stock hits 95.3% realized service vs 95% target
Scale benchmark 25 000-series champion–challenger in ~250 s, single machine
Correctness anchors golden refs vs hierarchicalforecast/scipy · property tests · 183 tests, ≥90 % coverage
Cross-platform Windows + Linux (WSL) full-suite green

Reports: benchmarks/ · Research base: research/

Install

pip install demandplan                    # core
pip install "demandplan[ml]"              # global LightGBM (covariate-aware)
pip install "demandplan[fm]"              # Chronos-Bolt foundation models

Quickstart

from demandplan.pipeline import champion_challenger

result = champion_challenger(df, horizon=13)  # df: unique_id, ds, y
result.champion  # winning model + backtested WAPE per SKU
result.forecasts  # quantile forecasts (q05…q95) from full-history refit

New here? Follow A user's walkthrough — every step, input, and genuine outcome on real Walmart data. Runnable version: examples/walkthrough.ipynb.

Scope

Shipped Later versions
naive/seasonal-naive, ETS, ARIMA/SARIMA · Croston/SBA/TSB (+NB heads) · global LightGBM (cross-learning + covariates) temporal reconciliation
MinT-shrink / WLS / BU-TD-MO reconciliation with coherence guarantees probabilistic reconciliation (BUIS)
rolling-origin backtesting, FVA, stateful refit=False, covariate-aware backtesting Chronos fine-tuning, second dataset
newsvendor order-up-to from any quantile grid · calibration diagnostics demand-sensing utilities

Development

python -m pytest          # test suite (coverage gate ≥90% enforced)
python -m mypy            # strict typing
python -m ruff check .    # lint + format checks
mkdocs serve              # knowledge-base site
python examples/run_battle_tests.py     # bundled series + 25k scale test
python examples/client_simulation.py    # ground-truth decision validation
python examples/real_m5_validation.py   # real Walmart M5 end-to-end (auto-downloads)
python examples/make_figures.py         # regenerate docs/assets figures

Design history lives in ADRs and the audited research base; engineering war stories in the case study.

License

Apache-2.0

Metadata

Release files for demandplan 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for demandplan 0.4.0
File Size Uploaded
demandplan-0.4.0.tar.gz 62.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for demandplan 0.4.0
File Interpreter ABI Platform
demandplan-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 115.3 kB

Release files / demandplan-0.4.0.tar.gz

Download URL demandplan-0.4.0.tar.gz
Size 62.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dcaa8cdde575594b576e39b798c8635e40fcabe398ca1021eaee69a61dbcaddf
BLAKE2b-256 checksum
How to use checksums
4df4b2c82229f78f950e0cc8500508791b0b8b370a1e319a6e6710a6ff520191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / demandplan-0.4.0-py3-none-any.whl

Download URL demandplan-0.4.0-py3-none-any.whl
Size 53.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b50147976bc3e301af2fb2411ae76013c31326bd6b31f6eb0f67c1cfdaa0a7ad
BLAKE2b-256 checksum
How to use checksums
dd7a480ce1e1fbc44afb5af07ec1710b6e2ccc917e26cdff4cea369dc2e73611
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page