Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the use of handcalcs.render() beyond Jupyter #5

Closed
connorferster opened this issue Jun 18, 2020 · 1 comment
Closed

Enable the use of handcalcs.render() beyond Jupyter #5

connorferster opened this issue Jun 18, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@connorferster
Copy link
Owner

It would perhaps be useful to create the functionality of render outside of Jupyter in the form of a function decorator:

from handcalcs import handrender # or something

@handrender
def my_calcs(a, b, c, ...):
    d = a+ b
    f = d**c + a*b
    return locals()

The decorator would inspect the source of my_calcs() and pass the source and returned locals dict to the handcalcs.latex() function and would return a tuple of the rendered Latex code, as a str, along with the last calculated variable of the function (i.e. the "result" value), which would be the last entry to the dictionary.

This would allow the rendered Latex code to be used in any other python application that can render Latex in the browser or otherwise (e.g. Streamlit)

@connorferster connorferster self-assigned this Jun 18, 2020
@connorferster connorferster added the enhancement New feature or request label Jun 18, 2020
@connorferster
Copy link
Owner Author

This feature has been added to Master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant