py-holidays-rs

Crates.iopy-holidays-rs
lib.rspy-holidays-rs
version0.1.3
created_at2024-02-13 04:11:56.077183+00
updated_at2025-09-10 00:05:05.079001+00
descriptionPublic Holiday crate based on the python Holidays package
homepagehttps://github.com/Billy-Sheppard/py-holidays-rs
repositoryhttps://github.com/Billy-Sheppard/py-holidays-rs
max_upload_size
id1137741
size1,531,375
Billy Sheppard (Billy-Sheppard)

documentation

README

python Holidays package in Rust

crates.io docs.rs

In beta, feel free to PR.

Usage

NB: This package requires an internet connection at runtime, unless you use the feature offline. Turning that feature on will embed holidays into your compiled artifact and may have size implications.

x86_64 (default-features = true)

// Result<Arc<CountryHolidayMap>, String>
let all_holidays = py_holidays_rs::get_all_holidays(CountryCode::AU); 
// Result<BTreeMap<SubDivision, BTreeMap<chrono::NaiveDate, String>>, String>
let australian_holidays = py_holidays_rs::get_holidays_by_country(CountryCode::AU); 

x86_64 (features = ["offline"])

// Result<Arc<CountryHolidayMap>, String>
let all_holidays = py_holidays_rs::get_all_holidays(CountryCode::AU); 
// Result<BTreeMap<SubDivision, BTreeMap<chrono::NaiveDate, String>>, String>
let australian_holidays = py_holidays_rs::get_holidays_by_country(CountryCode::AU); 

wasm32 (default-features = true)

py_holidays_rs::wasm32::initialise_all_holidays(CountryCode::AU).await; // you must call this somewhere before you call the get_* function, you only need to call it once

// Result<Arc<CountryHolidayMap>, String>
let all_holidays = py_holidays_rs::get_all_holidays(CountryCode::AU); 
py_holidays_rs::wasm32::initialise_holidays_by_country(CountryCode::AU).await; // you must call this somewhere before you call the get_* function, you only need to call it once per country code

// Result<BTreeMap<SubDivision, BTreeMap<chrono::NaiveDate, String>>, String>
let australian_holidays = py_holidays_rs::get_holidays_by_country(CountryCode::AU); 

wasm32 (features = ["offline"])

// Result<Arc<CountryHolidayMap>, String>
let all_holidays = py_holidays_rs::get_all_holidays(CountryCode::AU); 
// Result<BTreeMap<SubDivision, BTreeMap<chrono::NaiveDate, String>>, String>
let australian_holidays = py_holidays_rs::get_holidays_by_country(CountryCode::AU); 
Commit count: 68

cargo fmt