Metadata-Version: 2.4
Name: caltib
Version: 0.3.0
Summary: Tibetan calendar toolkit (traditional + reform engines).
Author: caltib contributors
License: MIT License
        
        Copyright (c) 2026 Tsogtgerel Gantumur
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.9
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Requires-Dist: twine>=5; extra == 'dev'
Provides-Extra: ephemeris
Requires-Dist: jplephem>=2.21; extra == 'ephemeris'
Requires-Dist: skyfield>=1.45; extra == 'ephemeris'
Provides-Extra: full
Requires-Dist: jplephem>=2.21; extra == 'full'
Requires-Dist: matplotlib>=3.8; extra == 'full'
Requires-Dist: numpy>=1.24; extra == 'full'
Requires-Dist: scipy>=1.10; extra == 'full'
Requires-Dist: skyfield>=1.45; extra == 'full'
Provides-Extra: tools
Requires-Dist: matplotlib>=3.8; extra == 'tools'
Requires-Dist: numpy>=1.24; extra == 'tools'
Requires-Dist: scipy>=1.10; extra == 'tools'
Description-Content-Type: text/markdown

caltib
High-Precision Tibetan Calendrical Math

caltib is a rigorous Python library designed to unify 15th-century historical algorithms with 21st-century astrophysics. It provides a polymorphic framework for evaluating traditional lunisolar calendars alongside modern mathematical reforms.

Live Demonstration
The library can be evaluated directly in the browser without local installation. The web calendar runs completely client-side via WebAssembly:
Launch the caltib Web App (Note: Insert your actual link here)

Key Features
Unified API: Evaluate traditional engines (Phugpa, Mongol, Tsurphu, etc.) and modern reforms (L0–L6) using a single, harmonized interface.

Progressive Reforms: A tiered sequence of engines advancing from pure-integer mean motion (L0) and fixed-iteration Picard solvers (L1–L3) to strictly reproducible floating-point models (L4–L5) and JPL-powered numerical integration (L6).

Strict Reproducibility: L0–L5 engines utilize integer sine-tables or Chebyshev minimax polynomials to ensure bit-for-bit consistency across all CPU architectures.

Localized Physics: Support for geographical location injection to accurately handle spherical sunrise boundaries and civil day-numbering conventions.

Design & Diagnostics Laboratory: A professional-grade toolkit for designing new calendar parameters via continued fractions and analyzing secular drift over millennia.

Installation
caltib is designed to be lightweight. The core package has zero external dependencies, making it highly suitable for embedded environments or web deployment.

Bash
# Core: Traditional engines & Reform Tiers L0-L5
pip install caltib

# Tools: Diagnostic charting & parameter design (requires NumPy & Matplotlib)
pip install "caltib[tools]"

# Ephemeris: JPL DE422 integration & L6 engine (requires Skyfield & jplephem)
pip install "caltib[ephemeris]"
Quickstart
Basic Day Query
Python
from datetime import date
import caltib

# Standard traditional lookup
info = caltib.day_info(date(2026, 2, 21), engine="mongol")
print(f"Mongol Tithi: {info.tibetan.tithi}")
Advanced Localized Reform
Python
from caltib.engines.specs import LOC_MONTREAL
import caltib

# Build an L3 engine localized to Montreal coordinates.
# L3 utilizes fixed-iteration rational Picard solvers and spherical sunrise geometry.
engine = caltib.get_calendar("l3", location=LOC_MONTREAL)
info = engine.day_info(date(2026, 2, 21))
Diagnostics & Design
The library includes a comprehensive diagnostic suite to rigorously analyze calendar accuracy and historical deviations.

Secular Drift: Track how sidereal calendars decouple from the tropical equinox over 1,500-year timescales.

Variance Mapping: Visualize the error propagation and variance of traditional anomaly approximations.

Rational Design: Derive optimal convergents for constructing new calendar architectures.

Example Usage:

Bash
# Analyze secular acceleration against JPL DE422 numerical integration
caltib diag analysis --engine mongol --ephem de422

License
Distributed under the MIT License. Created by Tsogtgerel Gantumur.