nhatnguyet 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nhatnguyet-0.1.0/LICENSE +21 -0
- nhatnguyet-0.1.0/PKG-INFO +74 -0
- nhatnguyet-0.1.0/README.md +54 -0
- nhatnguyet-0.1.0/nhatnguyet/__init__.py +16 -0
- nhatnguyet-0.1.0/nhatnguyet/am_lich.py +844 -0
- nhatnguyet-0.1.0/nhatnguyet/bat_tu.py +763 -0
- nhatnguyet-0.1.0/nhatnguyet/du_lieu/le-hoi-viet-nam.json +5002 -0
- nhatnguyet-0.1.0/nhatnguyet/du_lieu/nguon.json +8 -0
- nhatnguyet-0.1.0/nhatnguyet/le_hoi.py +96 -0
- nhatnguyet-0.1.0/nhatnguyet/than_so_hoc.py +242 -0
- nhatnguyet-0.1.0/nhatnguyet/tu_vi.py +62 -0
- nhatnguyet-0.1.0/nhatnguyet/tu_vi_cach_cuc.py +555 -0
- nhatnguyet-0.1.0/nhatnguyet/tu_vi_du_lieu.py +190 -0
- nhatnguyet-0.1.0/nhatnguyet/tu_vi_han.py +284 -0
- nhatnguyet-0.1.0/nhatnguyet/tu_vi_lap_so.py +382 -0
- nhatnguyet-0.1.0/nhatnguyet.egg-info/PKG-INFO +74 -0
- nhatnguyet-0.1.0/nhatnguyet.egg-info/SOURCES.txt +24 -0
- nhatnguyet-0.1.0/nhatnguyet.egg-info/dependency_links.txt +1 -0
- nhatnguyet-0.1.0/nhatnguyet.egg-info/top_level.txt +1 -0
- nhatnguyet-0.1.0/pyproject.toml +32 -0
- nhatnguyet-0.1.0/setup.cfg +4 -0
- nhatnguyet-0.1.0/tests/test_am_lich.py +67 -0
- nhatnguyet-0.1.0/tests/test_bat_tu.py +49 -0
- nhatnguyet-0.1.0/tests/test_le_hoi.py +24 -0
- nhatnguyet-0.1.0/tests/test_than_so_hoc.py +30 -0
- nhatnguyet-0.1.0/tests/test_tu_vi.py +48 -0
nhatnguyet-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nhat Nguyet (nhatnguyet.org)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nhatnguyet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tử Vi, Bát Tự, Thần số học, âm lịch Việt Nam và Trung Quốc, lễ hội: Zi Wei Dou Shu, BaZi, numerology, lunar calendar. Nhật Nguyệt (nhatnguyet.org)
|
|
5
|
+
Author: Nhat Nguyet
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://nhatnguyet.org/ma-nguon-mo
|
|
8
|
+
Project-URL: Repository, https://github.com/Nhat-Nguyet/nhatnguyet
|
|
9
|
+
Project-URL: Documentation, https://github.com/Nhat-Nguyet/nhatnguyet/blob/main/README.en.md
|
|
10
|
+
Project-URL: Issues, https://github.com/Nhat-Nguyet/nhatnguyet/issues
|
|
11
|
+
Keywords: tu vi,zi wei dou shu,bazi,four pillars,numerology,than so hoc,am lich,lunar calendar,vietnamese calendar,chinese calendar,solar terms,festivals
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Natural Language :: Vietnamese
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# nhatnguyet (Python)
|
|
22
|
+
|
|
23
|
+
> **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](https://nhatnguyet.org)). Full docs: [github.com/Nhat-Nguyet/nhatnguyet](https://github.com/Nhat-Nguyet/nhatnguyet/blob/main/README.en.md).
|
|
24
|
+
|
|
25
|
+
Bản Python của lõi tính Nhật Nguyệt (nhatnguyet.org): âm lịch Việt Nam, can chi,
|
|
26
|
+
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,
|
|
27
|
+
không phụ thuộc, Python 3.9 trở lên. Giấy phép MIT.
|
|
28
|
+
|
|
29
|
+
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ộ
|
|
30
|
+
ca kiểm do lõi Go sinh ra (`../ca-kiem/*.json`): 8.960 ca âm lịch và 600 ca thần
|
|
31
|
+
số học, khớp từng trường.
|
|
32
|
+
|
|
33
|
+
## Cài và kiểm
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install .
|
|
37
|
+
python3 -m unittest discover -s tests
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Dùng
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from nhatnguyet import am_lich, than_so_hoc
|
|
44
|
+
|
|
45
|
+
am_lich.solar_to_lunar(17, 2, 2026) # {'day': 1, 'month': 1, 'year': 2026, 'leap': False}
|
|
46
|
+
am_lich.lunar_to_solar(1, 1, 2026, False) # ({'day': 17, 'month': 2, 'year': 2026}, True)
|
|
47
|
+
am_lich.day_can_chi(17, 2, 2026) # {'can': 'Nhâm', 'chi': 'Tuất', 'label': 'Nhâm Tuất'}
|
|
48
|
+
am_lich.moc_tiet_khi_trong_nam(2026) # 24 mốc tiết khí, giờ Việt Nam, tới phút
|
|
49
|
+
|
|
50
|
+
than_so_hoc.tinh_ho_so_than_so_hoc_sau("Nguyễn Văn An", 1, 10, 1960, 2026, 1, 1)
|
|
51
|
+
|
|
52
|
+
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
|
|
53
|
+
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ờ
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quy ước tên
|
|
57
|
+
|
|
58
|
+
- Tên hàm là tên hàm Go viết kiểu snake_case, GIỮ NGHĨA của Go:
|
|
59
|
+
`SolarToLunar` thành `solar_to_lunar` (dương sang âm), `LunarToSolar` thành
|
|
60
|
+
`lunar_to_solar` (âm sang dương), `TinhHoSoThanSoHocSau` thành
|
|
61
|
+
`tinh_ho_so_than_so_hoc_sau`.
|
|
62
|
+
- Kết quả là `dict` mang đúng khoá camelCase của bộ ca kiểm (`soDuongDoi`,
|
|
63
|
+
`canChiNgay`, `kinhDo`...). Ngày dương là `{"day", "month", "year"}`, ngày
|
|
64
|
+
âm thêm `"leap"`.
|
|
65
|
+
- Mọi phép tính lịch theo giờ Việt Nam UTC+7 cho mọi năm.
|
|
66
|
+
- Thần số học: tháng và ngày cá nhân tính theo `thang_xem`, `ngay_xem` truyền
|
|
67
|
+
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`).
|
|
68
|
+
|
|
69
|
+
## Ghi công
|
|
70
|
+
|
|
71
|
+
Công thức thiên văn theo Jean Meeus, "Astronomical Algorithms"; ΔT theo Espenak
|
|
72
|
+
và Meeus (NASA, 2006). Quy tắc dựng tháng là quy tắc chung của lịch âm dương
|
|
73
|
+
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
|
|
74
|
+
của Nhật Nguyệt.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# nhatnguyet (Python)
|
|
2
|
+
|
|
3
|
+
> **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](https://nhatnguyet.org)). Full docs: [github.com/Nhat-Nguyet/nhatnguyet](https://github.com/Nhat-Nguyet/nhatnguyet/blob/main/README.en.md).
|
|
4
|
+
|
|
5
|
+
Bản Python của lõi tính Nhật Nguyệt (nhatnguyet.org): âm lịch Việt Nam, can chi,
|
|
6
|
+
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,
|
|
7
|
+
không phụ thuộc, Python 3.9 trở lên. Giấy phép MIT.
|
|
8
|
+
|
|
9
|
+
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ộ
|
|
10
|
+
ca kiểm do lõi Go sinh ra (`../ca-kiem/*.json`): 8.960 ca âm lịch và 600 ca thần
|
|
11
|
+
số học, khớp từng trường.
|
|
12
|
+
|
|
13
|
+
## Cài và kiểm
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install .
|
|
17
|
+
python3 -m unittest discover -s tests
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Dùng
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from nhatnguyet import am_lich, than_so_hoc
|
|
24
|
+
|
|
25
|
+
am_lich.solar_to_lunar(17, 2, 2026) # {'day': 1, 'month': 1, 'year': 2026, 'leap': False}
|
|
26
|
+
am_lich.lunar_to_solar(1, 1, 2026, False) # ({'day': 17, 'month': 2, 'year': 2026}, True)
|
|
27
|
+
am_lich.day_can_chi(17, 2, 2026) # {'can': 'Nhâm', 'chi': 'Tuất', 'label': 'Nhâm Tuất'}
|
|
28
|
+
am_lich.moc_tiet_khi_trong_nam(2026) # 24 mốc tiết khí, giờ Việt Nam, tới phút
|
|
29
|
+
|
|
30
|
+
than_so_hoc.tinh_ho_so_than_so_hoc_sau("Nguyễn Văn An", 1, 10, 1960, 2026, 1, 1)
|
|
31
|
+
|
|
32
|
+
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
|
|
33
|
+
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ờ
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quy ước tên
|
|
37
|
+
|
|
38
|
+
- Tên hàm là tên hàm Go viết kiểu snake_case, GIỮ NGHĨA của Go:
|
|
39
|
+
`SolarToLunar` thành `solar_to_lunar` (dương sang âm), `LunarToSolar` thành
|
|
40
|
+
`lunar_to_solar` (âm sang dương), `TinhHoSoThanSoHocSau` thành
|
|
41
|
+
`tinh_ho_so_than_so_hoc_sau`.
|
|
42
|
+
- Kết quả là `dict` mang đúng khoá camelCase của bộ ca kiểm (`soDuongDoi`,
|
|
43
|
+
`canChiNgay`, `kinhDo`...). Ngày dương là `{"day", "month", "year"}`, ngày
|
|
44
|
+
âm thêm `"leap"`.
|
|
45
|
+
- Mọi phép tính lịch theo giờ Việt Nam UTC+7 cho mọi năm.
|
|
46
|
+
- Thần số học: tháng và ngày cá nhân tính theo `thang_xem`, `ngay_xem` truyền
|
|
47
|
+
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`).
|
|
48
|
+
|
|
49
|
+
## Ghi công
|
|
50
|
+
|
|
51
|
+
Công thức thiên văn theo Jean Meeus, "Astronomical Algorithms"; ΔT theo Espenak
|
|
52
|
+
và Meeus (NASA, 2006). Quy tắc dựng tháng là quy tắc chung của lịch âm dương
|
|
53
|
+
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
|
|
54
|
+
của Nhật Nguyệt.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Nhật Nguyệt: lõi tính âm lịch và thần số học (bản Python của lõi Go).
|
|
2
|
+
|
|
3
|
+
Mô-đun:
|
|
4
|
+
|
|
5
|
+
- ``nhatnguyet.am_lich``: đổi lịch dương, âm theo giờ Việt Nam (UTC+7), can
|
|
6
|
+
chi, 24 tiết khí, Nhị Thập Bát Tú, ngũ hành, nạp âm.
|
|
7
|
+
- ``nhatnguyet.than_so_hoc``: hồ sơ thần số học theo họ tên và ngày sinh.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from . import am_lich, than_so_hoc # noqa: F401
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
# Phiên bản lõi tính Go mà bộ ca kiểm đã sinh ra (phienBanDongCo).
|
|
14
|
+
PHIEN_BAN_DONG_CO = "2.0.0"
|
|
15
|
+
|
|
16
|
+
__all__ = ["am_lich", "than_so_hoc", "__version__", "PHIEN_BAN_DONG_CO"]
|