Skip to content

Commit

Permalink
Merge pull request #212 from connorferster/releases/v1.8.0
Browse files Browse the repository at this point in the history
chore: bump version
  • Loading branch information
connorferster authored Jun 16, 2024
2 parents d484e6d + fa13f3d commit 3579abd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,23 @@ Returns a tuple consisting of `(latex_code: str, locals: dict)`, where `locals`
* `override` is a str representing one of the acceptable override tags (see below)
* `precision` is an int to alter the of decimal precision displayed
* `left` and `right` are strings that can precede and follow the encoded Latex string, such as `\\[` and `\\]` or `$` and `$`
* `jupyter_display`, when True, will return only the `locals` dictionary and instead will display the encoded Latex string rendering with `display(Latex(latex_code))` from `IPython.display`. Will return an error if not used within
* `jupyter_display`, when True, will return only the `locals` dictionary and instead will display the encoded Latex string rendering with `display(Latex(latex_code))` from `IPython.display`. Will return an error if not used within
* `record`, when True, will activate the `HandcalcsCallRecorder` to allow the function to "recall" previous outputs (see below) **New in v1.8.0**

In your decorated function, everything between `def my_calc(...)` and a return statement (if any) is now like the code in a Jupyter cell, except it's a standard Python function.

Used in this way, you can use `@handcalc()` to dynamically generate Latex code for display in Jupyter and non-Jupypter Python environments (e.g. streamlit).

![Parameters](docs/images/decorator.png)

### HandcalcsCallRecorder (New in v1.8.0)

The `HandcalcsCallRecorder` is a new kind of function wrapper that is available from the `@handcalc` decorator. To activate it, select `record=True` as one of the arguments in the decorator function.

The intended use case is during iterations. In engineering, it is common to compute a whole bunch of values in a table or DataFrame. The table itself contains the results of the computations but the table does not necessarily reveal the computation steps. The `HandcalcsCallRecorder` allows you to display the calculation for one of the calculation iterations that have been processed by your decorated function, as shown in the example below:

![HandcalcsCallRecorder](docs/images/call_recorder.gif)

---

## Global config options (New in v1.6.0)
Expand Down
Binary file added docs/images/call_recorder.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion handcalcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""
Render arithmetic calucations in Jupyter as though they were written by hand.
"""
__version__ = "1.7.1" #
__version__ = "1.8.0" #
from .decorator import handcalc
from .global_config import set_option, save_config

Expand Down

0 comments on commit 3579abd

Please sign in to comment.