This release is a pre-release and may not be stable for production use.
NepaliDate Library (Python) 🇳🇵
A robust, zero-dependency Python library and Nepali Date Converter for working with Nepali (Bikram Sambat / BS) dates between 1976/01/01 and 2100/12/31 BS.
📖 Full Documentation & Live Tools
All guides, complete API references, Devanagari format tokens, fiscal year helpers, and interactive playground are hosted on our official documentation portal:
👉 https://nepali-pkg.date/docs/python
🔄 Try the Live Date Converter
📦 Installation
pip install nepali-date-library
Beta: the pluggable-calendar-data release is a pre-release (
1.1.0b1).pip install --pre nepali-date-library # or pin it pip install nepali-date-library==1.1.0b1
🚀 Quick Example
from nepali_date_library import NepaliDate
today = NepaliDate()
print(today.format("YYYY-MM-DD")) # "2081-07-01"
Note: For complete API methods, standalone conversion (
ad_to_bs/bs_to_ad), date arithmetic, and fiscal year calculations, visit https://nepali-pkg.date/docs/python.
🛠️ Custom Calendar Data
The calendar tables are replaceable, so you can add new years, fix a month length or change labels without waiting for a release. Subclass NepaliDate, override the constants() classmethod and return a dict built with define_constants():
from nepali_date_library import ADtoBS, BUNDLED_CONSTANTS, NepaliDate, define_constants
MY_CALENDAR = define_constants({
# anything you leave out falls back to the bundled data
"dateMap": [
*BUNDLED_CONSTANTS["dateMap"],
{"year": 2101, "days": [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31]},
],
})
class MyNepaliDate(NepaliDate):
@classmethod
def constants(cls):
return MY_CALENDAR # return the same object every time
MyNepaliDate(2101, 0, 1).format("YYYY-MM-DD") # "2101-01-01"
MyNepaliDate.is_valid(2101, 0, 1) # True (class helpers follow the subclass too)
ADtoBS("2044-04-13", MyNepaliDate) # converters accept your class
Good to know:
- Settable keys:
dateMap,epoch,utcOffsetMs,weekEn,weekShortEn,weekNp,weekShortNp,monthEn,monthShortEn,monthNp,monthShortNp,numberNp. Unknown keys raiseValueError. - Constants are validated once (consecutive years, 12 months of 1-32 days, name tables of the right size, ...) and snapshotted on first use. Later edits to your dict are ignored; to change the calendar, return a different object.
- Time-dependent helpers such as
current_fiscal_year()use today's date, so they raise if today is outside your calendar. Pass an explicit year in that case.
🤝 Contributing
Contributions are welcome! Please read our Contributing Guide or visit our Online Contribution Guide.
📄 License
MIT © Sandip Ghimire
Made with ❤️ by Sandip Ghimire.
Metadata
Release files for nepali-date-library 1.1.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nepali_date_library-1.1.0b1.tar.gz | 37.3 kB | Without provenance | Details for nepali_date_library-1.1.0b1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nepali_date_library-1.1.0b1-py3-none-any.whl | Python 3 | none | any | Details for nepali_date_library-1.1.0b1-py3-none-any.whl |
Total release size: 60.1 kB
Release files / nepali_date_library-1.1.0b1.tar.gz
| Download URL | nepali_date_library-1.1.0b1.tar.gz |
|---|---|
| Size | 37.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c8df7e479d1c17721f5f6dac321f70356670e697049184e42ea8af2a07b9a7b
|
|
BLAKE2b-256 checksum How to use checksums |
520d56622701d03d358e72b8b84c083ca721fcc9b5a1b7bf0ba71a2fa21b4d57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nepali_date_library-1.1.0b1-py3-none-any.whl
| Download URL | nepali_date_library-1.1.0b1-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75d54fe5563560af9b604f86f89243969de2824d108634890c7c92a83d45bd7e
|
|
BLAKE2b-256 checksum How to use checksums |
d2f4756058e6aa3710b40411e158df3c8fcc45401474e23fd05c34eff5b139c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for nepali-date-library 1.1.0b1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.