Skip to main content

Nepali Toolkit

Production-ready utilities for working with Nepali language and data:

Features

Bikram Sambat (BS) Calendar

  • AD ↔ BS conversion with strict validation
  • Flexible formatting tokens (YYYY, MMM, DD, etc.)
  • English/Nepali month names, optional Nepali digits (०१२…)
  • Timezone-aware today_bs() and now() (default Asia/Kathmandu)

BS Holidays

  • List holidays by year/month/tags (e.g., public, festival, school)
  • Free-text search (name_en / name_ne / BS / AD)
  • next_holiday() and list_holiday_between() helpers
  • Data-driven JSON sets; supports merging multiple years

Script Utilities

  • Roman ↔ Devanagari transliteration (digits + diacritics)
  • Data-backed alphabets (vowels/consonants) with examples
  • Barakhari generation (क, का, कि, …) for any base consonant
  • Clean import surface: roman_to_dev, dev_to_roman, vowel_alphabet, consonant_alphabet

Gazetteer

  • Provinces, zones, districts, and a unified places file (with famous flag & tags)
  • Filter by province/zone/district/tags; ranked text search; nearby (Haversine)
  • Single query_places() API plus ergonomic wrappers (list_places, nearby_places, list_famous_places)

Units

  • Area / Volume / Mass conversions via a single convert(value, from, to) API
  • Friendly aliases (e.g., "sq m", "m²", "liter", "L", "kg")
  • Category safety (prevents cross-category mistakes)

Treks

  • Curated trekking routes with region/province/district metadata
  • Filter by difficulty, days, altitude, tags, permits, seasons
  • Text search, nearby-by-start, and lightweight suggestions

Design Principles

  • Pure Python, JSON datasets, predictable APIs
  • i18n-first (EN/NE), developer ergonomics, strong validation
  • Modular structure with clean __init__ exports for friendly imports

Requires Python ≥ 3.9


Installation

pip install nepali-toolkit

Quick Start

# quick_start.py
from nepali_toolkit.holiday import list_holiday, next_holiday, list_holiday_between
from nepali_toolkit.script.transliterate import roman_to_dev, dev_to_roman
from nepali_toolkit.script.alphabet import vowel_alphabet, consonant_alphabet
from nepali_toolkit.script.barakhari import Barakhari
from nepali_toolkit.gazetteer import (
    list_provinces, get_zone, list_districts, list_places, nearby_places, search, suggest
)
from nepali_toolkit.unit import convert
from nepali_toolkit.trek import list_treks, search_treks, nearby_treks
from nepali_toolkit.bs import to_bs, to_ad, today_bs, now
from nepali_toolkit.scripts.barakhari import table

print("=== BS Calendar ===")

print("\n=== AD → BS ===")
bs_obj = to_bs("1999-10-01")
print("Raw BS (ISO):", str(bs_obj))
print("EN label:    ", to_bs("1999-10-01", fmt="YYYY MMM D", lang="en"))
print("NE label:    ", to_bs("1999-10-01", fmt="YYYY MMMM DD", lang="ne", ne_digits=True))




print("\n=== BS → AD ===")
ad_obj = to_ad("2056-06-14")
print("Raw AD (ISO):", ad_obj.isoformat())
print("EN label:    ", to_ad("2056-06-14", fmt="YYYY MMM D", lang="en"))
print("NE label:    ", to_ad("2056-06-14", fmt="YYYY MMMM DD", lang="ne", ne_digits=True))


print("\n=== TODAY (BS) ===")
bs_obj = today_bs()
print("Raw BS (ISO)      :", str(bs_obj))
print("EN (space style)  :", today_bs(fmt="YYYY MMM D", lang="en"))
print("NE (full+digits)  :", today_bs(fmt="YYYY MMMM DD", lang="ne", ne_digits=True))


print("\n=== NOW (BS + AD) ===")
bs_now, dt_now = now()
print("Now BS (ISO)      :", str(bs_now))
print("Now AD (ISO)      :", dt_now.isoformat())


bs_now_en, dt_now_en = now(fmt="YYYY MMM D", lang="en")
print("Now BS (EN)       :", bs_now_en)


bs_now_ne, dt_now_ne = now(fmt="YYYY MMMM DD", lang="ne", ne_digits=True)
print("Now BS (NE)       :", bs_now_ne)

print("\n=== Holidays ===")
print("Current year public (top 5):", list_holiday(tags=["public"], limit=5))
print("Festival in Ashwin:", list_holiday(tags=["festival"], month=6))
print("Search 'Dashain':", list_holiday(query="Dashain", limit=3))
print("Next from 2082-06-10:", next_holiday("2082-06-10", limit=3, inclusive=True))
print("Between 2082-05-01..2082-06-30:", list_holiday_between("2082-05-01", "2082-06-30", tags=["festival"]))

print("\n=== Script: Transliterate ===")
print("roman → dev:", roman_to_dev("santosh kandel"))
print("dev → roman:", dev_to_roman("नेपाल २०२५"))

print("\n=== Script: Alphabet ===")
print("Vowels (dev):", vowel_alphabet(out="dev")[:6])
print("Consonants (roman):", consonant_alphabet(out="roman")[:8])
print("Vowels with examples:", vowel_alphabet(out="pair", example=True)[:3])

print("Barakhari:", table(out="dev"))

print("Specific Base:", table(["ka", "kha"], out="dev"))

print("\n=== Gazetteer ===")
print("Provinces:", list_provinces()[:2])
print("Bagmati zone:", get_zone("Bagmati"))
print("Districts in Bagmati:", list_districts(zone="Bagmati")[:5])
print("Places (heritage in P3):", list_places(province="P3", tags_any=["heritage"])[:3])
print("Nearby heritage (KTM ±30km):", nearby_places(27.7172, 85.3240, radius_km=30, tags_any=["heritage"])[:3])
print("Search 'kathmandu':", search("kathmandu", kinds=["district","place","famous"])[:3])
print("Suggest 'ka':", suggest("ka", kinds=["district","place"], limit=5))

print("\n=== Units ===")
print("1 bigha → m2:", convert(1, "bigha", "m2"))
print("5000 sq ft → aana:", convert(5000, "sq ft", "aana"))

print("\n=== Treks ===")
print("All treks (sample):", list_treks()[:2])
print("Search 'everest':", search_treks("everest", limit=3))
print("Nearby treks from KTM (≤120km):", nearby_treks(27.7172, 85.3240, radius_km=120)[:3])

Release files for nepali-toolkits 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nepali-toolkits 1.0.0
File Size Uploaded
nepali_toolkits-1.0.0.tar.gz 53.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nepali-toolkits 1.0.0
File Interpreter ABI Platform
nepali_toolkits-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 108.8 kB

Release files / nepali_toolkits-1.0.0.tar.gz

Download URL nepali_toolkits-1.0.0.tar.gz
Size 53.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a9a3e759381b38558a9f9b7b46468788925483b04a9baabd34c24869111a1bd2
BLAKE2b-256 checksum
How to use checksums
dd719e118c1a1b3332328e89478b431f42791099e16615a623d1ab9e9160604f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / nepali_toolkits-1.0.0-py3-none-any.whl

Download URL nepali_toolkits-1.0.0-py3-none-any.whl
Size 55.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d46e7974c34dcd1fae37c3ddbbc0d14c8429e4ab174b5d87fc71776e838e5f98
BLAKE2b-256 checksum
How to use checksums
14c2523c98dd47b83c4f07989c99fa21537a4b339f25b082c54ce06075235ec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page