Skip to content
draconis-engineeringPublic

About

An extensive open source STEM toolbox, written in Python.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

115 Commits

Folders and files

DuraPy

License: GPL v3 Python 3.11+ Version PRs Welcome

A unified Python toolbox for STEM workflows — from linear algebra and physics to chemistry, electronics, aerospace, and robotics.

DuraPy brings scientific computing, engineering utilities, and domain-specific solvers together under one coherent API. It features a custom unit/quantity system, a growing set of domain modules, and performance-minded components like DracoLIX for numerical work.

Highlights

  • Type-safe physical quantities — Quantity, Unit, Dimension, and Constant with dimensional awareness and operator overloading
  • Domain coverage — Math, physics, chemistry, bioinformatics, electronics/circuits, aerospace, robotics/controls, ML utilities, and crypto
  • Circuit simulation — Modified Nodal Analysis (MNA) for DC/AC, RLC analysis, filters, power factor, and component models
  • Aerospace & fluid dynamics — Bernoulli, Reynolds, Mach, lift/drag, rocket equations, and gas laws
  • Chemistry toolkit — Full periodic table (118 elements), formula parsing, stoichiometry, reaction balancing, acid/base, and gas laws
  • Clean, composable API — Reusable primitives with domain-specific facades where it makes sense

Quick Start

Installation

pip install durapy

Or install from source:

git clone https://github.com/draconis-engineering/durapy.git
cd durapy
pip install -e .

Usage

from durapy.unimath import algebra
from durapy.uniphys.classical import mechanics, thermodynamics
from durapy.unisky import mach_number, reynolds_number

# Algebra
print("Slope:", algebra.slope(0, 0, 2, 4))

# Physics (returns Quantity objects)
print("Torque:", mechanics.torque(0.3, 50))
P, V, n, T = thermodynamics.ideal_gas_law(V=0.022414, n=1.0, T=273.15)
print(f"STP pressure: {P:.2f} Pa")

# Aerospace
print(mach_number(340))
print("Re:", reynolds_number(60, 1.5, 1.5e-5))

More examples can be found in examples/.

Interactive REPL

DuraPy ships with a shell for exploring the API from a terminal:

durapy

Or, without installing the console script:

python -m durapy.uniCLI.repl
# or with uv:
uv run durapy
PS C:\Prosjekter\durapy> uv run durapy
╭─────────────────────────────────────────────────────────── DuraPy REPL ────────────────────────────────────────────────────────────╮
│ DuraPy 1.0.2.0 interactive shell                                                                                                   │
│ Tab completes names and keyword arguments.                                                                                         │
│ Up/Down recalls history; Ctrl-Space opens completion.                                                                              │
│                                                                                                                                    │
│ Try:                                                                                                                               │
│   mach_number 340                                                                                                                  │
│   slope 0 0 2 4                                                                                                                    │
│   thermodynamics.ideal_gas_law V=0.022414 n=1.0 T=273.15                                                                           │
│   :again 680                                                                                                                       │
│   last(680)                                                                                                                        │
│   _                                                                                                                                │
│                                                                                                                                    │
│ :help for all commands, :quit to exit.                                                                                             │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
durapy>

Inside the shell, functions can be called Python-style or shell-style:

durapy> mach_number 340
Ratio: 0.991... - SUBSONIC
durapy> :again 680
Ratio: 1.982... - SUPERSONIC
durapy> last(680)
Ratio: 1.982... - SUPERSONIC
durapy> thermodynamics.ideal_gas_law V=0.022414 n=1.0 T=273.15
(101324.86, 0.022414, 1.0, 273.15)
  • Tab completion for modules, functions, aliases, and keyword arguments
  • Persistent history in ~/.durapy/history, with inline suggestions
  • Last-call memory through last(...), _fn, _, and :again
  • Introspection with :doc, :src, :list, and :modules
  • Python statements are supported too, so x = slope(0, 0, 2, 4) works

Type :help inside the shell for the full command list.

Module Overview

Module Purpose
durapy.shared Core primitives: Quantity, Unit, Dimension, Constant, color systems, exceptions
durapy.unimath Algebra, geometry, coordinate systems, number theory, trigonometry
durapy.uniphys Physics: classical (mechanics, thermodynamics, fluids, acoustics, electromagnetism), modern (nuclear, relativity), astrophysics (gravitation, orbital mechanics, cosmology, rocketry)
durapy.unisky Aerospace/spaceflight: aerodynamics, propulsion, gas laws, Bernoulli, rocket equations (built on uniphys)
durapy.unichem Chemistry: periodic table, formula parsing/molar mass, stoichiometry, balancing, acid/base, gas laws
durapy.unipower Electronics: component models, MNA circuit solver (DC/AC), RLC/filters, power analysis
durapy.uniops Robotics/mechatronics: kinematics, dynamics, PID controllers
durapy.unibio Bioinformatics: sequence tools, ORFs, GC content, melting temp, translation
durapy.unicogni ML/NLP utilities and activation/loss functions
durapy.unicrypto Cryptography primitives
durapy.uniCLI CLI framework utilities

Documentation

  • Examples — Runnable, up-to-date usage examples
  • Changelog — Release history and notable changes
  • TODO — Tracked improvements and known gaps

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

Distributed under the GNU General Public License v3.0. See LICENSE for details.

About

An extensive open source STEM toolbox, written in Python.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages