-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: build & test | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with unittest | ||
run: | | ||
python -m unittest Testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
# ipycalc | ||
Simple Engineering Calculations in Python | ||
|
||
This project is similar to 'handcalcs' by Conner Ferster, but with a slightly different flavor that I found useful for my calculations as a structural engineer. While it is similar, it was built from scratch rather than by forking `handcalcs`, so the code behaves very differently. A few key differences are: | ||
This project offers functionality similar to `handcalcs` by Conner Ferster, but with a slightly different flavor. While it is similar, it was built from scratch rather than from forking `handcalcs`, so the code behaves very differently. A few key differences are: | ||
|
||
*Use `%%calc` as the first line of a cell to indicate that you want to run `ipycalc` on the contents of a cell. | ||
*US units are built in via `Pint`. Metric units are not yet supported. | ||
*`ipycalc` does not show intermediate substitutions in the calculations. | ||
*`ipycalc` provides control over the precision of the output line by line. | ||
*`ipycalc` offers a placeholder for calculation descriptions (before the calculation) as well as references (after the calculation). | ||
* Use `%%calc` as the first line of a cell to indicate that you want to run `ipycalc` on the contents of a cell. | ||
* US units are built in via `Pint`. Metric units are not yet supported. | ||
* `ipycalc` does not show intermediate substitutions in the calculations. | ||
* `ipycalc` provides control over the precision of the output and the units used line by line. | ||
* `ipycalc` offers a placeholder for calculation descriptions (before the calculation) as well as references (after the calculation). | ||
|
||
The basic calculation syntax is: | ||
|
||
Variable Description: `variable_name` = `python_expression` -> `result_decimal_places`*`result_unit` # Reference Text | ||
|
||
Key components `ipycalc` uses are: | ||
Key components of the `ipycalc` syntax are: | ||
|
||
*`:` The description must come before this character. | ||
|
||
*`=` Used to assign a python expression to a variable name. | ||
|
||
*`->` (optional) Separates the python expression from the results formatting rules. | ||
|
||
*'#' (optional) Indicates reference text to the side of the calculation. | ||
* `:` (required) The description must come before this character. | ||
* `=` (optional) Used to assign a python expression to a variable name. Omit this if you simply want to reprint a previously defined variable. | ||
* `->` (optional) Separates the python expression from the results formatting rules. | ||
* `*` (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. | ||
* `#` (optional) Indicates reference text to the side of the calculation - handy for equation references or code references. | ||
|
||
Here are a few useful things to keep in mind when using `ipycalc`: | ||
|
||
*Subscripts can be added by using the `_` character to indicate the start of a subscript. | ||
|
||
*To stack fractions place the numerator and denominater in parenthesis: (num)/(denom) = $\frac{num}{denom}$. | ||
|
||
*The reference text is optional. I use it to give equation references or code references. | ||
* Subscripts can be added by using the `_` character to indicate the start of a subscript. | ||
* To stack fractions place the numerator and denominater in parenthesis: (num)/(denom) = $\frac{num}{denom}$. | ||
* `If` statements and `else` statements are available using python's inline `if` statement notation. | ||
* Square roots can be displayed using `sqrt`. | ||
* Prime characters can be displayed using `^prime`. | ||
|
||
*`If` statements and `else` statements are available using python's inline `if` statement notation. | ||
IPycalc is still in its infancy. I'm sure there are bugs, so be cautious and use your head. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
IPython | ||
pint |