Skip to content

Repository files navigation

engineeringkit

PyPI version Python versions License CI Docs Ruff DOI

Engineering concepts made computable → inspectable → visualizable → understandable.

EngineeringKit is an educational scientific-Python toolkit following the design philosophy of MathematicsKit: explicit intermediate results, NumPy/SciPy for mature numerics, and hand-written formulas/algorithms where seeing the mechanics is the lesson. SI units are used by public APIs.

Panel-method streamlines over a NACA 2412, two chaotic double pendulums released 0.001 rad apart, and the Van der Pol limit cycle computed with EngineeringKit

Install

pip install engineeringkit

Subpackages

Domain subpackages, each with runnable examples linked below:

Beam

from engineeringkit.structural_engineering import SimplySupportedBeam

beam = SimplySupportedBeam(5.0, 200e9, 8e-6)
r = beam.solve_point_load(10_000)
print(r.summary())
r.plot()

PID

from scipy import signal
from engineeringkit.control_systems import PID

plant = signal.TransferFunction([1], [1, 2, 1])
r = PID(3, 1, 0.2).simulate(plant)
r.plot()

RLC

from engineeringkit.electrical_engineering import SeriesRLC

r = SeriesRLC(10, 0.1, 100e-6).step_response()
r.plot()

Thermodynamics

from engineeringkit.thermodynamics import OttoCycle

print(OttoCycle(10).summary())

Pipe flow

from engineeringkit.fluid_engineering import reynolds_number, colebrook_friction_factor

Re = reynolds_number(998, 2, 0.05, 1.002e-3)
f = colebrook_friction_factor(Re, 1e-4)

Scope and checks

Every domain has physical input validation, SI units in the public API, a model guide in docs/source/guides/ with its assumptions, and tests against analytical values, conservation balances and benchmarks. Validation lists that evidence and how to rerun the checks, and Limitations lists what is still open.

Documentation: https://cpoli.github.io/engineeringkit/. To cite engineeringkit, use CITATION.cff (GitHub's "Cite this repository").

Inspect a numerical method

import numpy as np
from engineeringkit.integrators import integrate_ode

result = integrate_ode(lambda t, y: -y, [1.0], np.linspace(0, 2, 101), "rk4")
print(result.summary())
fig, ax = result.plot(["normalized state"])

Verify locally

python -m pip install -e '.[dev]'
MPLBACKEND=Agg python -m pytest
python -m ruff check .
python -m ruff format --check .
make -C docs html
python -m build

Coverage requirement

Run the suite with production statement and branch coverage:

MPLBACKEND=Agg python -m pytest --cov=engineeringkit --cov-report=term-missing

The report enforces 100% statement and branch coverage: every statement runs, and every if and loop is seen taking each way out. Test modules are excluded from the coverage denominator; all production modules, private validation helpers, constants, units, plotting and integration code are included. No production code is marked with coverage-ignore pragmas. Coverage measures execution, not scientific correctness.

Documentation navigation

Documentation now follows MathematicsKit's domain-first architecture: Subpackages, History, Examples and API. Each domain hub links all three learning paths; grouped cards and cross-links are generated from one registry in docs/source/conf.py. Executed galleries come from examples/<domain>/, and detailed SI/assumption guides remain linked from the galleries and domain hubs. See docs/README.md.

The MathematicsKit-style Sphinx navigation connects twelve domain hubs to History, Examples and API pages. History pages explain key equations and limits; 24 plotted gallery scripts include twelve explicit benchmark demonstrations.