Skip to main content

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.

  1. Follow the instructions to install pipx on your system
  2. > 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

  1. Python 3.9 or greater is required. Install it here, or use your Python env manager of choice (I prefer Conda)
  2. This project uses Poetry for dependency management and packaging
  3.  > 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

  1. Follow the same instructions above for "Build From Source"
  2.  > 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

  1. 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(/)

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fractalgebra-0.1.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file fractalgebra-0.1.4.tar.gz.

File metadata

  • Download URL: fractalgebra-0.1.4.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.10.60.1-microsoft-standard-WSL2

File hashes

Hashes for fractalgebra-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e47861e916d9d665f77a8666cdf61e8f4329b99033c496541d3cf397b171a0b9
MD5 eda59df2566c931869bf80c282d94c6b
BLAKE2b-256 9d9218170be51604a81f886e3b9a7789cdc08d029355e5fc6c21c2ae1e70c73f

See more details on using hashes here.

File details

Details for the file fractalgebra-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: fractalgebra-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.10.60.1-microsoft-standard-WSL2

File hashes

Hashes for fractalgebra-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 77b215787bad14f4ff629ea967ba8bf5935b07567af00dfb24ec2d591c44900c
MD5 ec3d6d1f2f0e037fa08c62213793c6bb
BLAKE2b-256 ba7201f21a9386c5f34102edf64438f7ad42194e44e6538a56c99cd9666b0e05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page