Skip to content

Migrate from v2 to v3

Keep your existing analysis code for the common v2 workflows. The CycleCount, SNCurve, ParisCurve, and WalkerCurve imports remain available at package level.

Install in a separate environment

Py-Fatigue 3.0.0 supports 64-bit CPython 3.10–3.15. A compatible wheel includes the Rust extension. Install Rust if pip needs to build from source.

python -m pip install "py-fatigue==3.0.0"

Run an existing v2 analysis

This script uses the same calls in v2.1.1 and v3. It prints the sum of the Palmgren–Miner damage contributions for a short stress history.

from py_fatigue import CycleCount, SNCurve
from py_fatigue.damage.stress_life import calc_pm

cycles = CycleCount.from_timeseries([0, 75, -15, 50, 0])
curve = SNCurve(slope=3, intercept=12)
damage = calc_pm(cycles.stress_range, cycles.count_cycle, curve)
print(float(damage.sum()))
Existing workflow v3 entry point
Count or combine stress histories CycleCount.from_timeseries(), count_a + count_b, and solve_lffd()
Export and reload a cycle histogram CycleCount.as_dict() and CycleCount.from_rainflow()
Correct for mean stress or calculate stress–life damage CycleCount.mean_stress_correction(), calc_pm(), or the DataFrame.miner accessor

Update code that used Numba helpers

Remove calls to warmup_numba(). The Rust kernels ship already compiled. Use ordinary Python or NumPy inputs in place of to_numba_dict(). Replace imports of jit_sn_curve_residuals and other removed Numba-specific helpers where your own code relied on them. If you call low-level helpers directly, check their signatures in the API index.

Compare the outputs of a representative workload in both environments before switching a production analysis. Include the counted cycles and residuals, plus the damage or final crack size you use downstream.

Adopt new features when needed

  • Use CycleCount.from_sep005() or CycleCount.from_pyexsi() to pass a supported measured or generated stress history directly.
  • Continue to use Matplotlib through .plot(). Where available, .echarts() provides an interactive view of the same analysis.
  • Use crack growth when the inputs are an explicit sequence of load blocks, a material fit, and a supported geometry.
  • Open the marimo notebook catalogue for current examples and tutorials.

Move geometry and material imports for 3.1

Import crack growth curves from py_fatigue.material.crack_growth_curve. Import each ordered geometry from its structural module. Keep LoadBlock, result types and simulate_crack_growth in py_fatigue.crack_growth.

Previously imported from py_fatigue.crack_growth Import from
NasgroCurve, ParisCurve, WalkerCurve py_fatigue.material.crack_growth_curve
CenterThroughCrack, EdgeThroughCrack, SemiEllipticalSurfaceCrack, HoleBoreSurfaceCrack py_fatigue.geometry.plate
AxialCylinderThroughCrack, CircumferentialCylinderThroughCrack, CircumferentialCylinderSurfaceCrack, RoundBarSurfaceCrack py_fatigue.geometry.cylinder
SphereThroughCrack py_fatigue.geometry.sphere
RolledBoltThreadSurfaceCrack py_fatigue.geometry.threaded

The top-level imports of ParisCurve and WalkerCurve still work. To migrate trusted pickle files containing moved classes, load them with 3.0.1 and reconstruct the objects from their parameters in the new version. Use Py-Fatigue 3.0.x with the published MCP 0.2.0 wheel. To test 3.1.0rc2 with MCP, use MCP 0.3.0rc1 or run the companion from the checkout.

Install the candidate explicitly with pip install py-fatigue==3.1.0rc2.