Skip to main content

ipycalc

Engineering calculations in Jupyter, formatted for clear review and professional reports.

ipycalc helps engineers move from raw notebook math to readable, auditable calculations. Write equations in Python, add descriptions and references, and get polished output that is easier to check, share, and print.

Why Use ipycalc?

  • Turn opaque code cells into presentation-ready engineering calculations.
  • Keep the speed and flexibility of Python while improving readability.
  • Add units, references, and notation in one place.
  • Export cleaner PDFs with the built-in nbconvert template.
  • Reuse project variables across notebooks without manual copy/paste.

If you already use Jupyter for design work, ipycalc helps close the gap between computation and documentation.

Quick Start

  1. Install:
pip install ipycalc
  1. Import in your notebook:
from ipycalc import calc
  1. Start a calc cell with %%calc.

Basic Syntax

Variable Description: variable_name = python_expression -> result_decimal_places*result_unit # Reference Text

Example (flexural strength of a concrete beam):

Example

Syntax Reference

  • : (required) Description appears before this character.
  • = (optional) Assign a Python expression to a variable. Omit to reprint a previously defined variable.
  • -> (optional) Separates the expression from result formatting rules.
  • * (optional) Set decimal places to the left and result units to the right.
  • # (optional) Add right-side reference text (equation references, code references, notes).

Useful Notes

  • Subscripts: use _ to indicate the start of a subscript.
  • Greek in expressions: write names directly (for example epsilon).
  • Greek in descriptions/reference text: use Jupyter Markdown LaTeX (for example $\epsilon$).
  • psi is ambiguous with pressure units; use \grpsi when you need the Greek character.
  • Stacked fractions: wrap numerator and denominator in parentheses, for example (num)/(denom) renders as $\dfrac{num}{denom}$.
  • Conditionals: use Python inline ternary notation.
  • Square roots: use sqrt.
  • Trig functions: use sin, cos, tan, and cot.
  • Prime notation: use ^prime.
  • Manual line breaks: insert \\ where needed to avoid overflow in print layouts.
  • Printing: ipycalc includes an nbconvert template named ipycalc that behaves like webpdf, but with improved margins and better page-break behavior after headers.
  • Numbered/sectioned printing: use the ipycalc_numbered exporter to automatically number section headers (h2 and below). This is useful for formal calculation packages where references to section numbers are required.
  • Tag a cell with one of the following tags to change the way it prints to PDF:
    • hide_cell excludes the entire cell.
    • hide_input prints output only.
  • In Jupyter, export with:
    • File -> Save and Export Notebook As... -> Ipycalc
    • File -> Save and Export Notebook As... -> Ipycalc_numbered
  • From the command line, you can also export with jupyter nbconvert --to ipycalc or jupyter nbconvert --to ipycalc_numbered.

Sharing Variables Between Notebooks

ipycalc can save variables from one notebook and import them into another. This is useful for multi-notebook workflows, such as loads feeding into member design.

Saving variables:

from ipycalc import save_vars
save_vars('my_notebook.ipynb')

This writes user-defined variables (including pint quantities with units) to .ipycalc_vars/my_notebook.json in the notebook's directory. The notebook file itself is never modified.

Importing variables:

from ipycalc import import_vars
import_vars('my_notebook.ipynb')           # import all saved variables
import_vars('my_notebook.ipynb', 'P', 'L') # import specific variables only

Both functions are also available directly inside a %%calc cell with no import statement required.

Variables are saved and loaded by filename only. Both notebooks must be in the same working directory.

Project Status

ipycalc is actively evolving. Validate results as part of your normal engineering QA process.

Special thanks to @connorferster and the handcalcs project for inspiration: https://github.com/connorferster/handcalcs

Metadata

Release files for ipycalc 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipycalc 1.0.9
File Size Uploaded Provenance Actions
ipycalc-1.0.9.tar.gz 34.0 kB Without provenance Details for ipycalc-1.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ipycalc 1.0.9
File Interpreter ABI Platform Actions
ipycalc-1.0.9-py3-none-any.whl Python 3 none any Details for ipycalc-1.0.9-py3-none-any.whl

Total release size: 68.2 kB

Release files / ipycalc-1.0.9.tar.gz

Download URL ipycalc-1.0.9.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e542c13d77e9d37e91bf2f8c7e465c8435d134407084c5bde5bfc34dcebb459b
BLAKE2b-256 checksum
How to use checksums
a842444bd9c96c755e18306162e0114eaa13564bb52371e33e0e80baf91f6969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / ipycalc-1.0.9-py3-none-any.whl

Download URL ipycalc-1.0.9-py3-none-any.whl
Size 34.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8aa2c0a9f9de47d4facb16c0c22d22292adfdfae07b7e4e82d48fee7580135e3
BLAKE2b-256 checksum
How to use checksums
b7e69fac2711e2b0570ce2b69ffa45ed25576ed56c0dbbec10ba3fba693257f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for ipycalc 1.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.9 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page