Handcalcs

Latest version: v1.6.5

Safety actively analyzes 625140 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

32.902939

1.6.0

This is a major new release for handcalcs and introduces the global configuration feature. This allows users to have control over several options of how handcalcs works. The configuration options, with their default values, are as follow:

* `decimal_separator = "."`
* `latex_block_start = "\\["`
* `latex_block_end = "\\]"`
* `math_environment_start = "aligned"`
* `math_environment_end = "aligned"`
* `line_break = "\\\\[10pt]"`
* `use_scientific_notation = False`
* `display_precision = 3`
* `underscore_subscripts = True`
* `greek_exclusions = []`
* `param_columns = 3`
* `preferred_string_formatter = "L"`

Config API

python
import handcalcs.render

handcalcs.set_option("display_precision", 4)
handcalcs.set_option("param_columns", 5)
handcalcs.set_option("line_break", "\\\\[20pt]")
handcalcs.set_option("greek_exclusions", ["psi"]) etc...

These changes now affect all cells rendered in the current session. If you want to permanently update the `config.json` file with these changes (so handcalcs will always load up with these options), you can then call `handcalcs.save_config()` and the changes will be saved.

The auto-complete in the `handcalcs.set_option()` function demonstrates which options are available and what values they take.

Scientific notation

Previously, handcalcs had a sketchy "guess" at determining if a value should be rendered in scientific notation to make it more readable. This behaviour has now been removed and requires the user to explicitly set whether scientific notation should be used. This can be set as a global option with `handcalcs.set_option('use_scientific_notation', True)` and it can also be toggled at the cell level with the new `sci_not` cell override command. If the global configuration is set to `True`, the toggle will turn scientific notation OFF in that cell. If the global configuration is set to `False`, the toggle will turn scientific notation ON in that cell.

python
%%render sci_not 5

1.4.0

This release has been long awaited!

The biggest news: handcalcs has FINALLY been updated to run on nbconvert v.6.0.0 and Jupyter Lab v3.0. Thanks to the contributions of JimZwartveld, there are new exporters available from the Jupyter File -> Export as... menu to export HTML, Latex, and PDF with input cells hidden.

Additionally, there is the ability to add text now in-between lines of math by using a `` (double pound sign) comment as per a request by theengineer on 82. To summarize:

* ` comment` on a new line will remain a Python comment and will not be rendered
* ` comment` on a new line will now display text in Latex
* ` comment` at the end of a calculation will render the comment in Latex in parentheses as usual

Next item on the handcalcs list, a proper documentation site on ReadtheDocs...

1.2.0

* Feature: `NumericCalcLine`: this is a new line type within handcalcs that recognizes when a calculation does not contain any variables, just numbers, and bypasses the substitution step since the "symbolic" step is just the numbers of the calculation. In other words, it avoids having a redundant substitution when you are not using variables.
* Bug fix: Decorator would not recognized doc strings properly when they were coded onto a single line. This lead handcalcs to treat the entire function source as being within the doc string and nothing would be rendered. Thank you michaellisitsa for your contribution and fixing this bug.
* Bug fix: Nested `log` and other functions, under certain circumstances, would render incorrectly because the nested functions were not recognized.

v.1.1.3
Thank you to michaellisitsa who for posting issues for handcalcs recently. This release fixes the following:

* Additional spaces around commas when used as decimal separators has now been removed
* A bug involving white space underneath `%%render params` causing the alignment to be affected has been fixed (52)
* Inconsistencies with some parentheses around deeply nested calculations that start with function names have been fixed (49)
* Parentheses fully enclosing a calculation was not creating a "parameter line" (no substitution); this is now fixed (51)
* A bug involving complex numbers being inappropriately rendered in scientific notation

Additionally, if anyone is using handcalcs in school or in their daily life, I have created issue 50 as a place people can showcase their rendered notebooks. I love seeing handcalcs being used so if you have something you would like to show off, please submit!

1.1.0

