a simple fractions calculator
Project description
FractAlgebra
A simple fraction calculator CLI
Features
- Accepts arbitrarily many fractions, not just two at a time
- returns the answer in lowest common denominator
Installing
Using pipx
(simple and quick 🚀)
I have published fractalgebra as a PyPi package, so you don't have to pull this repo to use the CLI. Even better, using pipx, you can jump in and begin adding fractions without worrying about your python environment.
- Follow the instructions to install pipx on your system
-
> pipx install fractalgebra installed package fractalgebra 0.1.1, installed using Python 3.9.7 These apps are now globally available - fa done! ✨ 🌟 ✨ > fa 1/2 + -3_3/2 = -4
Build From Source
- Python 3.9 or greater is required. Install it here, or use your Python env manager of choice (I prefer Conda)
- This project uses Poetry for dependency management and packaging
-
> git clone git@github.com:bookRa/fractalgebra.git ... > cd fractalgebra > poetry install ... > fa -1/2 + -3/2 = -2
TODO:
Downloadable Binary (See Issue #3)
time-permitting, I would use a tool like PyInstaller in combination with GitHub Actions to publish an executable or zip/folder (to the Releases Page) which any user can simply drop into their file system begin using fractalgebra without relying on any external tooling (including Python).
Testing
- Follow the same instructions above for
"Build From Source"
-
> poetry run pytest Test session starts (platform: linux, Python 3.9.7, pytest 7.0.1, pytest-sugar 0.9.4) ... tests/fractalgebra_test.py ✓ 4% ▌ tests/helpers_test.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓ 65% ██████▌ tests/main_test.py ✓✓✓✓✓✓✓✓ 100% ██████████ Results (0.33s): 23 passed
Usage
- Provide a space-delimeted math string using rational numbers and math operators to the
fa
command- A rational number can be a whole number (
3
), a fraction a mixed fraction formatted with an underscore (3_3/4
) or a fraction (-9/4
). - Negative signs are allowed anywhere except on the fraction part of a mixed fraction. Mathematically, this is ambiguous (at least based on my research)
- The only math operations currently supported are add (
+
), subtract (-
), multiply (*
), and divide(/
)
- A rational number can be a whole number (
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fractalgebra-0.1.4.tar.gz
(8.4 kB
view hashes)
Built Distribution
Close
Hashes for fractalgebra-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77b215787bad14f4ff629ea967ba8bf5935b07567af00dfb24ec2d591c44900c |
|
MD5 | ec3d6d1f2f0e037fa08c62213793c6bb |
|
BLAKE2b-256 | ba7201f21a9386c5f34102edf64438f7ad42194e44e6538a56c99cd9666b0e05 |