Fake Process Estimation
fake-process-estimation is a small, dependency-free Python package for
displaying plausible progress when a task exposes only an estimated duration
and its elapsed time.
It is useful for indeterminate operations such as external commands, network requests, model execution, file conversion, or legacy jobs that cannot report real work units.
A time-based estimate is a presentation heuristic, not a measurement of completed work. When real work units are available, use them instead.
Features
- A minimal abstract interface for custom estimation strategies.
- A legacy piecewise linear/exponential estimator.
- A smooth S-curve estimator with configurable timing and shape.
- Configurable integer output ranges for progress bars and UI widgets.
- No runtime dependencies.
- Python 3.10 or newer.
Installation
Install the package from the project directory:
pip install .
For development, install it in editable mode:
pip install -e .
Recommended Usage
C_SCurveProcessEstimation is the recommended time-only estimator. It starts
slowly, moves faster through the middle of the expected duration, and then
approaches the configured maximum without a sudden change in speed.
import time
from fake_process_estimation import C_SCurveProcessEstimation
estimator = C_SCurveProcessEstimation(
estimated_time_cost=30.0,
lowest_value=0,
highest_value=1000,
progress_at_estimated_time=0.8,
shape=2.0,
)
started_at = time.monotonic()
while task_is_running():
elapsed = time.monotonic() - started_at
estimated_progress = estimator.estimate(elapsed)
update_progress_bar(estimated_progress / 10)
time.sleep(0.1)
# Only the real task completion event should display 100%.
update_progress_bar(estimator.getHighestValue() / 10)
With the default curve parameters, the approximate normalized progress is:
| Elapsed / estimated time | Estimated progress |
|---|---|
0.00 |
0% |
0.25 |
20% |
0.50 |
50% |
1.00 |
80% |
2.00 |
94% |
3.00 |
97% |
How the S-Curve Works
Let:
tbe the elapsed time;Tbe the estimated total duration;r = t / Tbe the elapsed-time ratio;qbeprogress_at_estimated_time;sbeshape.
The normalized progress is calculated with a log-logistic curve:
r^s
progress(r) = -----------------
r^s + (1 - q) / q
This gives the curve several useful properties:
progress(0) = 0;progress(1) = q;- progress is monotonic and bounded;
- the curve is smooth at the estimated duration;
- progress approaches the maximum as elapsed time increases.
The estimator reserves highest_value for actual task completion when
estimated_time_cost is greater than zero. For example, a range of 0..100
produces estimated values no greater than 99; the caller should set 100
after the task really finishes.
Tuning the Curve
progress_at_estimated_time controls how much progress is shown at the
estimated duration:
0.7is conservative and leaves a larger tail.0.8is the default and works well for general UI feedback.0.9is optimistic and reaches high values earlier.
shape controls the curve profile:
- values below
1.0move quickly at the beginning; 1.0produces a simple saturating curve;- values above
1.0produce a stronger S-shape; 2.0is the default and gives a balanced slow-fast-slow transition.
Legacy Estimator
C_ProcessEstimation preserves the original algorithm:
- before the estimated duration, progress increases linearly from
0%to70%of the configured range; - after the estimated duration, progress follows an exponential tail toward
100%.
from fake_process_estimation import C_ProcessEstimation
estimator = C_ProcessEstimation(
estimated_time_cost=30,
lowest_value=0,
highest_value=100,
)
print(estimator.estimate(15)) # About 35
print(estimator.estimate(30)) # About 70
print(estimator.estimate(60)) # About 85
This strategy is simple, but the rate of change drops abruptly when elapsed time reaches the estimate. The S-curve estimator avoids that visible corner.
API
I_ProcessEstimation
Abstract base class implemented by all estimators.
class I_ProcessEstimation(ABC):
def getLowestValue(self) -> int: ...
def getHighestValue(self) -> int: ...
def estimate(self, time_cost_now: float) -> int: ...
C_SCurveProcessEstimation
C_SCurveProcessEstimation(
estimated_time_cost: float,
lowest_value: int = 1,
highest_value: int = 999,
progress_at_estimated_time: float = 0.8,
shape: float = 2.0,
)
estimated_time_costmust be finite and non-negative.progress_at_estimated_timemust be strictly between0and1.shapemust be finite and positive.- Reversed minimum and maximum values are automatically swapped.
- An estimated duration of zero immediately returns
highest_value.
C_ProcessEstimation
C_ProcessEstimation(
estimated_time_cost: int,
lowest_value: int = 1,
highest_value: int = 999,
)
Implementing a Custom Strategy
New strategies can derive from I_ProcessEstimation:
from fake_process_estimation import I_ProcessEstimation
class WorkUnitEstimation(I_ProcessEstimation):
def __init__(self, total_units: int) -> None:
if total_units <= 0:
raise ValueError("total_units must be positive")
self._total_units = total_units
def getLowestValue(self) -> int:
return 0
def getHighestValue(self) -> int:
return self._total_units
def estimate(self, completed_units: float) -> int:
return max(0, min(int(completed_units), self._total_units))
The parameter name in the interface reflects the built-in time-based estimators, but a custom implementation may interpret the numeric input as a different progress signal.
Better Alternatives to Time-Only Estimation
Use the strongest progress signal available, in this order:
- Completed work units: report
completed / totalfor records, bytes, frames, files, or iterations. - Weighted phases: assign weights to known stages such as download, parsing, processing, and writing.
- Measured throughput: estimate remaining time from a rolling or exponentially weighted average of units processed per second.
- Historical calibration: learn expected durations from previous runs with similar input sizes and environments.
- Time-only curves: use
C_SCurveProcessEstimationwhen no observable work signal exists.
A strong production design often combines weighted phases with measured work inside each phase. This remains accurate when tasks run faster or slower than their original time estimate, while the S-curve remains a useful fallback for opaque stages.
License
This project is licensed under the MIT License. See LICENSE for details.
Metadata
Release files for fake-process-estimation 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 |
|---|---|---|---|---|
| fake_process_estimation-0.1.0.tar.gz | 5.5 kB | Without provenance | Details for fake_process_estimation-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fake_process_estimation-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fake_process_estimation-0.1.0-py3-none-any.whl |
Total release size: 12.9 kB
Release files / fake_process_estimation-0.1.0.tar.gz
| Download URL | fake_process_estimation-0.1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89316093b30225f169f2a6443a3e26138e7ee1065da31cda7fdff3447f997c4d
|
|
BLAKE2b-256 checksum How to use checksums |
b2f3b96599d29eb1ae9e8281d4e7401939090ed6e3581519672451d58159dbf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.6 Windows/11
|
Release files / fake_process_estimation-0.1.0-py3-none-any.whl
| Download URL | fake_process_estimation-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a31e3389aae688b3d090e6ef97701fdb55cf00ce7c2c438afe35473bffb2bcc6
|
|
BLAKE2b-256 checksum How to use checksums |
4a24664e40760c6999788e774e70c59d516604f2fe1075f63d885169f135729c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.6 Windows/11
|
Security for fake-process-estimation 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.