pysaju 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.
Files changed (64) hide show
  1. pysaju-0.1.0/.gitignore +44 -0
  2. pysaju-0.1.0/LICENSE +202 -0
  3. pysaju-0.1.0/NOTICE +33 -0
  4. pysaju-0.1.0/PKG-INFO +170 -0
  5. pysaju-0.1.0/README.md +140 -0
  6. pysaju-0.1.0/pyproject.toml +192 -0
  7. pysaju-0.1.0/src/pysaju/__init__.py +137 -0
  8. pysaju-0.1.0/src/pysaju/_compat.py +20 -0
  9. pysaju-0.1.0/src/pysaju/_validation.py +110 -0
  10. pysaju-0.1.0/src/pysaju/_version.py +24 -0
  11. pysaju-0.1.0/src/pysaju/astro/__init__.py +3 -0
  12. pysaju-0.1.0/src/pysaju/astro/_delta_t_table.py +89 -0
  13. pysaju-0.1.0/src/pysaju/astro/_moon.py +91 -0
  14. pysaju-0.1.0/src/pysaju/astro/_terms_table.py +782 -0
  15. pysaju-0.1.0/src/pysaju/astro/_vsop87.py +235 -0
  16. pysaju-0.1.0/src/pysaju/astro/_vsop87_file.py +48 -0
  17. pysaju-0.1.0/src/pysaju/astro/ephemeris.py +315 -0
  18. pysaju-0.1.0/src/pysaju/astro/solar_terms.py +119 -0
  19. pysaju-0.1.0/src/pysaju/astro/sun.py +22 -0
  20. pysaju-0.1.0/src/pysaju/constants.py +49 -0
  21. pysaju-0.1.0/src/pysaju/elements.py +34 -0
  22. pysaju-0.1.0/src/pysaju/exceptions.py +15 -0
  23. pysaju-0.1.0/src/pysaju/features/__init__.py +3 -0
  24. pysaju-0.1.0/src/pysaju/features/luck_pillars.py +89 -0
  25. pysaju-0.1.0/src/pysaju/features/ten_gods.py +61 -0
  26. pysaju-0.1.0/src/pysaju/features/void_branches.py +22 -0
  27. pysaju-0.1.0/src/pysaju/ganji.py +29 -0
  28. pysaju-0.1.0/src/pysaju/lunar/__init__.py +3 -0
  29. pysaju-0.1.0/src/pysaju/lunar/_rules.py +113 -0
  30. pysaju-0.1.0/src/pysaju/lunar/_table.py +744 -0
  31. pysaju-0.1.0/src/pysaju/lunar/calendar_table.py +63 -0
  32. pysaju-0.1.0/src/pysaju/lunar/convert.py +78 -0
  33. pysaju-0.1.0/src/pysaju/models/__init__.py +29 -0
  34. pysaju-0.1.0/src/pysaju/models/dates.py +24 -0
  35. pysaju-0.1.0/src/pysaju/models/luck.py +38 -0
  36. pysaju-0.1.0/src/pysaju/models/pillar.py +151 -0
  37. pysaju-0.1.0/src/pysaju/models/saju.py +28 -0
  38. pysaju-0.1.0/src/pysaju/models/solar_term.py +20 -0
  39. pysaju-0.1.0/src/pysaju/models/ten_gods.py +33 -0
  40. pysaju-0.1.0/src/pysaju/models/true_solar_time.py +37 -0
  41. pysaju-0.1.0/src/pysaju/options.py +35 -0
  42. pysaju-0.1.0/src/pysaju/pillars.py +87 -0
  43. pysaju-0.1.0/src/pysaju/py.typed +0 -0
  44. pysaju-0.1.0/src/pysaju/saju.py +107 -0
  45. pysaju-0.1.0/src/pysaju/solar_time/__init__.py +3 -0
  46. pysaju-0.1.0/src/pysaju/solar_time/_kst_table.py +49 -0
  47. pysaju-0.1.0/src/pysaju/solar_time/civil.py +55 -0
  48. pysaju-0.1.0/src/pysaju/solar_time/true_solar_time.py +46 -0
  49. pysaju-0.1.0/tests/__init__.py +0 -0
  50. pysaju-0.1.0/tests/clock.py +16 -0
  51. pysaju-0.1.0/tests/kasi.py +95 -0
  52. pysaju-0.1.0/tests/test_civil_time.py +98 -0
  53. pysaju-0.1.0/tests/test_crossvalidation.py +282 -0
  54. pysaju-0.1.0/tests/test_docs.py +280 -0
  55. pysaju-0.1.0/tests/test_ephemeris.py +352 -0
  56. pysaju-0.1.0/tests/test_lunar_calendar.py +259 -0
  57. pysaju-0.1.0/tests/test_models.py +159 -0
  58. pysaju-0.1.0/tests/test_packaging.py +165 -0
  59. pysaju-0.1.0/tests/test_saju.py +556 -0
  60. pysaju-0.1.0/tests/test_solar_terms.py +208 -0
  61. pysaju-0.1.0/tests/test_style.py +154 -0
  62. pysaju-0.1.0/tests/test_tables.py +82 -0
  63. pysaju-0.1.0/tests/test_validation.py +224 -0
  64. pysaju-0.1.0/tests/vsop87.py +23 -0
