Registry / data / reliability

reliability

JSON →
library0.9.0pypypi✓ verified 24d ago

reliability is a Python library for reliability engineering and survival analysis, significantly extending `scipy.stats` functionality. It provides specialist tools for distribution fitting (including censored data and mixture models), survival analysis (Kaplan-Meier, Nelson-Aalen), reliability testing, and physics of failure. The library is actively maintained, with regular updates and improvements.

pip install reliability
INSTALL
IMPORT
SIG · RELIABILITY
R
reliability
datapythonv0.9.0
Install
16.5s avg
Import
5419ms
Disk
402MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 5.526s · 399.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 16.5s · import 5.312s · 383MB
402MB installed
● package 402MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Weibull_Distribution
from reliability.Distributions import Weibull_Distribution
Fit_Weibull_2P
from reliability.Fitters import Fit_Weibull_2P
plot_points
from reliability.Probability_plotting import plot_points

This quickstart demonstrates how to create a Weibull distribution, draw random samples, fit a 2-parameter Weibull distribution to the data, and then plot both the probability plot and the survival function using the library's object-oriented approach.

import matplotlib.pyplot as plt from reliability.Distributions import Weibull_Distribution from reliability.Fitters import Fit_Weibull_2P # Create a Weibull Distribution object dist = Weibull_Distribution(alpha=30, beta=2) # Draw 20 random samples data = dist.random_samples(20, seed=42) plt.figure(figsize=(10, 5)) plt.subplot(121) # Fit a 2-parameter Weibull Distribution to the samples fit = Fit_Weibull_2P(failures=data, show_probability_plot=True) plt.title('Weibull Probability Plot') plt.subplot(122) # Plot the survival function from the fitted distribution fit.distribution.SF() plt.title('Survival Function') plt.tight_layout() plt.show()
Debug
Known issues
breakingThe API and functionality can change significantly between minor versions. For instance, version 0.8.1 is noted to be 'significantly different' from more recent versions. Users should consult the latest documentation when upgrading.
fix
Always refer to the official documentation for the specific version being used. Test code thoroughly after upgrading.
affects: Prior to 0.9.0 (e.g., 0.8.1 to 0.9.0)
gotchaPlotting functions in `reliability` are built upon `matplotlib`. To display plots, you must explicitly import `matplotlib.pyplot` and often call `plt.show()` after generating plots. Expecting plots to appear automatically without this setup is a common mistake.
fix
Ensure `import matplotlib.pyplot as plt` is present and `plt.show()` is called to render plots, especially in scripts.
affects: All versions
gotchaThe library primarily uses an object-oriented paradigm where distributions are first instantiated as objects (e.g., `Weibull_Distribution`), and then methods are called on these objects for operations like sampling, fitting, or plotting. Users accustomed to a purely functional style (like parts of `scipy.stats`) might initially miss this pattern.
fix
Embrace the object-oriented design: create a distribution object, then use its methods (e.g., `dist.random_samples()`, `fit.distribution.SF()`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'reliability'
The 'reliability' library is not installed in your current Python environment.
fix
pip install reliability
ValueError: Failures and suspensions arrays must be 1D arrays of floats or integers. Cannot be empty.
A distribution fitting function (e.g., Fit_Weibull_2P) received empty arrays or arrays with non-numeric data for its required inputs like 'failures' or 'right_censored'.
fix
Ensure all input arrays for fitting functions are non-empty, 1D arrays containing only numeric (float or integer) values.
AttributeError: 'Fitted_Weibull_Distribution_2P' object has no attribute 'gamma'
You attempted to access the 'gamma' (location) parameter from a 2-parameter Weibull distribution fit object, which only provides 'alpha' (scale) and 'beta' (shape).
fix
Access only 'alpha' and 'beta' for a 2-parameter Weibull fit. If a 3-parameter fit including 'gamma' is needed, use `reliability.Fit_Weibull_3P`.
ValueError: The alpha (scale) parameter must be greater than zero.
When initializing a distribution object directly (e.g., Weibull_Distribution), the provided 'alpha' (scale) parameter was zero or negative.
fix
Ensure that the 'alpha' (scale) and 'beta' (shape) parameters for distribution objects are positive numbers.
ModuleNotFoundError: No module named 'reliability.Fit_Weibull_2P'
You attempted to import a class or function as if it were a module, rather than importing it from its correct submodule (e.g., `reliability.Fitters`).
fix
from reliability.Fitters import Fit_Weibull_2P
Upgrade
Version history
0.9.0latest on PyPI · released Mar 7, 2025
Audit
Dependencies
numpyrequiredCore numerical computations and data handling.
scipyrequiredExtends `scipy.stats` for statistical distributions and functions.
matplotlibrequiredRequired for all plotting functionalities.
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
reliability — pip install reliability · libregistry