Skip to content

v2.0.0

Latest

Choose a tag to compare

@connorferster connorferster released this 24 Nov 06:39
efb137e

handcalcs 2.0 is a rewrite. The parser builds a tree of nodes, and pluggable renderers turn it into:

  • Markdown (the Jupyter default)
  • LaTeX
  • HTML
  • ASCII text
  • Excel, with live formulas
  • Word, with editable equations

pip install handcalcs now installs 2.0.

Notebooks written for 1.x need a few changes. See Coming from handcalcs v1, or convert them with hc-migrate. To stay on 1.x for now, pin "handcalcs<2".

Highlights for people coming from 1.x

  • Comment commands replace the v1 cell override tags: # hc: -f .2f, -m, -g, -i/-s with conditions, --check, --boxed, --pagebreak.
  • Headings, prose and light Markdown in comments, and Jinja templating.
  • More of Python renders: nested if/for, indexing, comprehensions, conditional expressions, with blocks, line continuations and bare expressions.
  • Units: forallpeople and pint quantities, and # hc: -u for unit inputs.
  • Other new tools:
    • SymPy substitution with # hc: -y (v1's %%render sympy)
    • %%source latex (v1's %%tex)
    • %render for one line
    • @handcalc(display=True)
    • a command line: handcalcs script.py -o calc.docx
    • inputs=, to render one script with many input sets

@handcalc(jupyter_display=True) still works, with a deprecation warning. It will be removed in handcalcs 3.0.

Since 2.0.0rc5

  • The exporters extra is gone. Use nbconvert's own --no-input instead.
  • A @handcalc function in a rendered script works. It used to raise OSError: could not get source code.
  • Headings: # ## is a heading, the same as ###.
  • # hc: -b adds about one blank line in every renderer.
  • Long equations no longer run off the page in LaTeX or Word. Rows that are too wide are split one step per row, wide grids are set in fewer columns, and anything still too wide is scaled down.
  • Line magics and ! commands inside a %%render cell now run with the cell, and are left out of the render.
  • pint quantities of numpy arrays show their values (#384).

The full list, release candidate by release candidate, is in the changelog.

Full Changelog: v1.11.0...v2.0.0