Powerful yet easy command line calculator.
Project description
cli-calc
Powerful yet easy command line calculator.
Example Usage
cos(pi/2)
0xFF ^ 0b10
2**8-1
log(2)
comb(49,6)
factorial(42)
random()
cmath.phase(complex(-1.0, 0.0))
All function of the following Math Libraries are ready to use out of the box
-
standard operators
-, >>, ...
-
standard math library
cd, log, sin, sinh, gamma, pi, e, tau, inf, nan...
-
cmath
phase(complex(-1.0, 0.0)), and then most of the above with complex numbers.
-
random
random, choice(['win', 'lose', 'draw']), mean, ...
-
built in functions
max, help, sum, ...
Installation
pip install cli-calc
Configuration
In order to run it from anywhere: Add a symbolic link in ~/bin
cd ~/bin
ln -s ~/path/to/your/install/cli_calc/warpper.sh calc
Then use it anywhere. :-)
calc
echo "7+8" | calc
cat foo.bar | calc
Help
calc
h
Input:
"q" for quit, "h" for help
"_float_" and/or "_int_" for last value
"pi", "tau" and "e" for pi, tau and Euler
"+f" to add display for fraction, "-f" to suppress display for fraction
Other letters are:
he(x), (o)ctal, (b)inary, (i)nteger,
(f)raction, (t)ruth, i(e)ee, ieee_bi(n), f(r)om_ieee
"float" is always visible
See https://docs.python.org/3/library/math.html, use without "math."
https://www.w3schools.com/python/python_operators.asp
Try "cos(pi/2)", XOR: "0xFF ^ 0b10", "2**8-1", "factorial(42)",
"help(math)"
Warning
- Use of
eval
is evil. However some precautions are taken. - flake8-commas, one of the development plugins is marked as No Maintenance Intended. However wemake-python-styleguide is dependant. Issue raised.
Development
Pull Request
Are Welcome! However howto is still missing here. See Issue #13
Metric Dashboard
Features
- Fully typed with annotations
- Checked with mypy
- Packaging PEP561 compatible
Tools
Python Packages
- pypi.org Python Package Index
- pythonrepo.com Popular Python Libraries
Style and type annotations
- pylint vim linter
- isort sort imports
- black opinionated code formatter
- wemake strictest and most opinionated Python linter
- mypy static type checker
- flake8 Style Guide Enforcement
- nitpick enforce the same settings across configuration files
Testing
- pytest test framework
- The Magic Tricks of Testing by Sandi Metz (Talk) on what to test, and what not
Continuous Testing & Integration (CT & CI)
Integration as in: Deployment and Integration testing.
- github actions
- pytest & coverage (yml) pytest @ python-version: ['3.7', '3.8', '3.9', '3.10']
- misspell (yml)
- codeql-analysis (yml)
- Alternative to hithub actions
- tox test and deploy
- travis test and deploy
- coveralls.io coverage
Build and publish to pypi
- poetry version bump bump version
- poetry build wheel
- poetry publish to pypi
- make Makefile automate above
Following Semantic Versioning
- Semantic Versioning
- semver Python Package
- get_ver_for_rule (dev_tool)
Development Environment
- poetry python packaging and dependency management
- cookiecutter creates projects from project templates
- git distributed version control system
- github online collaborative version control
- gh GitHub on the command line
- Markdown lightweight markup language
- vi advanced text editor
- VS Code source-code editor
Documentation
Metric
- shields for Shields and Badges
- issuehub.pro Label Guide
- cloc for SLOC
- make_shields.py (dev_tool) for SLOC
Jason Query for Makefile and Shields
Python development course, based around this code
All this will move into a sister project to actually teach this approach. See Add Teaching repository.
Learn Python
- Zen of Python PEP020
- Learn and master Python with exercism.org
OOO
Code Smells
- Get a Whiff of This by Sandi Metz (Talk)
- Smells to Refactorings (pdf) Quick Reference Guide
Refactoring
SOLID
- SOLID Object-Oriented Design by Sandi Metz (Talk)
- SOLID (Wikipedia)
- SOLID Design Principles simplified with UML
Design Patterns
Class
Manifests
Following these rules, which basically reduce our possibilities, we enable ourselves to write maintainable software. They build upon each other.
License
Credits
This project was generated with wemake-python-package
. Current template version is: d06993f12e3ffad79652a2aec86189dee92d94dd. See what is updated since then.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cli-calc-0.2.14.tar.gz
.
File metadata
- Download URL: cli-calc-0.2.14.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.8.5 Darwin/18.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | faf1c4920e4bbd6a36b9f7a488c5402bf0df1652d910e836ce71ba9001253e5b |
|
MD5 | f510b57a702fc8e5fd9ec77293576b7c |
|
BLAKE2b-256 | 623072cd59d43389803dbe988a46ec669c9e2f7fabeab53b4dc5b12fc9fe0b58 |
File details
Details for the file cli_calc-0.2.14-py3-none-any.whl
.
File metadata
- Download URL: cli_calc-0.2.14-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.8.5 Darwin/18.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d94e7228d696a6f15b93537c139903a623bfcb5486a7f55322647871202b952 |
|
MD5 | dfa330238f3b5bd32a68fc25651805cc |
|
BLAKE2b-256 | ca71ec37b7b56afc5984e91ecf36ce3d57feb89f5c62570c0a01c3d38cb4b6f0 |