@@ -0,0 +1,44 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .ty_cache/
11
+ .DS_Store
12
+
13
+ # 커버리지 산출물
14
+ .coverage
15
+ .coverage.*
16
+ coverage.xml
17
+ junit.xml
18
+ htmlcov/
19
+
20
+ # hatch-vcs 가 빌드 시 생성
21
+ src/pysaju/_version.py
22
+
23
+ # 출처 검사의 금지 토큰 출처 체크아웃 — 절대 커밋하지 않습니다 (AGENTS.md §1).
24
+ # 출처를 저장소에 남기지 않기 위해 URL 도, 이 디렉터리의 내용도 이력에 들어가면 안 됩니다.
25
+ /.upstream/
26
+
27
+ # 전역 gitignore 가 .claude/ 를 막아도 서브에이전트·스킬은 저장소의 일부입니다
28
+ # (.agents/skills 심볼릭 링크가 가리키는 원본). 개인 설정만 제외합니다.
29
+ !/.claude/
30
+ /.claude/settings.local.json
31
+
32
+ # KASI 원자료(음양력·역서 절입) — 공공누리 표시가 없어 이용 조건을 확인할 때까지 커밋하지 않고 로컬에만 둡니다.
33
+ # scripts/fetch_kasi.py·fetch_kasi_almanac.py 로 받습니다. 없으면 이 자료를 쓰는 테스트와 생성기 대조는 건너뜁니다.
34
+ /data/kasi/lunar_months.csv
35
+ /data/kasi/almanac_solar_terms.csv
36
+
37
+ # 로컬 실험용 스크립트
38
+ /a.py
39
+ /scratch*.py
40
+ /local/
41
+
42
+ .env
43
+ .env.*
44
+ !.env.example
pysaju-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
pysaju-0.1.0/NOTICE ADDED
@@ -0,0 +1,33 @@
1
+ pysaju
2
+ Copyright 2026 devgyurak
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Third-party data
7
+ ----------------
8
+
9
+ Lunar calendar data for lunar years 1391-2050 (src/pysaju/lunar/_table.py; the
10
+ raw data fetched by scripts/fetch_kasi.py is not included in this repository)
11
+ was obtained from the lunisolar calendar service of
12
+ the Korea Astronomy and Space Science Institute
13
+ (KASI, 한국천문연구원; "한국천문연구원_음양력 정보", https://astro.kasi.re.kr/).
14
+
15
+ Solar term instants for 1800-2300 (src/pysaju/astro/_terms_table.py) were
16
+ computed with the VSOP87D planetary theory (Bretagnon & Francou, 1988), using
17
+ the Earth series file distributed by IMCCE (data/vsop87/VSOP87D.ear), with the
18
+ IAU 2000 precession-rate correction given in the IERS Conventions (2010).
19
+
20
+ Tests can optionally compare solar term instants against the "24기" tables of
21
+ the Korean Astronomical Almanac (역서) published annually by KASI. That data is
22
+ fetched locally by scripts/fetch_kasi_almanac.py and is not included in this
23
+ repository or in the distributed package.
24
+
25
+ Observed Delta T for 1962 onward (src/pysaju/astro/_delta_t_table.py,
26
+ data/delta_t/) is derived from the IERS Earth Orientation Parameters (EOP C04,
27
+ IERS Earth Orientation Centre, Paris Observatory) and the IERS leap second
28
+ table, and from the Delta T data of the U.S. Naval Observatory. The monthly USNO
29
+ file kept in data/delta_t/usno_deltat.data is used only for verification and is
30
+ not part of the distributed package.
31
+
32
+ Korean civil time history (src/pysaju/solar_time/_kst_table.py) is derived from
33
+ the IANA Time Zone Database (Asia/Seoul), which is in the public domain.
pysaju-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.5
2
+ Name: pysaju
3
+ Version: 0.1.0
4
+ Summary: 사주팔자·음양력 변환·24절기·십신·대운·공망을 계산하는 의존성 없는 순수 파이썬 라이브러리
5
+ Project-URL: Homepage, https://github.com/devgyurak/pysaju
6
+ Project-URL: Source, https://github.com/devgyurak/pysaju
7
+ Project-URL: Issues, https://github.com/devgyurak/pysaju/issues
8
+ Author: devgyurak
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: bazi,four-pillars,korean,lunar-calendar,saju,solar-terms,true-solar-time,만세력,사주,음력,절기
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Natural Language :: Korean
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Programming Language :: Python :: 3.15
25
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.11
29
+ Description-Content-Type: text/markdown
30
+
31
+ <div align="center">
32
+
33
+ <h1 align="center">
34
+ <picture>
35
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/logo/pysaju-lockup-dark.svg">
36
+ <img src="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/logo/pysaju-lockup.svg" alt="pysaju" width="420">
37
+ </picture>
38
+ </h1>
39
+
40
+ **생년월일시로 사주팔자(四柱八字)를 계산하는 순수 파이썬 라이브러리**
41
+
42
+ [![CI](https://github.com/devgyurak/pysaju/actions/workflows/ci.yml/badge.svg)](https://github.com/devgyurak/pysaju/actions/workflows/ci.yml)
43
+ ![Python](https://img.shields.io/badge/python-3.11%2B-3776AB?logo=python&logoColor=white)
44
+ ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
45
+ ![Typed](https://img.shields.io/badge/typing-typed-blue)
46
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/devgyurak/pysaju/blob/main/LICENSE)
47
+
48
+ [설치](#설치) · [빠른 시작](#빠른-시작) · [문서](#문서) · [API 레퍼런스](https://github.com/devgyurak/pysaju/blob/main/docs/reference.md) · [정확도](https://github.com/devgyurak/pysaju/blob/main/docs/accuracy.md)
49
+
50
+ </div>
51
+
52
+ 네 기둥(연주·월주·일주·시주)을 뽑고, 양력과 음력을 오가고, 24절기 절입 시각을 구합니다.
53
+ 십신·공망·대운과 진태양시 보정도 들어 있습니다.
54
+
55
+ | 기능 | 주요 API | 받는 범위 |
56
+ | --- | --- | --- |
57
+ | [사주 네 기둥](https://github.com/devgyurak/pysaju/blob/main/docs/four-pillars.md) | `calculate_four_pillars` | 양력 1800~2300년 · 음력 입력은 1800~2100년 |
58
+ | [십신 · 공망 · 대운](https://github.com/devgyurak/pysaju/blob/main/docs/four-pillars.md#십신과-공망) | `get_ten_god` · `get_void_branches` · `get_luck_pillars` | 사주와 함께 계산 |
59
+ | [진태양시 보정](https://github.com/devgyurak/pysaju/blob/main/docs/true-solar-time.md) | `TrueSolarTime` | 경도 · 균시차 · 옛 표준시와 서머타임 |
60
+ | [양력 ↔ 음력](https://github.com/devgyurak/pysaju/blob/main/docs/calendar.md#양력과-음력) | `solar_to_lunar` · `lunar_to_solar` | 음력 1391~2100년 |
61
+ | [24절기 절입 시각](https://github.com/devgyurak/pysaju/blob/main/docs/calendar.md#24절기) | `get_solar_term` · `get_solar_terms_of_year` | 1~9999년 · 표로 고정한 구간은 1800~2300년 |
62
+
63
+ - **표준 라이브러리만 씁니다** — 따라오는 의존성이 없습니다.
64
+ - **결과는 바꿀 수 없습니다** — 전부 frozen 데이터클래스이고 타입 힌트(`py.typed`)가 붙어 있습니다.
65
+ - **계산만 합니다** — 풀이나 해석 문장은 만들지 않습니다.
66
+
67
+ ## 설치
68
+
69
+ 파이썬 3.11 이상.
70
+
71
+ ```bash
72
+ pip install pysaju # 또는: uv add pysaju
73
+ ```
74
+
75
+ ## 빠른 시작
76
+
77
+ ```python
78
+ from pysaju import calculate_four_pillars
79
+
80
+ saju = calculate_four_pillars(1987, 3, 8, 7, 40) # 1987년 3월 8일 07:40, 한국에서 기록된 시각
81
+
82
+ print(saju) # 정묘연주, 계묘월주, 병진일주, 임진시주
83
+ print(saju.to_hanja_string()) # 丁卯年柱, 癸卯月柱, 丙辰日柱, 壬辰時柱
84
+ print(saju.to_dict()) # {'year': '정묘', 'month': '계묘', 'day': '병진', 'hour': '임진'}
85
+ ```
86
+
87
+ 이 사주를 펼쳐 보면 이렇습니다. 여덟 글자 가운데 일간(日干) 병(丙)이 나머지를 읽는 기준입니다.
88
+
89
+ <p align="center">
90
+ <picture>
91
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/chart-dark.png">
92
+ <img width="720" src="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/chart-light.png" alt="1987년 3월 8일 07:40 의 명식. 시주 壬辰(임진), 일주 丙辰(병진), 월주 癸卯(계묘), 연주 丁卯(정묘). 일간은 丙(병, 화·양).">
93
+ </picture>
94
+ </p>
95
+
96
+ ## 조금 더
97
+
98
+ **음력 생일, 출생지, 밤 11시 생** — 전부 `calculate_four_pillars` 의 키워드 인자입니다.
99
+
100
+ ```python
101
+ from pysaju import TrueSolarTime
102
+
103
+ calculate_four_pillars(1987, 2, 9, 7, 40, lunar=True)
104
+ # 정묘연주, 계묘월주, 병진일주, 임진시주 ← 음력 1987년 2월 9일
105
+
106
+ calculate_four_pillars(1987, 3, 8, 9, 15, true_solar_time=TrueSolarTime(longitude=128.6))
107
+ # 정묘연주, 계묘월주, 병진일주, 임진시주 ← 대구의 해시계 기준(시계로는 계사시)
108
+
109
+ calculate_four_pillars(2000, 1, 1, 23, 30, day_boundary="jasi")
110
+ # 기묘연주, 병자월주, 기미일주, 갑자시주 ← 밤 11시부터 다음 날로
111
+ ```
112
+
113
+ **십신 · 공망 · 대운** — 십신과 공망은 늘 함께 나오고, 대운은 `gender` 를 줄 때 계산합니다.
114
+
115
+ ```python
116
+ saju = calculate_four_pillars(1987, 3, 8, 7, 40, gender="male")
117
+
118
+ saju.ten_gods.month # TenGodPair(stem='정관', branch='정인')
119
+ saju.void_branches # ('자', '축')
120
+ saju.luck_pillars.start_age # 1
121
+ [(p.age, p.korean) for p in saju.luck_pillars.pillars[:3]] # [(1, '임인'), (11, '신축'), (21, '경자')]
122
+ ```
123
+
124
+ **양력 ↔ 음력, 24절기** — 사주와 별개로 따로 쓸 수 있습니다.
125
+
126
+ ```python
127
+ from zoneinfo import ZoneInfo
128
+
129
+ from pysaju import get_solar_term, lunar_to_solar, solar_to_lunar
130
+
131
+ solar_to_lunar(2024, 2, 10) # LunarDate(year=2024, month=1, day=1, is_leap_month=False)
132
+ lunar_to_solar(2023, 2, 1, leap_month=True) # SolarDate(year=2023, month=3, day=22)
133
+
134
+ chunbun = get_solar_term(2025, 5) # 2025년 춘분
135
+ chunbun.date.astimezone(ZoneInfo("Asia/Seoul")).isoformat() # '2025-03-20T18:01:00+09:00'
136
+ ```
137
+
138
+ ## 문서
139
+
140
+ | 문서 | 내용 |
141
+ | --- | --- |
142
+ | [사주 계산](https://github.com/devgyurak/pysaju/blob/main/docs/four-pillars.md) | 결과 읽는 법, 음력 생일, 밤 11시 생, 십신·공망·대운, 입력 범위와 예외 |
143
+ | [진태양시](https://github.com/devgyurak/pysaju/blob/main/docs/true-solar-time.md) | 출생지 경도·균시차·옛 표준시와 서머타임으로 일주·시주를 다시 판정하기 |
144
+ | [양력·음력과 24절기](https://github.com/devgyurak/pysaju/blob/main/docs/calendar.md) | 날짜 변환, 절입 시각, 태양 황경과 균시차 |
145
+ | [정확도와 데이터 출처](https://github.com/devgyurak/pysaju/blob/main/docs/accuracy.md) | 지원 범위, 계산에 쓰는 자료, 다른 구현과의 대조 결과 |
146
+ | [API 레퍼런스](https://github.com/devgyurak/pysaju/blob/main/docs/reference.md) | 공개된 함수·모델·상수·예외 전부 |
147
+
148
+ ## 알아두면 좋은 것
149
+
150
+ - **정수 자리에는 `int` 만** — `2024.0` 같은 `float` 는 `TypeError` 입니다. 참·거짓을 묻는
151
+ `is_valid_solar_date` 만 예외 대신 `False` 를 돌려줍니다.
152
+ - **시각은 시간대가 붙은 `datetime` 으로** — 시간대가 없는 `datetime` 은 어느 나라 시각인지 알 수
153
+ 없어 `TypeError` 입니다.
154
+ - **잘못된 값은 예외로** — 범위 밖이거나 달력에 없는 날은 `pysaju.InvalidInputError` 입니다.
155
+ `ValueError` 를 상속하므로 `except ValueError` 로도 잡힙니다.
156
+ - **연주는 입춘에 바뀝니다** — 양력 1월 1일도 설날도 아닙니다. 절입은 분 단위로 가릅니다.
157
+
158
+ ## 개발
159
+
160
+ ```bash
161
+ uv sync --all-groups
162
+ uv run ruff format && uv run ruff check && uv run ty check && uv run pytest
163
+ ```
164
+
165
+ 테스트는 커버리지 90% 이상이어야 통과하고, 이 README 와 `docs/` 의 예제도 함께 실행해 확인합니다.
166
+ 커밋 전에 거치는 점검 전체와 코드 규약은 [AGENTS.md](https://github.com/devgyurak/pysaju/blob/main/AGENTS.md)에 있습니다.
167
+
168
+ ## 라이선스
169
+
170
+ Apache License 2.0. 전문은 [`LICENSE`](https://github.com/devgyurak/pysaju/blob/main/LICENSE), 저작권·데이터 출처 고지는 [`NOTICE`](https://github.com/devgyurak/pysaju/blob/main/NOTICE) 에 있습니다.
pysaju-0.1.0/README.md ADDED
@@ -0,0 +1,140 @@
1
+ <div align="center">
2
+
3
+ <h1 align="center">
4
+ <picture>
5
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/logo/pysaju-lockup-dark.svg">
6
+ <img src="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/logo/pysaju-lockup.svg" alt="pysaju" width="420">
7
+ </picture>
8
+ </h1>
9
+
10
+ **생년월일시로 사주팔자(四柱八字)를 계산하는 순수 파이썬 라이브러리**
11
+
12
+ [![CI](https://github.com/devgyurak/pysaju/actions/workflows/ci.yml/badge.svg)](https://github.com/devgyurak/pysaju/actions/workflows/ci.yml)
13
+ ![Python](https://img.shields.io/badge/python-3.11%2B-3776AB?logo=python&logoColor=white)
14
+ ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
15
+ ![Typed](https://img.shields.io/badge/typing-typed-blue)
16
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/devgyurak/pysaju/blob/main/LICENSE)
17
+
18
+ [설치](#설치) · [빠른 시작](#빠른-시작) · [문서](#문서) · [API 레퍼런스](https://github.com/devgyurak/pysaju/blob/main/docs/reference.md) · [정확도](https://github.com/devgyurak/pysaju/blob/main/docs/accuracy.md)
19
+
20
+ </div>
21
+
22
+ 네 기둥(연주·월주·일주·시주)을 뽑고, 양력과 음력을 오가고, 24절기 절입 시각을 구합니다.
23
+ 십신·공망·대운과 진태양시 보정도 들어 있습니다.
24
+
25
+ | 기능 | 주요 API | 받는 범위 |
26
+ | --- | --- | --- |
27
+ | [사주 네 기둥](https://github.com/devgyurak/pysaju/blob/main/docs/four-pillars.md) | `calculate_four_pillars` | 양력 1800~2300년 · 음력 입력은 1800~2100년 |
28
+ | [십신 · 공망 · 대운](https://github.com/devgyurak/pysaju/blob/main/docs/four-pillars.md#십신과-공망) | `get_ten_god` · `get_void_branches` · `get_luck_pillars` | 사주와 함께 계산 |
29
+ | [진태양시 보정](https://github.com/devgyurak/pysaju/blob/main/docs/true-solar-time.md) | `TrueSolarTime` | 경도 · 균시차 · 옛 표준시와 서머타임 |
30
+ | [양력 ↔ 음력](https://github.com/devgyurak/pysaju/blob/main/docs/calendar.md#양력과-음력) | `solar_to_lunar` · `lunar_to_solar` | 음력 1391~2100년 |
31
+ | [24절기 절입 시각](https://github.com/devgyurak/pysaju/blob/main/docs/calendar.md#24절기) | `get_solar_term` · `get_solar_terms_of_year` | 1~9999년 · 표로 고정한 구간은 1800~2300년 |
32
+
33
+ - **표준 라이브러리만 씁니다** — 따라오는 의존성이 없습니다.
34
+ - **결과는 바꿀 수 없습니다** — 전부 frozen 데이터클래스이고 타입 힌트(`py.typed`)가 붙어 있습니다.
35
+ - **계산만 합니다** — 풀이나 해석 문장은 만들지 않습니다.
36
+
37
+ ## 설치
38
+
39
+ 파이썬 3.11 이상.
40
+
41
+ ```bash
42
+ pip install pysaju # 또는: uv add pysaju
43
+ ```
44
+
45
+ ## 빠른 시작
46
+
47
+ ```python
48
+ from pysaju import calculate_four_pillars
49
+
50
+ saju = calculate_four_pillars(1987, 3, 8, 7, 40) # 1987년 3월 8일 07:40, 한국에서 기록된 시각
51
+
52
+ print(saju) # 정묘연주, 계묘월주, 병진일주, 임진시주
53
+ print(saju.to_hanja_string()) # 丁卯年柱, 癸卯月柱, 丙辰日柱, 壬辰時柱
54
+ print(saju.to_dict()) # {'year': '정묘', 'month': '계묘', 'day': '병진', 'hour': '임진'}
55
+ ```
56
+
57
+ 이 사주를 펼쳐 보면 이렇습니다. 여덟 글자 가운데 일간(日干) 병(丙)이 나머지를 읽는 기준입니다.
58
+
59
+ <p align="center">
60
+ <picture>
61
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/chart-dark.png">
62
+ <img width="720" src="https://raw.githubusercontent.com/devgyurak/pysaju/main/assets/chart-light.png" alt="1987년 3월 8일 07:40 의 명식. 시주 壬辰(임진), 일주 丙辰(병진), 월주 癸卯(계묘), 연주 丁卯(정묘). 일간은 丙(병, 화·양).">
63
+ </picture>
64
+ </p>
65
+
66
+ ## 조금 더
67
+
68
+ **음력 생일, 출생지, 밤 11시 생** — 전부 `calculate_four_pillars` 의 키워드 인자입니다.
69
+
70
+ ```python
71
+ from pysaju import TrueSolarTime
72
+
73
+ calculate_four_pillars(1987, 2, 9, 7, 40, lunar=True)
74
+ # 정묘연주, 계묘월주, 병진일주, 임진시주 ← 음력 1987년 2월 9일
75
+
76
+ calculate_four_pillars(1987, 3, 8, 9, 15, true_solar_time=TrueSolarTime(longitude=128.6))
77
+ # 정묘연주, 계묘월주, 병진일주, 임진시주 ← 대구의 해시계 기준(시계로는 계사시)
78
+
79
+ calculate_four_pillars(2000, 1, 1, 23, 30, day_boundary="jasi")
80
+ # 기묘연주, 병자월주, 기미일주, 갑자시주 ← 밤 11시부터 다음 날로
81
+ ```
82
+
83
+ **십신 · 공망 · 대운** — 십신과 공망은 늘 함께 나오고, 대운은 `gender` 를 줄 때 계산합니다.
84
+
85
+ ```python
86
+ saju = calculate_four_pillars(1987, 3, 8, 7, 40, gender="male")
87
+
88
+ saju.ten_gods.month # TenGodPair(stem='정관', branch='정인')
89
+ saju.void_branches # ('자', '축')
90
+ saju.luck_pillars.start_age # 1
91
+ [(p.age, p.korean) for p in saju.luck_pillars.pillars[:3]] # [(1, '임인'), (11, '신축'), (21, '경자')]
92
+ ```
93
+
94
+ **양력 ↔ 음력, 24절기** — 사주와 별개로 따로 쓸 수 있습니다.
95
+
96
+ ```python
97
+ from zoneinfo import ZoneInfo
98
+
99
+ from pysaju import get_solar_term, lunar_to_solar, solar_to_lunar
100
+
101
+ solar_to_lunar(2024, 2, 10) # LunarDate(year=2024, month=1, day=1, is_leap_month=False)
102
+ lunar_to_solar(2023, 2, 1, leap_month=True) # SolarDate(year=2023, month=3, day=22)
103
+
104
+ chunbun = get_solar_term(2025, 5) # 2025년 춘분
105
+ chunbun.date.astimezone(ZoneInfo("Asia/Seoul")).isoformat() # '2025-03-20T18:01:00+09:00'
106
+ ```
107
+
108
+ ## 문서
109
+
110
+ | 문서 | 내용 |
111
+ | --- | --- |
112
+ | [사주 계산](https://github.com/devgyurak/pysaju/blob/main/docs/four-pillars.md) | 결과 읽는 법, 음력 생일, 밤 11시 생, 십신·공망·대운, 입력 범위와 예외 |
113
+ | [진태양시](https://github.com/devgyurak/pysaju/blob/main/docs/true-solar-time.md) | 출생지 경도·균시차·옛 표준시와 서머타임으로 일주·시주를 다시 판정하기 |
114
+ | [양력·음력과 24절기](https://github.com/devgyurak/pysaju/blob/main/docs/calendar.md) | 날짜 변환, 절입 시각, 태양 황경과 균시차 |
115
+ | [정확도와 데이터 출처](https://github.com/devgyurak/pysaju/blob/main/docs/accuracy.md) | 지원 범위, 계산에 쓰는 자료, 다른 구현과의 대조 결과 |
116
+ | [API 레퍼런스](https://github.com/devgyurak/pysaju/blob/main/docs/reference.md) | 공개된 함수·모델·상수·예외 전부 |
117
+
118
+ ## 알아두면 좋은 것
119
+
120
+ - **정수 자리에는 `int` 만** — `2024.0` 같은 `float` 는 `TypeError` 입니다. 참·거짓을 묻는
121
+ `is_valid_solar_date` 만 예외 대신 `False` 를 돌려줍니다.
122
+ - **시각은 시간대가 붙은 `datetime` 으로** — 시간대가 없는 `datetime` 은 어느 나라 시각인지 알 수
123
+ 없어 `TypeError` 입니다.
124
+ - **잘못된 값은 예외로** — 범위 밖이거나 달력에 없는 날은 `pysaju.InvalidInputError` 입니다.
125
+ `ValueError` 를 상속하므로 `except ValueError` 로도 잡힙니다.
126
+ - **연주는 입춘에 바뀝니다** — 양력 1월 1일도 설날도 아닙니다. 절입은 분 단위로 가릅니다.
127
+
128
+ ## 개발
129
+
130
+ ```bash
131
+ uv sync --all-groups
132
+ uv run ruff format && uv run ruff check && uv run ty check && uv run pytest
133
+ ```
134
+
135
+ 테스트는 커버리지 90% 이상이어야 통과하고, 이 README 와 `docs/` 의 예제도 함께 실행해 확인합니다.
136
+ 커밋 전에 거치는 점검 전체와 코드 규약은 [AGENTS.md](https://github.com/devgyurak/pysaju/blob/main/AGENTS.md)에 있습니다.
137
+
138
+ ## 라이선스
139
+
140
+ Apache License 2.0. 전문은 [`LICENSE`](https://github.com/devgyurak/pysaju/blob/main/LICENSE), 저작권·데이터 출처 고지는 [`NOTICE`](https://github.com/devgyurak/pysaju/blob/main/NOTICE) 에 있습니다.