ipycalc 0.0.73__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. ipycalc-0.0.73/LICENSE +21 -0
  2. ipycalc-0.0.73/MANIFEST.in +1 -0
  3. ipycalc-0.0.73/PKG-INFO +61 -0
  4. ipycalc-0.0.73/README.md +37 -0
  5. ipycalc-0.0.73/ipycalc/__init__.py +38 -0
  6. ipycalc-0.0.73/ipycalc/calc.py +727 -0
  7. ipycalc-0.0.73/ipycalc/constants_en.txt +107 -0
  8. ipycalc-0.0.73/ipycalc/ipycalc_en.txt +933 -0
  9. ipycalc-0.0.73/ipycalc/nbconvert_template/base.html.j2 +319 -0
  10. ipycalc-0.0.73/ipycalc/nbconvert_template/cell_id_anchor.j2 +5 -0
  11. ipycalc-0.0.73/ipycalc/nbconvert_template/celltags.j2 +7 -0
  12. ipycalc-0.0.73/ipycalc/nbconvert_template/config.json +18 -0
  13. ipycalc-0.0.73/ipycalc/nbconvert_template/display_priority.j2 +43 -0
  14. ipycalc-0.0.73/ipycalc/nbconvert_template/index.html.j2 +6 -0
  15. ipycalc-0.0.73/ipycalc/nbconvert_template/jupyter_widgets.html.j2 +36 -0
  16. ipycalc-0.0.73/ipycalc/nbconvert_template/mathjax.html.j2 +37 -0
  17. ipycalc-0.0.73/ipycalc/nbconvert_template/mermaidjs.html.j2 +114 -0
  18. ipycalc-0.0.73/ipycalc/nbconvert_template/null.j2 +111 -0
  19. ipycalc-0.0.73/ipycalc/nbconvert_template/static/index.css +14480 -0
  20. ipycalc-0.0.73/ipycalc/nbconvert_template/static/ipycalc.css +30 -0
  21. ipycalc-0.0.73/ipycalc/nbconvert_template/static/theme-dark.css +437 -0
  22. ipycalc-0.0.73/ipycalc/nbconvert_template/static/theme-light.css +420 -0
  23. ipycalc-0.0.73/ipycalc.egg-info/PKG-INFO +61 -0
  24. ipycalc-0.0.73/ipycalc.egg-info/SOURCES.txt +28 -0
  25. ipycalc-0.0.73/ipycalc.egg-info/dependency_links.txt +1 -0
  26. ipycalc-0.0.73/ipycalc.egg-info/entry_points.txt +2 -0
  27. ipycalc-0.0.73/ipycalc.egg-info/requires.txt +2 -0
  28. ipycalc-0.0.73/ipycalc.egg-info/top_level.txt +1 -0
  29. ipycalc-0.0.73/setup.cfg +4 -0
  30. ipycalc-0.0.73/setup.py +31 -0
