Skip to main content

Tariff rate and duty calculation based on Bangladesh Import and Export related H.S. Code

Project description

BD Tariff

This project provides a Python interface to access tariff rates and calculate duties based on the Bangladesh Customs Tariff for the fiscal year 2025-2026. The tariff data is sourced from the official document: Tariff 2025-2026 (02-06-2025).pdf.

Installation

(Add installation instructions here, e.g., pip install bdtariff if you plan to publish it to PyPI, or instructions for cloning the repository and setting it up locally.)

How to Get Total Duty

To calculate the total duty for a given HSCode and assess value:

from bdtariff import duty

duty()
When prompted, enter the HSCode and then the Assess Value in BDT. The function will return the total duty in BDT.

How to Know Tariff Rate
To retrieve the individual tariff rates for a specific HSCode:

Python

from bdtariff import rate

rate()
When prompted, enter the HSCode. The function will display the applicable tariff rates.

How to Get Tariff Details One by One
You can also access the individual tariff components and description for a given HSCode programmatically:

Python

from bdtariff import hscode

# Replace "HSCODE" with the actual 8-digit HSCode
result = hscode("HSCODE")

if result:
    print(result.cd)            # Get the 'cd' (Customs Duty) field
    print(result.sd)            # Get the 'sd' (Supplementary Duty) field
    print(result.rd)            # Get the 'rd' (Regulatory Duty) field
    print(result.vat)           # Get the 'vat' (Value Added Tax) field
    print(result.at)            # Get the 'at' (Advance Tax) field
    print(result.ait)           # Get the 'ait' (Advance Income Tax) field
    print(result.tti)           # Get the 'tti' (Total Taxable Imports) field - Note: This might be a calculated value, confirm its exact meaning in your context.
    print(result.tarriff_description) # Get the 'Tariff Description' field
    print(result.as_dict())     # Get all available fields as a dictionary
else:
    print("HSCode not found")
Sample Program
Here's a complete example demonstrating how to use the hscode function:

Python

from bdtariff import hscode

result = hscode("01012100") # Example HSCode for live horses, purebred breeding

if result:
    print(f"Customs Duty (CD): {result.cd}")
    print(f"Supplementary Duty (SD): {result.sd}")
    print(f"All Tariff Details: {result.as_dict()}")
else:
    print("HSCode not found")






decorate this for pypi redme: tariff rate take from https://customs.gov.bd/files/Tariff-2025-2026(02-06-2025).pdf

------- How to get total duty -------------



from bdtariff import duty

duty()

-----------------------------------------

Enter HSCode and then Assess Value in BDT

you get totat duty in BDT.



------ How to know tariff rate ------------



from bdtariff import rate

rate()

------------------------------------------

Enter HScode

You get Tariff rate



------ How to get one by one --------------



from bdtariff import hscode



result = hscode(HSCODE)

print(result.cd)  # Get the 'cd' field

print(result.sd)  # Get the 'sd' field

print(result.rd)  # Get the 'rd' field

print(result.vat)  # Get the 'vat' field

print(result.at)  # Get the 'at' field

print(result.ait)  # Get the 'ait' field

print(result.tti)  # Get the 'tti' field

print(result.tarriff_description)  # Get the 'Tariff Description' field





################# Sample Program #############



from bdtariff import hscode



result = hscode("01012100")

if result:

    print(result.cd)  # Get the 'cd' field

    print(result.sd)  # Get the 'sd' field

    print(result.as_dict())  # Get the full dictionary

else:

    print("HSCode not found")


################# Sample Program for duty calculation #############



from bdtariff import duty



result = duty(hscode("01012100"),100)

if result:

    print(result.cd)  # Get the 'cd'

    print(result.sd)  # Get the 'sd'

    print(result.tti)  # Get the total duty

else:

    print("HSCode not found")



Markdown

# bdtariff: Bangladesh Tariff Data

