Skip to main content

gstpy is a simple and flexible Python module that allows you to calculate GST (Goods and Services Tax) in both exclusive and inclusive modes. It provides the option to return results as list values (ideal for developers) or display them in a formatted tabular output (perfect for CLI and reports).

Project description

gstpy Module

   

The gstpy module provides an easy and flexible way to calculate GST (Goods and Services Tax) for various item formats such as lists, dictionaries, and integers. It supports both exclusive and inclusive tax calculations and presents the output in multiple formats: list, dictionary, or a well-formatted table using the tabulate package.    

Installation

   

You can install this module using pip:    

pip install gstpy

GST Class

  from gstpy import GST  

Constructor

    GST(items=0, rate=18, mode="exclusive")

Initializes a GST object.    

Parameters:

  • items: (int, list, dict) — Item(s) to calculate GST on. Defaults to 0.
  • rate: (int, float) — GST rate. Defaults to 18.
  • mode: (str) — Either "exclusive" or "inclusive" to specify GST type. Defaults to "exclusive".    

Behavior:

  • Automatically processes the provided items if valid.
  • Supports multiple formats:
    • List of integers or tuples/lists
    • Dictionary with item names as keys and prices or [price, quantity] as values
    • Single integer price    

Methods

   

1. exclusive

   

Calculates GST using the exclusive method (GST is added to the price).    

Parameters:

  • items: Items to calculate GST for (int, list, dict)
  • rate: GST rate (int, float)
  • out: Output format - "list", "dict", or "table"    

Returns:

  • List or dictionary of results (if out is "list" or "dict")
  • Table printed on screen (if out is "table")    

Format Supported:

  • Single price (int)
  • List of prices (list)
  • List of [item_name, price]
  • List of [item_name, price, qty]
  • Dict of {item_name: price} or {item_name: [price, qty]}    

2. inclusive

   

Calculates GST using the inclusive method (price already includes GST).    

Parameters:

  • items: Items to calculate GST for (int, list, dict)
  • rate: GST rate (int, float)
  • out: Output format - "list", "dict", or "table"    

Returns:

  • List or dictionary of results (if out is "list" or "dict")
  • Table printed on screen (if out is "table")    

Format Supported:

  • Single price (int)
  • List of prices (list)
  • List of [item_name, price]
  • List of [item_name, price, qty]
  • Dict of {item_name: price} or {item_name: [price, qty]}    

Special Functions

   

  • ingst(total_price, gst_rate) → returns only the GST amount
  • exgst(base_price, gst_rate) → returns only the GST amount

Documentation

   

Download Documentation    

You can download the full documentation for the gstpy module by clicking the button above.

Author

   

Developed by: Ankush

For any issues or bug reports, please open an issue on GitHub.

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

gstpy-0.1.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

gstpy-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file gstpy-0.1.1.tar.gz.

File metadata

  • Download URL: gstpy-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gstpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 196030f26def6a30f2ca955d7e2bfb87eb956dbed1a1e4b2187918b769f8c49e
MD5 9995067e9c9942e09ac3d0183b2986c6
BLAKE2b-256 51c59683347864b54bd30faf54cc3239b24241b0004993a8a6776378d999f784

See more details on using hashes here.

File details

Details for the file gstpy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gstpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gstpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d87a79295b674c289eae88fd5e639063ea7b84b61211ea00546a047480d5e577
MD5 f20554ad919940df6b7de97f8c7bbbba
BLAKE2b-256 f4ed4631bb732e7f60bc931122f7407375ec65de05526d09eaed8646978e0563

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