r/Python • u/Natural-Sympathy-195 • Apr 04 '26
Showcase Built a Nepali calendar computation engine in Python, turns out there's no formula for it
What My Project Does
Project Parva is a REST API that computes Bikram Sambat (Nepal's official calendar) dates, festival schedules, panchanga (lunar almanac), muhurta (auspicious time windows), and Vedic birth charts. It derives everything from real planetary positions using pyswisseph rather than serving hardcoded lookup tables. Takes actual lat/lon coordinates so calculations are accurate for any location, not just Kathmandu.
Target Audience
Developers building apps that need Nepali calendar data programmatically. Could be production use for something like a scheduling app, a diaspora-focused product, or an AI agent that needs grounded Nepali date data. The API is public beta so the contract is stable but not yet v1. There's also a Python SDK if you want to skip the HTTP boilerplate.
Comparison
Most existing options are either NPM packages with hardcoded month-length arrays that break outside a fixed year range (usually 2000-2090 BS), or static JSON files someone manually typed from government PDFs. Both approaches fail for future dates and neither accounts for geographic location in sunrise-dependent calculations. Hamro Patro is the dominant consumer app but has no public API, so developers end up writing scrapers that break constantly. Parva computes everything from Swiss Ephemeris, which means it works for any year and any coordinates.
View all comments
Show parent comment
1
u/Natural-Sympathy-195 Apr 05 '26
the ML loss function analogy actually maps pretty well, same situation where you're hoping for a clean closed-form and end up humbled by something that's been empirically refined over millennia
on optimization, the interesting thing is the performance profile is probably the opposite of what you'd expect. a single ephemeris call for planetary position is microseconds. computing an entire year of festival dates is maybe 50-100ms total on a single thread, which is already fast enough that caching is the main lever worth pulling, not parallelism. i do precompute festival dates on first request per year and cache them, so repeat calls are essentially free.
the batch case is real though. if someone hits `/calendar/range?start=2080&end=2200` you want multiprocessing there, and python's embarrassingly parallel story is fine for that since each date is fully independent. standard ProcessPoolExecutor handles it cleanly.
the GPU clustering angle is interesting for your image augmentation case but would be fighting the wrong bottleneck here. the nutation series (1365 lunisolar terms) is dense polynomial evaluation that maps well onto SSE/AVX on a single CPU core, not GPU parallelism. numpy already vectorizes most of it. the actual constraint for a calendar API is network I/O and cold start latency, not compute. throwing a GPU cluster at it would be like renting a cargo ship to deliver a letter.
what was the niche ML problem if you don't mind sharing? curious what the loss function was approximating