Skip to main content

Computational Mechanical Engineering Toolkit

Project description

MechLab Logo

PyPI License Python docs

MechLab

MechLab is an open-source Python library for mechanical engineering computations, providing a unified, modular, and extensible toolkit for students, researchers, and practicing engineers.

It brings together widely used scientific libraries under a clean, engineering-focused API for:

mechanics thermodynamics fluid mechanics control systems numerical & symbolic computation


Features

  • Mechanics (statics & dynamics)
  • Thermodynamics utilities (properties, processes, cycles)
  • Fluid mechanics calculations (dimensionless numbers, flow relations)
  • Control systems analysis
  • Symbolic & numerical computation
  • Modular and extensible architecture
  • Sphinx-based documentation with API reference

Installation

Install directly from PyPI:

pip install mechlab

Using uv (recommended):

uv pip install mechlab

Quick Start

from mechlab.thermodynamics import enthalpy_TP

h = enthalpy_TP(
    fluid="Water",
    T=500,        # Temperature [K]
    P=3e6         # Pressure [Pa]
)

print(f"Enthalpy: {h:.2f} J/kg")

Package Structure

mechlab/
│
├── mechanics/
│   ├── __init__.py
│   ├── statics/
│   │   ├── stress.py
│   │   └── strain.py
│   └── dynamics/
│       ├── linear_motion.py
│       ├── rectilinear_motion.py
│       └── motion_3d.py
│
├── mscience/              # Material science
│
├── thermodynamics/
│   ├── __init__.py
│   ├── properties.py
│   └── cycles.py
│
├── fluid_mechanics/
│   ├── __init__.py
│   └── dimensionless.py
│
├── control_systems/
│   ├── __init__.py
│   └── linear.py
│
├── utils/
│   ├── __init__.py
│   └── constants.py
│
└── __init__.py

Dependencies

MechLab is built on top of proven scientific Python libraries:

numpy scipy sympy control fluids CoolProp pint matplotlib

All dependencies are installed automatically.


Design Philosophy

  • Engineering-first API (clear physical meaning)
  • Readable code over premature optimization
  • Modular design — subject areas are independent
  • Extensible — easy to add new models & correlations
  • Documented — API reference generated directly from code

Roadmap

  • Rankine, Otto, Diesel cycles
  • Pipe flow & heat exchanger modules
  • Full unit-aware API using Pint
  • Validation against textbook examples
  • Interactive Jupyter notebooks
  • Hosted documentation website

Development Setup (Contributors)

Clone the repository:

git clone https://github.com/sewaksunar/mechlab.git
cd mechlab

Create a virtual environment and install dependencies with uv:

uv venv
uv pip install -e .

Build documentation:

cd docs
uv run sphinx-build source build

Run tests:

pytest

Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a Pull Request

Please follow:

  • PEP-8 style
  • Clear docstrings
  • Basic tests for new features


Documentation

The documentation is built using Sphinx with autodoc support.

Build locally:

cd docs
uv run sphinx-build source build

Then open:

docs/build/index.html

License

This project is licensed under the MIT License.


Author

Sewak Sunar Mechanical Engineering Enthusiast & Python Developer

GitHub: https://github.com/sewaksunar


Acknowledgements

Inspired by mechanical engineering textbooks and the open-source scientific Python ecosystem.

If you find MechLab useful, please ⭐ the repository on GitHub!


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mechlab-0.2.4.tar.gz (4.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mechlab-0.2.4-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file mechlab-0.2.4.tar.gz.

File metadata

  • Download URL: mechlab-0.2.4.tar.gz
  • Upload date:
  • Size: 4.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mechlab-0.2.4.tar.gz
Algorithm Hash digest
SHA256 ef7fc1e7fb2196945af4304b24e78262f1d7e874cdbc98f1a446d634b54ac0ce
MD5 4fdbed835271f1de64131f5f5f18f27f
BLAKE2b-256 2521eee622f4c4c0232df5c9d0da8fe55fbb2b9b746ed48e80076283372342ff

See more details on using hashes here.

File details

Details for the file mechlab-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: mechlab-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mechlab-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7278f6e613586a44a945625ebf49bbb4aa086d39b470858b59eab7e16b918688
MD5 0b8cc871ee3851b96bca49e8c7f8215b
BLAKE2b-256 d613a0a545881478193ea8f9b329b9b4ebe19a251f5f687fb4c046d865ac0a26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page