I am excited to release this version of `handcalcs` today especially...because it's my birthday :) I am excited because there are lots of new features that I think you will enjoy using and I am eager to tell you about them:

Features

* __Localization__: Use the `%decimal_separator` line magic to change the decimal separator character from `.` to any character you like (except `_`), e.g. `%decimal_separator ,` to change the decimal separator to `,`. This will affect every cell in the notebook until it is changed. To change the decimal separator with the decorator interface, use `handcalc(dec_sep = ",")`. Thank you BTWS2 for this suggestion.
* __Complex numbers__: They now render in handcalcs.
* __Additional function rendering__: `ceil`, `floor`, and `log` functions are now swapped out for their proper notation (instead of as generic functions). Thank you jm4rc05 for this suggestion.
* __Auto scientific notation__: When working with floats that are small enough to get "cut-off" by the decimal precision setting when they are rendered out, they will automatically be rendered as scientific notation to the decimal precision specified to prevent loss of significant figures. Thank you jlopez1979 for this suggestion.
* __Render global namespace vars with decorator__: Previously, if you called a global variable from within a function decorated with `handcalc()`, it would not render because it was not defined in the function local namespace. Now, they render with no problem. Thank you michaellisitsa for bringing the issue up and eriknw for providing the fix with `innerscope` (so excellent).
* __Render sympy symbols__: Previously you could only render out expressions and equations. Now you can render out just your sympy symbols by using `%%render sympy symbolic`. Thank you to BTWS2 for pushing me on this.
* __Use other override tags with `sympy` override tag__: The `sympy` tag is special and does not need to be mutually exclusive from the other overrides. Now you can use `sympy symbolic`, `sympy long`, etc.

Fixes

* __Doc string in decorated function__: No longer causes errors. Thank you KingSiz3 for reporting this error.
* __Conditional expressions with override tags__: Works smoothly now. Thank you michaellisitsa for reporting this error.

I am excited to present v1.1.0 of handcalcs. Enjoy!

Get the new release from the repo or on pypi: `pip install handcalcs -U`

1.0.0

This is the first major release of `handcalcs`. Many new features have been added based feedback from users on Github and on /r/python. Thank you to everyone who has been using `handcalcs`. An extra big Thank You for everyone who has contributed by comments, issues, and PRs to help make it better.

New Features

* Breaking change: No more "comment tags", they are now called "override tags" and work as line arguments with the `%%render` magic, e.g. `%%render params` or `%%render long`, etc. When using the decorator interface, `override` is one of the arguments in the decorator, i.e. `handcalc(override = "params")`
* Display decimal precision can now be altered at the cell level, similar to an override tag, e.g. `%%render 6` will display all floats up to six decimal places. This can work with an override tag, i.e. `%%render long 8`. If a float has only three digits, such as `1.275` only `1.275` will be displayed, not `1.275000`, for example.
* Sympy integration is now included. `Sympy` with `handcalcs` is intended to be used separately but together. For example, you want to solve a polynomial equation in `Sympy` and then want to substitute values. Solve the polynomial in `Sympy` first, then when you would normally use `.subs()`, instead use `handcalcs` to calculate and render. See the updated README.md on Github for a demonstration.
* An entirely new parser means those extra brackets that were previously needed around fractions, e.g. `(b**2)/(sqrt(a + b))` are now unnecessary. Use brackets as you normally would, i.e. `b**2/sqrt(a+b`.
* Complex numbers are now supported (due to new parser)
* Scientific notation is now supported (due to new parser)
* Comparison operators in expressions now render properly
* Extraneous parentheses that would show up in fractions in certain contexts no longer happen.
* Function calls now only use parentheses when there is an expression or more than one argument being passed to the function
* Variable names that are longer than one character (not including subscripts) are now rendered as upright and not _italic_
* And more!

Feel free to raise additional issues for features you do not see yet (there are two not fully implemented yet: `ceil` and `floor` symbols and automatically switching to scientific notation for small physics constants (however you can now change the decimal precision as a short term fix)).

Thank you for all of the support everyone!

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.