Pre-release
This is the third pre-release of v2.0.0, to get people testing it and using it in real projects. Bugs are expected, so please raise issues.
Install it with pip install "handcalcs>=2.0.0rc3"; a plain pip install handcalcs still installs 1.x until 2.0.0 is released.
Changes since rc2
Breaking changes
- Comment commands are read, never run (#354). In the assignment form
(# hc: multiline = False), each value must be a literal: a number, a string,True,
FalseorNone. An expression such as# hc: format_code = "." + "2f"is now an
error. - A value keeps the
-fformat of the line that calculated it (#357), on the lines
that substitute it: afterDCR = C_f / C_r # hc: -f .3f,ok = DCR <= 1.0shows
0.833 <= 1.0, not0.83292 <= 1.0. A line's own-fstill wins, and a name
assigned again without-fgoes back to the format in effect. Calculations with an
inline-fcan show different numbers in the lines below it
(details). - Light markup in comments (#356) changes how some existing comments render:
**bold**and*italic*are now styled (the Markdown renderer used to escape them),
\*is a literal*, and in the LaTeX and Markdown renderers a pair of$is math.
Formulas (w*L**2/8) and prices ("costs $5 to $10") stay as written; see Features. - The ASCII renderer spaces comparison operators (#357) like the arithmetic ones:
DCR <= 1.0, notDCR<=1.0, as the HTML renderer does.
Features
- Math in comments (#350, #356):
$...$in a heading, comment line or inline
comment is LaTeX math in the LaTeX and Markdown renderers, as in v1.\$is a literal
$. Turn it off withLatexRenderer(comment_math=False)or
MarkdownRenderer(comment_math=False)
(details). - Bold, italic and code in comments (#356):
**bold**,*italic*and`code`
are styled in every renderer: Markdown, LaTeX, HTML, Word (including inline comments)
and Excel (rich text). The ASCII renderer shows them as written. @handcalc(..., docstring=False)(#339, #355): leave the function's docstring out
of the render. It is rendered by default, as before.find_inputs(..., detail=True)(#358): each input as anInputSpecwith its
value, the units it is written in ("mm","kN / m"), the comment at the end of its
line and its line number, for building a form or an input file from a script
(details).handcalcs.testing(#349): a renderer-neutral feature suite.FEATURE_CASES
holds a calculation for each feature with the names its output must show and hide,
andcheck_case(renderer, case)checks a renderer against one, so renderers in other
packages can test every feature
(details).
Fixes
# hc: -sand# hc: -mwork after forallpeople's
si.environment(..., top_level=True)(#354). Before,s(seconds) andm(metres)
inbuiltinsmade them valid Python expressions, and they were silently ignored:
after# hc: -i, everything that followed stayed hidden.- Two or more multi-line calculations in a row (after a standalone
# hc: -m)
render one below the other, instead of being joined into one row
(= 0.8 M_p = 7 * 8), in every renderer (#354). - In the Excel renderer, a comment command inside an
ifblock (# hc: -s,-i,
-f) now applies to the lines after the block, as in the other renderers. - Docs: the migration guide explains that a standalone comment command stays in effect
for the lines after it (#359). - Development:
uv.lockupdates certifi, nbconvert and tornado for security fixes
(#360). The package's own requirements are unchanged.
The forallpeople side of #352 (a unit with a factor, such as a tonne, shown with the wrong value in a substitution) is fixed in forallpeople, not in handcalcs: connorferster/forallpeople#142 (open; it ships with the next forallpeople release).