Metadata-Version: 2.5
Name: bdkit
Version: 0.1.0
Summary: Everyday Bangladesh utilities: taka in words (English/Bangla, lakh/crore), mobile number validation with operator detection, Bangla digits.
Project-URL: Homepage, https://github.com/sarif-mia/bdkit
Project-URL: Source, https://github.com/sarif-mia/bdkit
Project-URL: Tracker, https://github.com/sarif-mia/bdkit/issues
Author: Sarif Mia
License-Expression: MIT
License-File: LICENSE
Keywords: amount-in-words,bangla,bangladesh,bengali,crore,grameenphone,lakh,phone,taka
Classifier: Natural Language :: Bengali
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Typing :: Typed
Requires-Python: >=3.9
Provides-Extra: test
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# bdkit

Everyday utilities for Bangladeshi apps: write taka amounts in words for invoices and cheques (English or Bangla, lakh/crore), validate mobile numbers and detect the operator, and convert between Bangla and English digits.

No dependencies. Python 3.9+.

```sh
pip install bdkit
```

## Taka in words

```python
from bdkit import taka_in_words, number_to_words

taka_in_words(125050.50)
# 'One Lakh Twenty-Five Thousand Fifty Taka and Fifty Paisa Only'

taka_in_words("12,500", lang="bn")
# 'বারো হাজার পাঁচ শত টাকা মাত্র'

taka_in_words(1000, only=False)
# 'One Thousand Taka'

number_to_words(52_71_036, lang="bn")
# 'বায়ান্ন লক্ষ একাত্তর হাজার ছত্রিশ'
```

Amounts can be numbers, `Decimal`s or strings with commas or `৳`. Paisa are rounded half up to two decimal places.

## Mobile numbers

```python
from bdkit import parse_mobile, normalize_mobile, mobile_operator, is_valid_mobile

normalize_mobile("01712-345678")      # '+8801712345678'
mobile_operator("+880 1912 345678")   # 'Banglalink'
is_valid_mobile("০১৮১২৩৪৫৬৭৮")        # True (Bangla digits work)

m = parse_mobile("008801512345678")
m.local, m.e164, m.operator, m.formatted()
# ('01512345678', '+8801512345678', 'Teletalk', '01512-345678')
```

Accepted forms are `017…`, `+880 17…`, `+88 017…`, `88017…` and `0088017…`, with or without spaces, dashes or brackets.

| Prefix | Operator |
| --- | --- |
| 013, 017 | Grameenphone |
| 014, 019 | Banglalink |
| 016, 018 | Robi |
| 015 | Teletalk |

## Digits and lakh formatting

```python
from bdkit import to_bangla_digits, to_english_digits, format_lakh

to_bangla_digits("2026-11-15")         # '২০২৬-১১-১৫'
to_english_digits("৳১,২৫,০০০")         # '৳1,25,000'
format_lakh(12345678)                  # '1,23,45,678'
format_lakh(1234567.5, decimals=2)     # '12,34,567.50'
format_lakh(150000, bangla=True)       # '১,৫০,০০০'
```

## Command line

```console
$ bdkit words 125050.50
One Lakh Twenty-Five Thousand Fifty Taka and Fifty Paisa Only
$ bdkit words 12500 --bn
বারো হাজার পাঁচ শত টাকা মাত্র
$ bdkit phone "+880 1712-345678" 01812345678
+8801712345678  Grameenphone
+8801812345678  Robi
$ bdkit lakh 12345678
1,23,45,678
$ bdkit bn 2026
২০২৬
```

## Related

- [bd-income-tax](https://pypi.org/project/bd-income-tax/): Bangladesh income tax calculator
- [bangladesh-mcp](https://pypi.org/project/bangladesh-mcp/): these tools for AI assistants (MCP)

## License

MIT