**bdtariff** is a Python library that provides easy access to the official tariff rates of Bangladesh for the fiscal year 2025-2026. The data is sourced directly from the official document: [Tariff 2025-2026 (02-06-2025).pdf](https://customs.gov.bd/files/Tariff-2025-2026(02-06-2025).pdf).

---

## Features

- **Total Duty Calculation:** Quickly calculate the total duty payable for any product based on its HS Code and assess value.
- **Tariff Rate Lookup:** Retrieve individual tariff rates (CD, SD, VAT, etc.) for a specific HS Code.
- **Programmatic Access:** Get detailed tariff information for any HS Code as a Python object.

---

## Installation

(Add installation instructions here, e.g., `pip install bdtariff` if it's available on PyPI, or instructions for cloning and setting up locally.)

---

## Usage

### Calculating Total Duty

You can use the `duty()` function to calculate the total duty interactively.

```python
from bdtariff import duty

duty()
This will prompt you to enter the HSCode and the Assess Value in BDT to get the total duty.

Looking Up Tariff Rates
To get a quick overview of all the tariff rates for a given HS Code, use the rate() function.

Python

from bdtariff import rate

rate()
This will prompt you to enter the HSCode and then display the individual tariff rates.

Programmatic Access
For more advanced use cases, you can access the tariff data directly using the hscode() and duty() functions.

Getting Individual Tariff Components
The hscode() function returns an object with all the tariff details as attributes.

Python

from bdtariff import hscode

# Replace "HSCODE" with the 8-digit code you want to look up
result = hscode("HSCODE")

if result:
    print(f"Customs Duty (CD): {result.cd}")
    print(f"Supplementary Duty (SD): {result.sd}")
    print(f"Regulatory Duty (RD): {result.rd}")
    print(f"Value Added Tax (VAT): {result.vat}")
    print(f"Advance Tax (AT): {result.at}")
    print(f"Advance Income Tax (AIT): {result.ait}")
    print(f"Total Taxable Imports (TTI): {result.tti}")
    print(f"Tariff Description: {result.tarriff_description}")
else:
    print("HSCode not found")
Sample Program for Tariff Details
Python

from bdtariff import hscode

result = hscode("01012100")

if result:
    print(f"CD: {result.cd}")
    print(f"SD: {result.sd}")
    print("--- Full Details as a Dictionary ---")
    print(result.as_dict())
else:
    print("HSCode not found")
Sample Program for Duty Calculation
The duty() function can also be used programmatically to calculate the duty. It returns an object with the calculated duty components.

Python

from bdtariff import duty

# Replace "01012100" with the HSCode and 100 with the Assess Value in BDT
result = duty("01012100", 100)

if result:
    print(f"Calculated CD: {result.cd}")
    print(f"Calculated SD: {result.sd}")
    print(f"Total Duty (TTI): {result.tti}")
else:
    print("Could not calculate duty. Please check the HSCode.")

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

bdtariff-1.0.2.tar.gz (175.0 kB view details)

Uploaded Source

Built Distribution

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

bdtariff-1.0.2-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file bdtariff-1.0.2.tar.gz.

File metadata

  • Download URL: bdtariff-1.0.2.tar.gz
  • Upload date:
  • Size: 175.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.5

File hashes

Hashes for bdtariff-1.0.2.tar.gz
Algorithm Hash digest
SHA256 aa406246912e29f288397c7d1d5d062aa0d9a3c988411404885067be32eca72c
MD5 4cfc65e263ae054bce02a10d2b34b208
BLAKE2b-256 21e79f76c65e9ac90c33c32cb1d7584785b428b5a2e3afb3d6ba38ec05d0088b

See more details on using hashes here.

File details

Details for the file bdtariff-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: bdtariff-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.5

File hashes

Hashes for bdtariff-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c486921987ba04b115b362ab5c8f9907ff0a07c6133689b847816aa93e1226d4
MD5 048343dcf2a8d029416552bfdf04e3e8
BLAKE2b-256 d1fe91a0294e6048df547d086d6c393aafe4bfa72defd6d939f9a9c047766ce4

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