tessl install tessl/pypi-lunar-python@1.4.0Comprehensive Chinese lunar calendar library with Solar calendar conversion and traditional Chinese calendar features.
Agent Success
Agent success rate when using this tile
79%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.9x
Baseline
Agent success rate without this tile
88%
Solar term utilities that expose the active term, neighboring Jie/Qi transitions, and the Hou/WuHou pentad descriptions for a given moment in the Asia/Shanghai timezone.
whole_day is true at the transition into "雨水" on 2023-02-19, any timestamp that day still reports "雨水" as the active term while exposing the adjacent previous/next entries. @test@generates
from dataclasses import dataclass
from datetime import datetime
from typing import List, Literal, Optional, TypedDict
TermType = Literal["jie", "qi"]
class TermWindow(TypedDict):
name: str # Solar term display label
starts_at: datetime # Solar term start timestamp
type: TermType # "jie" or "qi"
@dataclass
class Pentad:
term_name: str # Parent solar term name
index: int # 1-3 pentad index within the solar term
label: str # Traditional pentad description
def describe_term(moment: datetime, whole_day: bool = False) -> dict:
"""Return the active solar term and its immediate neighbors as TermWindow entries keyed by current/previous/next."""
def yearly_term_table(year: int) -> List[TermWindow]:
"""Return the ordered 24-term schedule for the Gregorian year."""
def active_pentad(moment: datetime) -> Optional[Pentad]:
"""Return the pentad (Hou/WuHou) active at the given moment."""Provides Chinese solar term data, Jie/Qi traversal, and Hou/WuHou descriptions.