
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
A comprehensive Python library for converting numbers to Nepali-style currency words with support for both English transliteration and Nepali Unicode (Devanagari script). Perfect for financial applications, educational tools, and any system requiring Nepali number formatting.
pip install nepali-num2word
from nepali_num2word import convert_to_words, format_number, compact_number
# Convert to words (English)
print(convert_to_words(123456))
# Output: one lakh twenty-three thousand four hundred fifty-six
# Convert to words (Nepali)
print(convert_to_words(123456, lang='np'))
# Output: एक लाख तेइस हजार चार सय छप्पन्न
# Format with Nepali-style commas
print(format_number(1234567))
# Output: 12,34,567
# Format with Nepali Unicode digits
print(format_number(1234567, lang='np'))
# Output: १२,३४,५६७
# Compact representation
print(compact_number(1234567))
# Output: 12.3 lakhs
convert_to_words(number, lang='en')
Convert numbers to words in Nepali numbering system.
Parameters:
number
(int | float | str): Number to convert (supports negative numbers)lang
(str): Language code - 'en'
for English, 'np'
for Nepali UnicodeReturns: str
- Number converted to words
Examples:
convert_to_words(120000) # "one lakh twenty thousand"
convert_to_words(34000000) # "three crore forty lakh"
convert_to_words(123.45) # "one hundred twenty-three rupees and forty-five paise"
convert_to_words(-123) # "-one hundred twenty-three"
# Nepali Unicode
convert_to_words(120000, lang='np') # "एक लाख बीस हजार"
convert_to_words(123.45, lang='np') # "एक सय तेइस रुपैयाँ र पैँतालीस पैसा"
format_number(number, lang='en')
Format numbers with Nepali-style comma separation.
Parameters:
number
(int | float): Number to formatlang
(str): Language code - 'en'
for English digits, 'np'
for Nepali Unicode digitsReturns: str
- Formatted number string
Examples:
format_number(1000000) # "10,00,000"
format_number(120000) # "1,20,000"
format_number(34000000) # "3,40,00,000"
# Nepali Unicode digits
format_number(1000000, lang='np') # "१०,००,०००"
format_number(120000, lang='np') # "१,२०,०००"
format_number(123.45, lang='np') # "१२३.४५"
compact_number(number, lang='en')
Convert numbers to compact, human-readable format.
Parameters:
number
(int | float | str): Number to convertlang
(str): Language code - 'en'
for English, 'np'
for Nepali UnicodeReturns: str
- Compact number representation
Examples:
compact_number(999) # "999"
compact_number(1500) # "1.5 thousand"
compact_number(100000) # "1 lakh"
compact_number(4200000) # "42 lakhs"
compact_number(42000000) # "4.2 crores"
# Nepali Unicode
compact_number(4200000, lang='np') # "४२ लाख"
compact_number(42000000, lang='np') # "४.२ करोड"
The package includes three CLI commands:
nepaliword
- Convert numbers to wordsnepaliword 120000
# Output: one lakh twenty thousand
nepaliword 123.45 --lang np
# Output: एक सय तेइस रुपैयाँ र पैंतालीस पैसा
nepaliformat
- Format with Nepali-style commasnepaliformat 1000000
# Output: 10,00,000
nepaliformat 1000000 --lang np
# Output: १०,००,०००
nepalicompact
- Compact number representationnepalicompact 4200000
# Output: 42 lakhs
nepalicompact 42000000 --lang np
# Output: ४.२ करोड
The library provides comprehensive error handling with clear, actionable error messages:
123
, -456
123.45
, -67.89
"123"
, "123.45"
, "-456"
# Type errors
convert_to_words(None) # TypeError: Number cannot be None
convert_to_words(True) # TypeError: Boolean values are not supported
convert_to_words([]) # TypeError: Unsupported type: list
# Value errors
convert_to_words("") # ValueError: Empty string is not a valid number
convert_to_words("hello") # ValueError: 'hello' is not a valid number
convert_to_words(1000000000) # ValueError: Number too large (max: 999,999,999)
# Clone the repository
git clone https://github.com/kushal1o1/nepali-num2word.git
cd nepali-num2word
# Install in development mode
pip install -e .
# Run tests
python -m pytest tests/
# Test CLI locally
python cli/main.py 120000 --lang np
python cli/format_main.py 1000000
python cli/compact_main.py 4200000
nepali-num2word/
├── nepali_num2word/
│ ├── __init__.py
│ └── core.py
├── cli/
│ ├── main.py
│ ├── format_main.py
│ └── compact_main.py
├── static/
│ └── image/
│ └── nepali-num2word.png
├── tests/
│ ├── __init__.py
│ ├── conftest.py
│ ├── test_core.py
│ └── test_cli.py
├── README.md
├── CONTRIBUTING.md
├── LICENSE
├── setup.py
├── pyproject.toml
├── requirements.txt
└── requirements-dev.txt
We welcome contributions! Please see our Contributing Guide for details on how to get started.
git checkout -b feature/amazing-feature
)python -m pytest
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)The library is optimized for performance with minimal dependencies:
Feature | English | Nepali Unicode |
---|---|---|
Number to Words | ✅ | ✅ |
Currency (Rupees/Paise) | ✅ | ✅ |
Negative Numbers | ✅ | ✅ |
Compact Format | ✅ | ✅ |
CLI Support | ✅ | ✅ |
This project is licensed under the MIT License - see the LICENSE file for details.
Made in Nepal | Created by Kushal1o1
FAQs
Convert numbers to Nepali-style words and formatting
We found that nepali-num2word demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.