Skip to main content

Computational Mechanical Engineering Toolkit

Project description

PyPI License Python

MechLab

MechLab Logo

MechLab is an open‑source Python library for mechanical engineering computations, designed to provide a unified, modular, and extensible toolkit for students, researchers, and practicing engineers.

It brings together commonly used scientific libraries under a clean, engineering‑focused API for thermodynamics, fluid mechanics, control systems, and numerical analysis.


Fatures

  • Thermodynamics utilities (properties, processes, cycles)
  • Fluid mechanics calculations (dimensionless numbers, flow relations)
  • Control systems support
  • Symbolic & numerical computation
  • Unit‑safe calculations (planned)
  • Modular structure (easy to extend)

Istallation

Install directly from PyPI:

pip install mechlab

Or using Poetry:

poetry add mechlab

Quick Start

from mechlab.thermodynamics import enthalpy_TP

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

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

Package Structure

mechlab/
│
|--- mechanics/
|   |--- __init__.py
|   |--- statics/
|   |   |---stress.py
|   |   |---strain.py
|   |--- dynamics/
|       |--- linermotion.py
|       |--- rectiliner_motion.py
|       |--- 3d_motion.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 libraries:

numpy, scipy, sympy, control, fluids, CoolProp, pint, matplotlib

These are installed automatically with MechLab.


Design Philosophy

  • Engineering‑first API (clear variable names, physical meaning)
  • Readable code over premature optimization
  • Modular – each subject area is independent
  • Extensible – easy to add new models & correlations

Roadmap

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

Development Setup

Clone the repository:

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

Install dependencies with Poetry:

poetry install
poetry shell

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

License

This project is licensed under the MIT License.


Author

Sewak Sunar Mechanical Engineering Enthusiast & Python Developer


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.3.tar.gz (1.2 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.3-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mechlab-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e147ec6573f95cff1fc49b8912dc5dd3f02ffb0f95481109eea667942ce2ea52
MD5 ed2e0d9261567d85141cd124d55b5f13
BLAKE2b-256 66e40b50f2eb8685d2d75672cdd58be4e40b54b4f42511f15dcae722d07ffb4b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mechlab-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b9e22530cd5ab1093a5107c505c3e77fef0bfa2046651b5317cc4e90e5caa52e
MD5 6e9cff6b5c25c4fae2137dcbc32f5053
BLAKE2b-256 233ddc06b324770dc6cb55aa9423e2150438909e38ce531ee512ab571a8126d0

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