ipycalc-0.0.73/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 D. Craig Brinck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ graft ipycalc
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: ipycalc
3
+ Version: 0.0.73
4
+ Summary: Clean looking engineering calculations for IPython
5
+ Home-page: https://github.com/JWock82/ipycalc.git
6
+ Author: D. Craig Brinck, PE, SE
7
+ Author-email: Building.Code@outlook.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: jupyterlab
14
+ Requires-Dist: nbconvert>=6.0
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: license-file
22
+ Dynamic: requires-dist
23
+ Dynamic: summary
24
+
25
+ # ipycalc
26
+ Simple Engineering Calculations in Python
27
+
28
+ Turn the contents of a Jupyter cell into a formatted calculation by following the steps below:
29
+
30
+ 1. Install `ipycalc` using `pip install ipycalc`
31
+ 2. Use `from ipycalc import calc` to bring `ipycalc` into your notebook's namespace.
32
+ 3. Use `%%calc` as the first line of a cell to indicate that you want to run `ipycalc` on the contents of a cell.
33
+
34
+ The basic calculation syntax is:
35
+
36
+ Variable Description: `variable_name` = `python_expression` -> `result_decimal_places`*`result_unit` # Reference Text
37
+
38
+ Here's a simple example that calculates the flexural strength of a concrete beam:
39
+
40
+ ![Example](/Example.png)
41
+
42
+ Key components of the `ipycalc` syntax are:
43
+
44
+ * `:` (required) The description must come before this character.
45
+ * `=` (optional) Used to assign a python expression to a variable name. Omit this if you simply want to reprint a previously defined variable.
46
+ * `->` (optional) Separates the python expression from the results formatting rules.
47
+ * `*` (optional) Indicate the number of decimals you want to see in the result to the left of the `*`, and the units you want to see in the result to the right.
48
+ * `#` (optional) Indicates reference text to the side of the calculation - handy for equation references or code references.
49
+
50
+ Here are a few useful things to keep in mind when using `ipycalc`:
51
+
52
+ * Subscripts can be added by using the `_` character to indicate the start of a subscript.
53
+ * Greek characters included in the `python_expression` can just be written out (e.g. `epsilon`). To include greek characters in the Variable Description or the Reference Text, you can use Jupyter's Markdown Latex tags (e.g. `$\epsilon$`).
54
+ * To stack fractions place the numerator and denominater in parentheses: (num)/(denom) yields $\dfrac{num}{denom}$.
55
+ * `if` statements and `else` statements are available using python's inline `if` statement (terniary) notation.
56
+ * Square roots can be displayed using `sqrt`.
57
+ * Prime characters can be displayed using `^prime`.
58
+ * If text gets to lengthy to fit on one line, you can add `\\` to force a line break anywhere in a line. This can help your calculations fit within the page's print margins.
59
+ * `ipycalc` assists you with printing your notebooks. It has a built in `nbconvert` template called `ipycalc` that works just like the `webpdf` template, except it fixes the the bad margins in the `webpdf` template, and avoids page breaks right after headers. Any cells tagged with `hide_cell` will not be rendered. Any cells tagged with `hide_input` will only show the output upon printing. You can select it from the file menu via "File -> Save and Export Notebook As... -> Ipycalc"
60
+
61
+ IPycalc is still in development. There could be bugs, so be cautious and validate the answers it gives you. A special thanks to @connorferster for his project `handcalcs` which inspired this project. A link to `handcalcs` is here: https://github.com/connorferster/handcalcs.
@@ -0,0 +1,37 @@
1
+ # ipycalc
2
+ Simple Engineering Calculations in Python
3
+
4
+ Turn the contents of a Jupyter cell into a formatted calculation by following the steps below:
5
+
6
+ 1. Install `ipycalc` using `pip install ipycalc`
7
+ 2. Use `from ipycalc import calc` to bring `ipycalc` into your notebook's namespace.
8
+ 3. Use `%%calc` as the first line of a cell to indicate that you want to run `ipycalc` on the contents of a cell.
9
+
10
+ The basic calculation syntax is:
11
+
12
+ Variable Description: `variable_name` = `python_expression` -> `result_decimal_places`*`result_unit` # Reference Text
13
+
14
+ Here's a simple example that calculates the flexural strength of a concrete beam:
15
+
16
+ ![Example](/Example.png)
17
+
18
+ Key components of the `ipycalc` syntax are:
19
+
20
+ * `:` (required) The description must come before this character.
21
+ * `=` (optional) Used to assign a python expression to a variable name. Omit this if you simply want to reprint a previously defined variable.
22
+ * `->` (optional) Separates the python expression from the results formatting rules.
23
+ * `*` (optional) Indicate the number of decimals you want to see in the result to the left of the `*`, and the units you want to see in the result to the right.
24
+ * `#` (optional) Indicates reference text to the side of the calculation - handy for equation references or code references.
25
+
26
+ Here are a few useful things to keep in mind when using `ipycalc`:
27
+
28
+ * Subscripts can be added by using the `_` character to indicate the start of a subscript.
29
+ * Greek characters included in the `python_expression` can just be written out (e.g. `epsilon`). To include greek characters in the Variable Description or the Reference Text, you can use Jupyter's Markdown Latex tags (e.g. `$\epsilon$`).
30
+ * To stack fractions place the numerator and denominater in parentheses: (num)/(denom) yields $\dfrac{num}{denom}$.
31
+ * `if` statements and `else` statements are available using python's inline `if` statement (terniary) notation.
32
+ * Square roots can be displayed using `sqrt`.
33
+ * Prime characters can be displayed using `^prime`.
34
+ * If text gets to lengthy to fit on one line, you can add `\\` to force a line break anywhere in a line. This can help your calculations fit within the page's print margins.
35
+ * `ipycalc` assists you with printing your notebooks. It has a built in `nbconvert` template called `ipycalc` that works just like the `webpdf` template, except it fixes the the bad margins in the `webpdf` template, and avoids page breaks right after headers. Any cells tagged with `hide_cell` will not be rendered. Any cells tagged with `hide_input` will only show the output upon printing. You can select it from the file menu via "File -> Save and Export Notebook As... -> Ipycalc"
36
+
37
+ IPycalc is still in development. There could be bugs, so be cautious and validate the answers it gives you. A special thanks to @connorferster for his project `handcalcs` which inspired this project. A link to `handcalcs` is here: https://github.com/connorferster/handcalcs.
@@ -0,0 +1,38 @@
1
+ import os
2
+ from nbconvert.exporters import WebPDFExporter
3
+ from nbconvert.preprocessors import TagRemovePreprocessor
4
+
5
+ class ipycalcExporter(WebPDFExporter):
6
+ """
7
+ A custom PDF exporter for ipycalc.
8
+ """
9
+
10
+ # This is the name of the folder containing the template in `ipycalc`
11
+ custom_template_name = 'nbconvert_template'
12
+
13
+ # This is the directory where ipycalc is installed on the user's machine
14
+ pkg_dir = os.path.dirname(__file__)
15
+
16
+ # This is the location where the `ipycalc` template is installed on the user's machine
17
+ template_dir = os.path.join(pkg_dir, custom_template_name)
18
+
19
+ def __init__(self, config=None, **kw):
20
+
21
+ super().__init__(config=config, **kw)
22
+
23
+ # Set up preprocessors
24
+ trp = TagRemovePreprocessor()
25
+ trp.remove_cell_tags=['hide_cell']
26
+ trp.remove_input_tags=['hide_input']
27
+ self.register_preprocessor(trp, enabled=True)
28
+ self.embed_images=True
29
+ self.exclude_input_prompt=True
30
+ self.exclude_output_prompt=True
31
+
32
+ @property
33
+ def _extra_template_basedirs(self):
34
+ return super()._default_extra_template_basedirs() + [self.template_dir]
35
+
36
+ def _template_name_default(self):
37
+ return os.path.join(self.pkg_dir, self.custom_template_name)
38
+