Skip to main content

nhatnguyet (Python)

English: Zi Wei Dou Shu (Tử Vi), BaZi (Four Pillars), Pythagorean numerology for Vietnamese names, the Vietnamese, Chinese, Korean and Japanese lunar calendars, and Vietnamese festivals, in pure Python with no dependencies. By Nhat Nguyet (nhatnguyet.org). Full docs: github.com/Nhat-Nguyet/nhatnguyet.

Bản Python của lõi tính Nhật Nguyệt (nhatnguyet.org): âm lịch Việt Nam, can chi, 24 tiết khí, Nhị Thập Bát Tú, ngũ hành, nạp âm, và thần số học. Thư viện chuẩn, không phụ thuộc, Python 3.9 trở lên. Giấy phép MIT.

Lõi tính Go của Nhật Nguyệt là nguồn sự thật. Mỗi kết quả ở đây được so với bộ ca kiểm do lõi Go sinh ra (../ca-kiem/*.json): 8.960 ca âm lịch và 600 ca thần số học, khớp từng trường.

Cài và kiểm

pip install .
python3 -m unittest discover -s tests

Dùng

from nhatnguyet import am_lich, than_so_hoc

am_lich.solar_to_lunar(17, 2, 2026)       # {'day': 1, 'month': 1, 'year': 2026, 'leap': False}
am_lich.lunar_to_solar(1, 1, 2026, False) # ({'day': 17, 'month': 2, 'year': 2026}, True)
am_lich.day_can_chi(17, 2, 2026)          # {'can': 'Nhâm', 'chi': 'Tuất', 'label': 'Nhâm Tuất'}
am_lich.moc_tiet_khi_trong_nam(2026)      # 24 mốc tiết khí, giờ Việt Nam, tới phút

than_so_hoc.tinh_ho_so_than_so_hoc_sau("Nguyễn Văn An", 1, 10, 1960, 2026, 1, 1)

from nhatnguyet import tu_vi; ls = tu_vi.lap_la_so_tu_vi("", "Nam", 1, 1, 1990, 6); tu_vi.nhan_dien_cach_cuc(ls)  # Tử Vi (giờ là chỉ số chi, 0 Tý); thêm dai_van, tinh_han_nam, tinh_sao_luu
from nhatnguyet import bat_tu; ls = bat_tu.lap_la_so_bat_tu(1, 10, 1990, 8, 30, "Nam"); bat_tu.tinh_tieu_van_bat_tu(ls, 2026)  # Bát Tự, giờ None là chưa biết giờ

Quy ước tên

  • Tên hàm là tên hàm Go viết kiểu snake_case, GIỮ NGHĨA của Go: SolarToLunar thành solar_to_lunar (dương sang âm), LunarToSolar thành lunar_to_solar (âm sang dương), TinhHoSoThanSoHocSau thành tinh_ho_so_than_so_hoc_sau.
  • Kết quả là dict mang đúng khoá camelCase của bộ ca kiểm (soDuongDoi, canChiNgay, kinhDo...). Ngày dương là {"day", "month", "year"}, ngày âm thêm "leap".
  • Mọi phép tính lịch theo giờ Việt Nam UTC+7 cho mọi năm.
  • Thần số học: tháng và ngày cá nhân tính theo thang_xem, ngay_xem truyền vào, không đọc đồng hồ máy. Tên tiếng Việt bỏ dấu như lõi Go (đ thành d).

Ghi công

Công thức thiên văn theo Jean Meeus, "Astronomical Algorithms"; ΔT theo Espenak và Meeus (NASA, 2006). Quy tắc dựng tháng là quy tắc chung của lịch âm dương truyền thống (lịch Thời Hiến), áp ở giờ Việt Nam UTC+7. Mã viết lại theo lõi Go của Nhật Nguyệt.

Metadata

Release files for nhatnguyet 0.1.0

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

Source distribution (sdist)

Source distribution for nhatnguyet 0.1.0
File Size Uploaded Provenance Actions
nhatnguyet-0.1.0.tar.gz 133.2 kB Without provenance Details for nhatnguyet-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nhatnguyet 0.1.0
File Interpreter ABI Platform Actions
nhatnguyet-0.1.0-py3-none-any.whl Python 3 none any Details for nhatnguyet-0.1.0-py3-none-any.whl

Total release size: 267.8 kB

Release files / nhatnguyet-0.1.0.tar.gz

Download URL nhatnguyet-0.1.0.tar.gz
Size 133.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f03ec9cfe98e26b379d43a1b93ec9b7c02bb53dedf62e6dd286160792b0c6a30
BLAKE2b-256 checksum
How to use checksums
067283221d8c6aa82cc4b88de082cc866181eca3b29aa209ab82cb563341838e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / nhatnguyet-0.1.0-py3-none-any.whl

Download URL nhatnguyet-0.1.0-py3-none-any.whl
Size 134.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
854b5c96ee2a0f0261889eba4848abcd4b18cd96fa3e9bb3b23395a371530dee
BLAKE2b-256 checksum
How to use checksums
ff71b8e443251c4158d7ae18693c00decff2cd42b5505f2cbb60168af6d08859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for nhatnguyet 0.1.0

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.

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