CalcuPy ๐Ÿ“š Create console-based calculators in a few lines of code.

Overview

CalcuPy ๐Ÿ“š

Create console-based calculators in a few lines of code.

๐Ÿ“Œ Installation

pip install calcupy

๐Ÿ“Œ Usage

from calcupy import Calculator

calculator = Calculator()
calculator.start()

๐Ÿ“Œ Calculator parameters

Calculator have four parameters:

Calculator(number_variables, function_variables, title, bullet)

๐Ÿ“ number_variables:

GRAVITY = 9.8
SPEED = 20

number_variables = {"g": GRAVITY, "v": SPEED}
calculator = Calculator(number_variables)
calculator.start()

If we run the calculator:

$ g
9.8

$ v
20

$ v + g * 0.01
20.098

๐Ÿ“ function_variables:

def factorial(n):
    if n == 0 or n == 1:
        return 1
    return n * factorial(n - 1)


def y(x1, x2):
    return (x1 + 2) * x2


function_variables = {"y": y, "fac": factorial}
calculator = Calculator(None, function_variables)
calculator.start()

If we run the calculator:

$ fac(4)
24

$ y(2.4, 5.1)
22.44

$ fac(3) + y(2.4, 5.1)
28.44

๐Ÿ“ Basic example:

def foo(x, y):
    return x * y ** 2


title = "MY CALCULATOR"
bullet = "->"
number_variables = {"x": 2, "y": 3}
function_variables = {"foo": foo}
calculator = Calculator(number_variables, function_variables, title, bullet)
calculator.start()

If we run the calculator:

MY CALCULATOR

-> foo(2, 3)
18

-> foo(x, y) * 2
36

-> x / 8 * y
0.75

๐Ÿ“Œ Commands

๐Ÿ“ ADD

Description:

ADD command let you dynamically add new numeric variables.

Syntax:

add identifier expression

Example:

$ add x 4

$ add y 3

$ x * y
12

You can also assign an arithmetic expression to a variable. This expression is solved and the result is stored in the specified identifier.

$ add x sqrt(5) * tan(8 * 2) / 5

$ x
0.1344468258787234

๐Ÿ“ REMOVE

Description:

REMOVE command let you dynamically remove numeric variables.

Syntax:

remove identifier

Example:

$ add x 4.2

$ x
4.2

$ remove x

$ x
Error: 'NoneType' object is not subscriptable
Owner
Dylan Tintenfich
:books: Systems engineering student at Universidad Tecnolรณgica Nacional Mendoza.
Dylan Tintenfich
Python composable command line interface toolkit

$ click_ Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Comm

The Pallets Projects 13.3k Dec 31, 2022
Python and tab completion, better together.

argcomplete - Bash tab completion for argparse Tab complete all the things! Argcomplete provides easy, extensible command line tab completion of argum

Andrey Kislyuk 1.1k Jan 08, 2023
CalcuPy ๐Ÿ“š Create console-based calculators in a few lines of code.

CalcuPy ๐Ÿ“š Create console-based calculators in a few lines of code. ๐Ÿ“Œ Installation pip install calcupy ๐Ÿ“Œ Usage from calcupy import Calculator calc

Dylan Tintenfich 7 Dec 01, 2021
sane is a command runner made simple.

sane is a command runner made simple.

Miguel M. 22 Jan 03, 2023
Rich is a Python library for rich text and beautiful formatting in the terminal.

Rich ไธญๆ–‡ readme โ€ข lengua espaรฑola readme โ€ข Lรคs pรฅ svenska Rich is a Python library for rich text and beautiful formatting in the terminal. The Rich API

Will McGugan 41.4k Jan 02, 2023
Python Command-line Application Tools

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 82 Dec 28, 2022
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Python Fire Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. Python Fire is a s

Google 23.6k Dec 31, 2022
A module for parsing and processing commands.

cmdtools A module for parsing and processing commands. Installation pip install --upgrade cmdtools-py install latest commit from GitHub pip install g

1 Aug 14, 2022
Cleo allows you to create beautiful and testable command-line interfaces.

Cleo Create beautiful and testable command-line interfaces. Cleo is mostly a higher level wrapper for CliKit, so a lot of the components and utilities

Sรฉbastien Eustace 984 Jan 02, 2023
Python library to build pretty command line user prompts โœจEasy to use multi-select lists, confirmations, free text prompts ...

Questionary โœจ Questionary is a Python library for effortlessly building pretty command line interfaces โœจ Features Installation Usage Documentation Sup

Tom Bocklisch 990 Jan 01, 2023
Cement is an advanced Application Framework for Python, with a primary focus on CLI

Cement Framework Cement is an advanced Application Framework for Python, with a primary focus on Command Line Interfaces (CLI). Its goal is to introdu

Data Folk Labs, LLC 1.1k Dec 31, 2022
A simple terminal Christmas tree made with Python

Python Christmas Tree A simple CLI Christmas tree made with Python Installation Just clone the repository and run $ python terminal_tree.py More opti

Francisco B. 64 Dec 27, 2022
A minimal and ridiculously good looking command-line-interface toolkit

Proper CLI Proper CLI is a Python package for creating beautiful, composable, and ridiculously good looking command-line-user-interfaces without havin

Juan-Pablo Scaletti 2 Dec 22, 2022
A CLI tool to build beautiful command-line interfaces with type validation.

Piou A CLI tool to build beautiful command-line interfaces with type validation. It is as simple as from piou import Cli, Option cli = Cli(descriptio

Julien Brayere 310 Dec 07, 2022
emoji terminal output for Python

Emoji Emoji for Python. This project was inspired by kyokomi. Example The entire set of Emoji codes as defined by the unicode consortium is supported

Taehoon Kim 1.6k Jan 02, 2023
Python library that measures the width of unicode strings rendered to a terminal

Introduction This library is mainly for CLI programs that carefully produce output for Terminals, or make pretend to be an emulator. Problem Statement

Jeff Quast 305 Dec 25, 2022
Corgy allows you to create a command line interface in Python, without worrying about boilerplate code

corgy Elegant command line parsing for Python. Corgy allows you to create a command line interface in Python, without worrying about boilerplate code.

Jayanth Koushik 7 Nov 17, 2022
Simple cross-platform colored terminal text in Python

Colorama Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. PyPI for releases |

Jonathan Hartley 3k Jan 01, 2023
Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments

Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments, that will make your code clear and readable.

Dallas 0 Jun 19, 2022
Clint is a module filled with a set of awesome tools for developing commandline applications.

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 82 Dec 28, 2022