sanmiao 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.
sanmiao-0.1.0/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright © 2025 Daniel Patrick MORGAN
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ include README.md include LICENSE include src/sanmiao/data/*.csv
sanmiao-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: sanmiao
3
+ Version: 0.1.0
4
+ Summary: A Python package for date conversion to and from Chinese and Japanese historical calendars
5
+ Author-email: Daniel Patrick Morgan <daniel.morgan@college-de-france.fr>
6
+ Project-URL: Homepage, https://github.com/PotatoSinology/sanmiao
7
+ Project-URL: Repository, https://github.com/PotatoSinology/sanmiao.git
8
+ Project-URL: Issues, https://github.com/PotatoSinology/sanmiao/issues
9
+ Keywords: date conversion,Chinese calendar,Japanese calendar,history,history of astronomy,astronomy
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Education
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Requires-Python: >=3.7
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pandas>=1.3.5
26
+ Requires-Dist: numpy>=1.21.0
27
+ Requires-Dist: lxml>=4.6.0
28
+ Requires-Dist: importlib_resources>=5.0; python_version < "3.9"
29
+ Dynamic: license-file
30
+
31
+ # Sanmiao
32
+ > **Chinese and Japanese historical date conversion in Python**.
33
+
34
+ Author: Daniel Patrick Morgan (CNRS-CRCAO)
35
+
36
+ Sanmiao is a Python package for date conversion to and from Chinese and Japanese historical calendars (3rd cent. B.C.–20th cent.) written by a historian of astronomy.
37
+
38
+ GitHub: [https://github.com/architest/pymeeus](https://github.com/architest/pymeeus)
39
+
40
+ ## Installation
41
+
42
+ The easiest way of installing Sanmiao is using pip:
43
+
44
+ ```sh
45
+ pip install sanmiao
46
+ ```
47
+
48
+ If you prefer Python3, you can use:
49
+
50
+ ```sh
51
+ pip3 install --user sanmiao
52
+ ```
53
+
54
+ If you have Sanmiao already installed, but want to upgrade to the latest version:
55
+
56
+ ```sh
57
+ pip3 install -U sanmiao
58
+ ```
59
+
60
+ ## Using Sanmiao
61
+
62
+ Sanmiao uses the astronomical year, where 1 B.C. = 0, 100 B.C. = -99, etc. It recognizes years (e.g., 534), Y-M-D date strings (e.g., -99-3-5, 1532-6-4), Julian Day Numbers (e.g., 1684971.5), and Chinese date strings of differing precision and completeness (e.g., "東漢孝獻皇帝劉協建安十八年二月," "太祖元年," or "三年三月甲申"). These should be separated by commas, semicolons, or line breaks:
63
+
64
+ ```Python
65
+ import sanmiao
66
+
67
+ user_input = """
68
+ 東漢孝獻皇帝劉協建安十八年二月,
69
+ 宋太祖三年四月
70
+ 313-12-10,
71
+ 415, 416, 417
72
+ """
73
+ result = sanmiao.cjk_date_interpreter(user_input)
74
+ ```
75
+ ## Sources
76
+ What distinguishes this date convertor from others is that it uses historical tables based, notably those of Zhang Peiyu[^1] and Uchida Masao,[^2] and it is updated to include new archeological evidence[^3] as well as minor dynasties and reign eras. The tables are based on calculation from contemporary procedure texts (_lifa_ 曆法), eclipses, and recorded dates, and I plan to expand them in future versions to include Korean tables and independantly calculated new moons for minor dynasties running different calendars.
77
+
78
+ [^1]: Zhang Peiyu 張培瑜, _Sanqianwubai nian liri tianxiang_ 三千五百年曆日天象 (Zhengzhou: Daxiang chubanshe, 1997).
79
+ [^2]: Uchida Masao, _Nihon rekijitsu genten_ 日本暦日原典 (Tōkyō : Yūzankaku shuppan , 1975).
80
+ [^3]: E.g., Zhang Peiyu 張培瑜, "Genju xinchu liri jiandu shilun Qin he Han chu de lifa" 根据新出歷日簡牘試論秦和漢初的曆法, _Zhongyuan wenwu_ 中原文物 2007.5: 62–77.
81
+
82
+ ## Contributing
83
+
84
+ The preferred method to contribute is through forking and pull requests:
85
+
86
+ 1. Fork it (<https://github.com/PotatoSinology/sanmiao/fork>)
87
+ 2. Create your feature branch (`git checkout -b feature/fooBar`)
88
+ 3. Commit your changes (`git commit -am 'Add some fooBar'`)
89
+ 4. Push to the branch (`git push origin feature/fooBar`)
90
+ 5. Create a new Pull Request
@@ -0,0 +1,60 @@
1
+ # Sanmiao
2
+ > **Chinese and Japanese historical date conversion in Python**.
3
+
4
+ Author: Daniel Patrick Morgan (CNRS-CRCAO)
5
+
6
+ Sanmiao is a Python package for date conversion to and from Chinese and Japanese historical calendars (3rd cent. B.C.–20th cent.) written by a historian of astronomy.
7
+
8
+ GitHub: [https://github.com/architest/pymeeus](https://github.com/architest/pymeeus)
9
+
10
+ ## Installation
11
+
12
+ The easiest way of installing Sanmiao is using pip:
13
+
14
+ ```sh
15
+ pip install sanmiao
16
+ ```
17
+
18
+ If you prefer Python3, you can use:
19
+
20
+ ```sh
21
+ pip3 install --user sanmiao
22
+ ```
23
+
24
+ If you have Sanmiao already installed, but want to upgrade to the latest version:
25
+
26
+ ```sh
27
+ pip3 install -U sanmiao
28
+ ```
29
+
30
+ ## Using Sanmiao
31
+
32
+ Sanmiao uses the astronomical year, where 1 B.C. = 0, 100 B.C. = -99, etc. It recognizes years (e.g., 534), Y-M-D date strings (e.g., -99-3-5, 1532-6-4), Julian Day Numbers (e.g., 1684971.5), and Chinese date strings of differing precision and completeness (e.g., "東漢孝獻皇帝劉協建安十八年二月," "太祖元年," or "三年三月甲申"). These should be separated by commas, semicolons, or line breaks:
33
+
34
+ ```Python
35
+ import sanmiao
36
+
37
+ user_input = """
38
+ 東漢孝獻皇帝劉協建安十八年二月,
39
+ 宋太祖三年四月
40
+ 313-12-10,
41
+ 415, 416, 417
42
+ """
43
+ result = sanmiao.cjk_date_interpreter(user_input)
44
+ ```
45
+ ## Sources
46
+ What distinguishes this date convertor from others is that it uses historical tables based, notably those of Zhang Peiyu[^1] and Uchida Masao,[^2] and it is updated to include new archeological evidence[^3] as well as minor dynasties and reign eras. The tables are based on calculation from contemporary procedure texts (_lifa_ 曆法), eclipses, and recorded dates, and I plan to expand them in future versions to include Korean tables and independantly calculated new moons for minor dynasties running different calendars.
47
+
48
+ [^1]: Zhang Peiyu 張培瑜, _Sanqianwubai nian liri tianxiang_ 三千五百年曆日天象 (Zhengzhou: Daxiang chubanshe, 1997).
49
+ [^2]: Uchida Masao, _Nihon rekijitsu genten_ 日本暦日原典 (Tōkyō : Yūzankaku shuppan , 1975).
50
+ [^3]: E.g., Zhang Peiyu 張培瑜, "Genju xinchu liri jiandu shilun Qin he Han chu de lifa" 根据新出歷日簡牘試論秦和漢初的曆法, _Zhongyuan wenwu_ 中原文物 2007.5: 62–77.
51
+
52
+ ## Contributing
53
+
54
+ The preferred method to contribute is through forking and pull requests:
55
+
56
+ 1. Fork it (<https://github.com/PotatoSinology/sanmiao/fork>)
57
+ 2. Create your feature branch (`git checkout -b feature/fooBar`)
58
+ 3. Commit your changes (`git commit -am 'Add some fooBar'`)
59
+ 4. Push to the branch (`git push origin feature/fooBar`)
60
+ 5. Create a new Pull Request
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sanmiao"
7
+ version = "0.1.0"
8
+ authors = [
9
+ {name = "Daniel Patrick Morgan", email = "daniel.morgan@college-de-france.fr"}
10
+ ]
11
+ description = "A Python package for date conversion to and from Chinese and Japanese historical calendars"
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ dependencies = [
15
+ "pandas>=1.3.5",
16
+ "numpy>=1.21.0", # Minimum compatible with Python 3.7
17
+ "lxml>=4.6.0", # Minimum compatible with Python 3.7
18
+ "importlib_resources>=5.0; python_version < '3.9'"
19
+ ]
20
+ keywords = ["date conversion", "Chinese calendar", "Japanese calendar", "history", "history of astronomy", "astronomy"]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Education",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.7",
27
+ "Programming Language :: Python :: 3.8",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Topic :: Scientific/Engineering"
34
+ ]
35
+ [project.urls]
36
+ Homepage = "https://github.com/PotatoSinology/sanmiao"
37
+ Repository = "https://github.com/PotatoSinology/sanmiao.git"
38
+ Issues = "https://github.com/PotatoSinology/sanmiao/issues"
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ __version__ = "0.1.0"
2
+
3
+ from .sanmiao import gz_year, jdn_to_gz, ganshu, numcon, iso_to_jdn, jdn_to_iso, jy_to_ccs, cjk_date_interpreter
@@ -0,0 +1,143 @@
1
+ dyn_id,dyn_name,dyn_start_year,dyn_end_year,cal_stream,part_of
2
+ 1,先秦,-5999,-220,,
3
+ 2,三皇五帝,-5999,-2001,,
4
+ 3,夏,-2001,-1558,,
5
+ 4,商,-1574,-1044,,
6
+ 5,周,-1044,-475,,
7
+ 6,西周,-1044,-770,,5
8
+ 7,春秋,-721,-480,,
9
+ 8,戰國,-480,-220,,
10
+ 9,東周,-770,-475,,5
11
+ 10,魯,-1042,-255,,
12
+ 11,齊,-999,-220,,
13
+ 12,姜齊,,,,
14
+ 13,田齊,,,,11
15
+ 14,晉,-1041,-348,,
16
+ 15,秦,-899,-205,,
17
+ 16,楚,-845,,,
18
+ 17,宋,-857,,,
19
+ 18,衛,-865,,,
20
+ 19,鄭,-805,,,
21
+ 20,燕,-863,,,
22
+ 21,吳,-584,,,
23
+ 22,越,-620,,,
24
+ 23,蔡,-862,-446,,
25
+ 24,曹,-1044,,,
26
+ 25,陳,-853,,,
27
+ 26,杞,-749,,,
28
+ 27,滕,-650,,,
29
+ 28,韓,-407,,,
30
+ 29,魏,-444,,,
31
+ 30,趙,-407,,,
32
+ 31,,,,,
33
+ 32,,,,,
34
+ 33,,,,,
35
+ 34,,,,,
36
+ 35,,,,,
37
+ 36,,,,,
38
+ 37,,,,,
39
+ 38,,,,,
40
+ 39,,,,,
41
+ 40,,,,,
42
+ 41,秦,-220,-205,1,
43
+ 42,漢,-205,220,1,
44
+ 43,西漢,-205,9,1,42
45
+ 44,新,9,25,1,
46
+ 45,更始,,,1,
47
+ 46,東漢,25,220,1,42
48
+ 47,三國,220,265,1,
49
+ 48,三國魏,220,265,1,
50
+ 49,三國蜀,221,263,1,
51
+ 50,三國吳,222,280,1,
52
+ 51,晉,265,419,1,
53
+ 52,西晉,265,316,1,51
54
+ 53,東晉,317,419,1,51
55
+ 54,北漢,304,318,1,
56
+ 55,前趙,318,329,1,
57
+ 56,成漢,304,347,1,
58
+ 57,後趙,319,351,1,
59
+ 58,前涼,317,376,1,
60
+ 59,前燕,337,370,1,
61
+ 60,,350,352,1,
62
+ 61,前仇池,296,371,1,
63
+ 62,前秦,350,394,1,
64
+ 63,後燕,384,407,1,
65
+ 64,後秦,384,417,1,
66
+ 65,西秦,385,431,1,
67
+ 66,後涼,386,403,1,
68
+ 67,南涼,397,414,1,
69
+ 68,北涼,401,439,1,
70
+ 69,南燕,398,410,1,
71
+ 70,西涼,400,421,1,
72
+ 71,夏,407,431,1,
73
+ 72,北燕,407,436,1,
74
+ 73,西燕,384,394,1,
75
+ 74,後仇池,385,473,1,
76
+ 75,西蜀,405,413,1,
77
+ 76,高昌,,,,
78
+ 77,,,,,
79
+ 78,,,,,
80
+ 79,,,,,
81
+ 80,,,,,
82
+ 81,拓跋魏,386,557,2,
83
+ 82,南北朝,420,589,,
84
+ 83,劉宋,420,479,1,
85
+ 84,南齊,479,502,1,
86
+ 85,南梁,502,557,1,
87
+ 86,東梁,555,587,1,
88
+ 87,西梁,557,560,1,
89
+ 88,陳,557,589,1,
90
+ 89,北魏,386,534,2,81
91
+ 90,武興,473,555,2,
92
+ 91,陰平,477,511,2,
93
+ 92,東魏,534,550,2,81
94
+ 93,西魏,535,557,3,81
95
+ 94,北齊,550,578,2,
96
+ 95,北周,557,581,3,
97
+ 96,隋,581,618,3,
98
+ 97,唐,618,907,3,
99
+ 98,鄭,619,621,3,
100
+ 99,周,684,705,3,
101
+ 100,前蜀,903,925,3,
102
+ 101,吳,904,937,3,
103
+ 102,吳,904,937,3,
104
+ 103,五代,907,960,3,
105
+ 104,吳越,907,978,3,
106
+ 105,後梁,907,923,3,
107
+ 106,楚,907,951,3,
108
+ 107,閩國,909,945,3,
109
+ 108,南漢,917,971,3,
110
+ 109,後唐,923,936,3,
111
+ 110,南平,924,963,3,
112
+ 111,後蜀,933,965,3,
113
+ 112,閩,909,925,3,
114
+ 113,後晉,936,947,3,
115
+ 114,南唐,937,975,3,
116
+ 115,遼,947,1115,3,
117
+ 116,後漢,947,951,3,
118
+ 117,後周,951,960,3,
119
+ 118,北漢,951,979,3,
120
+ 119,宋,960,1279,3,
121
+ 120,西夏,1032,1227,3,
122
+ 121,金,1115,1234,3,
123
+ 122,偽齊,1130,1137,3,
124
+ 123,西遼,1132,1218,3,
125
+ 124,元,1234,1367,3,
126
+ 125,明,1368,1644,3,
127
+ 126,北元,1371,1387,3,
128
+ 127,清,1644,1911,3,
129
+ 128,南明,1644,1661,3,
130
+ 129,中華民國,1912,3000,,
131
+ 130,中華人民共和國,1949,3000,,
132
+ 131,偽燕,,,3,
133
+ 132,北宋,,,3,
134
+ 133,日本,-2000,3000,4,
135
+ 134,高句麗,-36,668,5,
136
+ 135,百濟,-17,660,6,
137
+ 136,新羅,-56,935,7,
138
+ 137,金官伽倻,42,532,8,
139
+ 138,渤海,698,926,5,
140
+ 139,後百濟,900,936,6,
141
+ 140,後高句麗,901,918,5,
142
+ 141,高麗,918,1392,5,
143
+ 142,朝鮮,1392,1910,5,
@@ -0,0 +1,127 @@
1
+ string,dyn_id
2
+ 夏,3
3
+ 商,4
4
+ 殷,4
5
+ 殷商,4
6
+ 周,5
7
+ 西周,6
8
+ 東周,9
9
+ 秦,41
10
+ 漢,42
11
+ 前漢,43
12
+ 西漢,43
13
+ 新,44
14
+ 更始,45
15
+ 後漢,46
16
+ 東漢,46
17
+ 曹魏,48
18
+ 魏,48
19
+ 蜀,49
20
+ 吳,50
21
+ 晉,51
22
+ 西晉,52
23
+ 東晉,53
24
+ 趙,55
25
+ 成漢,56
26
+ 趙,57
27
+ 涼,58
28
+ 燕,59
29
+ 冉魏,60
30
+ 前秦,62
31
+ 後燕,63
32
+ 後秦,64
33
+ 西秦,65
34
+ 後涼,66
35
+ 南涼,67
36
+ 北涼,68
37
+ 南燕,69
38
+ 西涼,70
39
+ 北燕,72
40
+ 西燕,73
41
+ 劉宋,83
42
+ 宋,83
43
+ 南宋,83
44
+ 南齊,84
45
+ 齊,84
46
+ 南梁,85
47
+ 梁,85
48
+ 梁,86
49
+ 梁,87
50
+ 西梁,87
51
+ 陳,88
52
+ 北魏,89
53
+ 魏,89
54
+ 東魏,92
55
+ 魏,92
56
+ 西魏,93
57
+ 魏,93
58
+ 北齊,94
59
+ 齊,94
60
+ 北周,95
61
+ 周,95
62
+ 隋,96
63
+ 唐,97
64
+ 周,99
65
+ 武周,99
66
+ 前蜀,100
67
+ 吳,101
68
+ 吳,102
69
+ 吳越,104
70
+ 後梁,105
71
+ 楚,106
72
+ 閩國,107
73
+ 南漢,108
74
+ 後唐,109
75
+ 南平,110
76
+ 後蜀,111
77
+ 閩,112
78
+ 後晉,113
79
+ 南唐,114
80
+ 遼,115
81
+ 後漢,116
82
+ 後周,117
83
+ 北漢,118
84
+ 宋,119
85
+ 西夏,120
86
+ 金,121
87
+ 偽齊,122
88
+ 西遼,123
89
+ 元,124
90
+ 明,125
91
+ 北元,126
92
+ 清,127
93
+ 南明,128
94
+ 中華民國,129
95
+ 中華人民共和國,130
96
+ 偽燕,131
97
+ 北宋,132
98
+ 北魏,89
99
+ 北齊,94
100
+ 晉,14
101
+ 秦,15
102
+ 楚,16
103
+ 宋,17
104
+ 衛,18
105
+ 鄭,19
106
+ 燕,20
107
+ 吳,21
108
+ 越,22
109
+ 蔡,23
110
+ 曹,24
111
+ 陳,25
112
+ 杞,26
113
+ 滕,27
114
+ 韓,28
115
+ 魏,29
116
+ 趙,30
117
+ 魯,10
118
+ 齊,11
119
+ 偽梁,85
120
+ 六國,8
121
+ 朝鮮,142
122
+ 高麗,141
123
+ 後百濟,139
124
+ 百濟,139
125
+ 後高句麗,140
126
+ 高句麗,140
127
+ 新羅,136