Skip to main content

CelestialCalendar for Python

celestial-calendar provides Python bindings for CelestialCalendar's astronomical calculations, Gregorian and Chinese Lunar conversions, and Jieqi (节气) moments. The wheel contains the native library for its target platform; no compiler or separate CelestialCalendar installation is required at runtime. Python 3.11 or newer is supported.

Install

Install the wheel for your platform from PyPI:

python -m pip install celestial-calendar

The same four wheel bytes are published to PyPI and the matching GitHub release:

System Architecture Required tag in the wheel filename
Linux (manylinux 2.28) x86_64 manylinux_2_28_x86_64
Linux (manylinux 2.28) aarch64 manylinux_2_28_aarch64
macOS 14 or newer arm64 macosx_14_0_arm64
Windows AMD64 win_amd64

Linux wheel filenames may contain additional compatible manylinux tags. Each is a py3 wheel for Python 3.11 or newer on that platform. No wheel is published for other platforms, such as Intel macOS, Windows on ARM, or musl-based Linux.

API

import celestial_calendar as celestial

ut1 = celestial.CivilDateTime(2026, 8, 16, 0.5)
jde = celestial.ut1_to_jde(ut1)
winter_solstice = celestial.jieqi_moment(2026, celestial.Jieqi.DONGZHI)

print(jde)
print(winter_solstice)

The public API uses immutable dataclasses and enums. Civil moments retain a day fraction and identify their time scale in the function or field name; they are not silently converted to Python's narrower datetime domain.

Wrong input types, including members of the wrong enum, raise TypeError. Values rejected by finiteness, range, or domain checks raise ValueError. A failure reported by the native boundary raises CelestialError. Its operation attribute names the public function, and its recorded attribute says whether the message came from the native error channel. A legitimate absence remains None or ().

jieqi_moment(year, jieqi) accepts Gregorian years in [401, 32766]. Lunar conversions use algorithm-specific year windows; query them with supported_lunar_year_range(algorithm). moon_phase_moments(year, phase), solar_longitude_roots(year, longitude_deg), and new_moons_in_year(year) accept Gregorian years in [1, 32766].

delta_t(year, model) accepts a finite decimal Gregorian year. Three models have additional bounds:

Model Year domain
DeltaTModel.ALGO1 year >= -4000
DeltaTModel.ALGO3 year < 3000
DeltaTModel.ALGO4 year < 2035

DeltaTModel.DEFAULT, DeltaTModel.ALGO2, and DeltaTModel.ALGO5 have no model-specific year bound.

new_moons_after(jde, count) accepts count in [0, 4096]; zero returns (). The upper bound keeps one native output buffer at or below 32 KiB.

中文

celestial-calendar 把 CelestialCalendar 的天文计算与公历/阴历转换包装为自带原生库的 Python 包, 运行时不需编译器或另行安装 CelestialCalendar。需要 Python 3.11 或更新版本;支持平台见上面的 wheel 表。

import celestial_calendar as celestial

result = celestial.gregorian_to_lunar(celestial.LunarAlgorithm.ALGO3, celestial.GregorianDate(2026, 8, 15))

公开 API 使用不可变 dataclass 与枚举;时间尺度、年域与错误契约见上面的 API 节。

The project is licensed under GPL-3.0-or-later. Source and issue tracking are at https://github.com/0xf3cd/celestial-calendar.

Release files for celestial-calendar 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for celestial-calendar 0.6.1
File
celestial_calendar-0.6.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
celestial_calendar-0.6.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details
celestial_calendar-0.6.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.24+ ARM64 Details
celestial_calendar-0.6.1-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details

Total release size: 1.2 MB

Release files / celestial_calendar-0.6.1-py3-none-win_amd64.whl

Download URL celestial_calendar-0.6.1-py3-none-win_amd64.whl
Size 389.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
30e7c7bdac7ec26ddf6923e1c2704363fe7d90a7d4229f64ceb6c81fb82f83d4
BLAKE2b-256 checksum
How to use checksums
ebf319059f877bf79febf5d9fd43325843b5daa44733a907b679b87561a4c42c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / celestial_calendar-0.6.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL celestial_calendar-0.6.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 318.2 kB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a19941bc9e7c0a7bae4b5d8b5dc9d8ea35acab872e8b41bfd29716fa1cfe59e2
BLAKE2b-256 checksum
How to use checksums
a490b50469e395ab44b9e55600f884199ed2ab3fbc56bc59caa17a0b5f83c9c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / celestial_calendar-0.6.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL celestial_calendar-0.6.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 299.1 kB
Tags Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
19f7c9667244675ca11a3a4263d67e84300e8fcf6b82e031debd226ada83e4a0
BLAKE2b-256 checksum
How to use checksums
a55cc8e7a97e3e03778845deefdbcb4e751c9b669d4dc96b3b05d730eaee3799
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / celestial_calendar-0.6.1-py3-none-macosx_14_0_arm64.whl

Download URL celestial_calendar-0.6.1-py3-none-macosx_14_0_arm64.whl
Size 175.9 kB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
517c3ba9aab9cc33b2effa23f52f6a549169791fde1d2df0e71c8f6ed79e7a61
BLAKE2b-256 checksum
How to use checksums
dfaa3e4cc2516def02117b3fc12b7020421dcac20b42b8d45e083c2681d26ac3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.0

4 release files

This release

0.6.1 This release

4 release files

0.6.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page