Stacker: RPN Calculator in Python
Project description
Stacker: An RPN Calculator
Stacker is a powerful Reverse Polish Notation (RPN) calculator built with Python, featuring basic mathematical operations and extensibility through plugins.
Installation
Prerequisites:
Ensure Python 3 is installed.
Installation Options:
-
Via pip:
pip install pystacker
-
From source:
git clone git@github.com:remokasu/stacker.git cd stacker python setup.py install
Feedback and Contributions
Feedback and contributions are welcome. Please submit issues or suggestions on the Issues page.
Dependencies
Stacker uses external libraries like NumPy and Python Prompt Toolkit. Ensure these are installed:
pip install numpy prompt_toolkit
Usage
Run Stacker:
stacker
Or:
python -m stacker
Stacker supports standard arithmetic operations (+, -, *, /) and advanced functions (sin, cos, tan, etc.). Users can input commands in RPN format and extend functionality using custom plugins.
Input Examples
Stacker allows for straightforward RPN input. For example:
-
Single-line input:
stacker:0> 3 4 + [7]
-
Multi-line input:
stacker:0> 3 [3] stacker:1> 4 [3, 4] stacker:2> + [7]
Running Scripts
Stacker scripts can be created in *stk files. To run a script, simply execute it with Stacker. For example:
stacker my_script.stk
Creating Plugins
Create custom plugins for Stacker using Python:
-
In the
plugins
directory, create a new Python file for your plugin (e.g.,my_plugin.py
).stacker/ │ ├── stacker/ │ ├── plugins/ │ │ ├── my_plugin.py │ │ └── ... │ │ │ ├── data/ │ ├── stacker.py │ ├── test.py │ └── ... │ └── ...
Adding your plugin here and reinstalling Stacker will apply the plugin permanently.
-
Alternatively, create a
plugins
directory in the directory where Stacker is executed. This allows you to use plugins without reinstalling Stacker. -
Define required functions or classes in your plugin file.
-
Add a
setup
function to register these with Stacker.
Example:
from stacker.stacker import Stacker
def function(a, b):
# Do something
def setup(stacker: Stacker):
stacker.register_plugin("command", function)
Documentation
For more detailed documentation, please refer to stacker/docs
.
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 Distributions
Built Distribution
Hashes for pystacker-1.4.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff8b943a6803d0aef12d9c5e480d4f985dca5cb79451ea08763b1b1a08b68275 |
|
MD5 | 968239821f1737b7b0a0847228df7bfb |
|
BLAKE2b-256 | 9cd0ffbefe361f6cd3ef0654c96a724c706e25b8bff47161f45cfe3d0644c166 |