kerykeion 4.8.1__tar.gz → 4.9.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.

Potentially problematic release.


This version of kerykeion might be problematic. Click here for more details.

Files changed (32) hide show
  1. {kerykeion-4.8.1 → kerykeion-4.9.0}/PKG-INFO +2 -2
  2. {kerykeion-4.8.1 → kerykeion-4.9.0}/README.md +1 -1
  3. kerykeion-4.9.0/kerykeion/__init__.py +246 -0
  4. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/astrological_subject.py +9 -8
  5. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/charts/charts_utils.py +1 -1
  6. kerykeion-4.9.0/kerykeion/kr_types/kr_literals.py +53 -0
  7. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/kr_types/kr_models.py +20 -75
  8. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/kr_types/settings_models.py +10 -27
  9. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/utilities.py +20 -21
  10. {kerykeion-4.8.1 → kerykeion-4.9.0}/pyproject.toml +1 -1
  11. kerykeion-4.8.1/kerykeion/__init__.py +0 -109
  12. kerykeion-4.8.1/kerykeion/kr_types/kr_literals.py +0 -68
  13. {kerykeion-4.8.1 → kerykeion-4.9.0}/LICENSE +0 -0
  14. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/aspects/__init__.py +0 -0
  15. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/aspects/aspects_utils.py +0 -0
  16. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/aspects/natal_aspects.py +0 -0
  17. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/aspects/synastry_aspects.py +0 -0
  18. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/charts/__init__.py +0 -0
  19. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/charts/kerykeion_chart_svg.py +0 -0
  20. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/charts/templates/chart.xml +0 -0
  21. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/enums.py +0 -0
  22. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/fetch_geonames.py +0 -0
  23. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/kr_types/__init__.py +0 -0
  24. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/kr_types/chart_types.py +0 -0
  25. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/kr_types/kerykeion_exception.py +0 -0
  26. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/relationship_score.py +0 -0
  27. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/report.py +0 -0
  28. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/settings/__init__.py +0 -0
  29. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/settings/kerykeion_settings.py +0 -0
  30. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/settings/kr.config.json +0 -0
  31. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/sweph/README.md +0 -0
  32. {kerykeion-4.8.1 → kerykeion-4.9.0}/kerykeion/sweph/seas_18.se1 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kerykeion
3
- Version: 4.8.1
3
+ Version: 4.9.0
4
4
  Summary: A python library for astrology.
5
5
  Home-page: https://github.com/g-battaglia/kerykeion
6
6
  License: AGPL-3.0
@@ -247,7 +247,7 @@ print(aspect_list[0])
247
247
  ## Documentation
248
248
 
249
249
  Most of the functions and the classes are self documented by the types and have docstrings.
250
- An auto-generated documentation [is available here](https://g-battaglia.github.io/kerykeion).
250
+ An auto-generated documentation [is available here](https://www.kerykeion.net/pydocs/kerykeion.html).
251
251
 
252
252
  Sooner or later I'll try to write an extensive documentation.
253
253
 
@@ -210,7 +210,7 @@ print(aspect_list[0])
210
210
  ## Documentation
211
211
 
212
212
  Most of the functions and the classes are self documented by the types and have docstrings.
213
- An auto-generated documentation [is available here](https://g-battaglia.github.io/kerykeion).
213
+ An auto-generated documentation [is available here](https://www.kerykeion.net/pydocs/kerykeion.html).
214
214
 
215
215
  Sooner or later I'll try to write an extensive documentation.
216
216
 
@@ -0,0 +1,246 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ <h1 align=center>Kerykeion</h1>
4
+ <div align="center">
5
+ <a href="#">
6
+ <img src="https://img.shields.io/github/contributors/g-battaglia/kerykeion?color=blue&logo=github" alt="contributors">
7
+ </a>
8
+ <a href="#">
9
+ <img src="https://img.shields.io/github/stars/g-battaglia/kerykeion.svg?logo=github" alt="stars">
10
+ </a>
11
+ <a href="#">
12
+ <img src="https://img.shields.io/github/forks/g-battaglia/kerykeion.svg?logo=github" alt="forks">
13
+ </a>
14
+ <a href="https://pypi.org/project/kerykeion" target="_blank">
15
+ <img src="https://visitor-badge.laobi.icu/badge?page_id=g-battaglia.kerykeion" alt="visitors"/>
16
+ </a>
17
+ <a href="https://pypi.org/project/kerykeion" target="_blank">
18
+ <img src="https://img.shields.io/pypi/v/kerykeion?label=pypi%20package" alt="Package version">
19
+ </a>
20
+ <a href="https://pypi.org/project/kerykeion" target="_blank">
21
+ <img src="https://img.shields.io/pypi/pyversions/kerykeion.svg" alt="Supported Python versions">
22
+ </a>
23
+ </div>
24
+
25
+ &nbsp;
26
+
27
+ Kerykeion is a python library for Astrology.
28
+ It can calculate all the planet and house position,
29
+ also it can calculate the aspects of a single persone or between two, you can set how many planets you
30
+ need in the settings in the utility module.
31
+ It also can generate an SVG of a birthchart, a synastry chart or a transit chart.
32
+
33
+ The core goal of this project is to provide a simple and easy approach to astrology in a data driven way.
34
+
35
+ Here's an example of a birthchart:
36
+
37
+ ![Kanye Birth Chart](http://centuryboy.altervista.org/KanyeNatalChart.svg)
38
+
39
+ ## Web API
40
+
41
+ If you want to use Kerykeion in a web application, I've created a web API for this purpose, you can find it here:
42
+
43
+ **[AstrologerAPI](https://rapidapi.com/gbattaglia/api/astrologer/)**
44
+
45
+ It's [open source](https://github.com/g-battaglia/Astrologer-API), it's a way to support me and the project.
46
+
47
+ ## Donate
48
+
49
+ Maintaining this project is a lot of work, the Astrologer API doesn't nearly cover the costs of a software engineer working on this project full time. I do this because I love it, but until I can make this my full time job, I won't be able to spend as much time on it.
50
+
51
+ If you want to support me, you can do it here:
52
+
53
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/kerykeion)
54
+
55
+ ## Installation
56
+
57
+ Kerykeion is a _Python 3.9_ package, make sure you have _Python 3.9_ or above installed on your system.
58
+
59
+ ```bash
60
+ pip3 install kerykeion
61
+ ```
62
+
63
+ ## Usage
64
+
65
+ Here some examples:
66
+
67
+ ```python
68
+
69
+ # Import the main class for creating a kerykeion instance:
70
+ from kerykeion import AstrologicalSubject
71
+
72
+ # Create a kerykeion instance:
73
+ # Args: Name, year, month, day, hour, minuts, city, nation(optional)
74
+ kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta")
75
+
76
+ # Get the information about the sun in the chart:
77
+ # (The position of the planets always starts at 0)
78
+ kanye.sun
79
+
80
+ #> {'name': 'Sun', 'quality': 'Mutable', 'element': 'Air', 'sign': 'Gem', 'sign_num': 2, 'pos': 17.598992059774275, 'abs_pos': 77.59899205977428, 'emoji': '♊️', 'house': '12th House', 'retrograde': False}
81
+
82
+ # Get information about the first house:
83
+ kanye.first_house
84
+
85
+ #> {'name': 'First_House', 'quality': 'Cardinal', 'element': 'Water', 'sign': 'Can', 'sign_num': 3, 'pos': 17.995779673209114, 'abs_pos': 107.99577967320911, 'emoji': '♋️'}
86
+
87
+ # Get element of the moon sign:
88
+ kanye.moon.element
89
+
90
+ #> 'Water'
91
+
92
+ ```
93
+
94
+ **To avoid connecting to GeoNames (eg. avoiding hourly limit or no internet connection) you should instance kerykeion like this:**
95
+
96
+ ```python
97
+ kanye = AstrologicalSubject(
98
+ "Kanye", 1977, 6, 8, 8, 45, lng=50, lat=50, tz_str="Europe/Rome", city="Rome"
99
+ )
100
+ ```
101
+
102
+ The difference is that you have to pass the longitude, latitude and the timezone string, instead of the city and nation.
103
+ If you omit the nation, it will be set to "GB" by default, but the value is not used for calculations. It's better to set it to the correct value though.
104
+
105
+ ## Generate a SVG Chart:
106
+
107
+ ```python
108
+ from kerykeion import AstrologicalSubject, KerykeionChartSVG
109
+
110
+ first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma")
111
+ second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 00, "Roma")
112
+
113
+ # Set the type, it can be Natal, Synastry or Transit
114
+
115
+ name = KerykeionChartSVG(first, chart_type="Synastry", second_obj=second)
116
+ name.makeSVG()
117
+ print(len(name.aspects_list))
118
+
119
+ #> Generating kerykeion object for Jack...
120
+ #> Generating kerykeion object for Jane...
121
+ #> Jack birth location: Roma, 41.89193, 12.51133
122
+ #> SVG Generated Correctly
123
+ #> 38
124
+
125
+ ```
126
+
127
+ ![Synastry Chart](http://centuryboy.altervista.org/JackComposite_Chart.svg)
128
+
129
+ # Report
130
+
131
+ To print a report of all the data:
132
+
133
+ ```python
134
+ from kerykeion import Report, AstrologicalSubject
135
+
136
+ kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta")
137
+ report = Report(kanye)
138
+ report.print_report()
139
+
140
+ ```
141
+
142
+ Returns:
143
+
144
+ ```
145
+ +- Kerykeion report for Kanye -+
146
+ +----------+------+-------------+-----------+----------+
147
+ | Date | Time | Location | Longitude | Latitude |
148
+ +----------+------+-------------+-----------+----------+
149
+ | 8/6/1977 | 8:45 | Atlanta, US | -84.38798 | 33.749 |
150
+ +----------+------+-------------+-----------+----------+
151
+ +-----------+------+-------+------+----------------+
152
+ | Planet | Sign | Pos. | Ret. | House |
153
+ +-----------+------+-------+------+----------------+
154
+ | Sun | Gem | 17.6 | - | Twelfth_House |
155
+ | Moon | Pis | 16.43 | - | Ninth_House |
156
+ | Mercury | Tau | 26.29 | - | Eleventh_House |
157
+ | Venus | Tau | 2.03 | - | Tenth_House |
158
+ | Mars | Tau | 1.79 | - | Tenth_House |
159
+ | Jupiter | Gem | 14.61 | - | Eleventh_House |
160
+ | Saturn | Leo | 12.8 | - | Second_House |
161
+ | Uranus | Sco | 8.27 | R | Fourth_House |
162
+ | Neptune | Sag | 14.69 | R | Fifth_House |
163
+ | Pluto | Lib | 11.45 | R | Fourth_House |
164
+ | Mean_Node | Lib | 21.49 | R | Fourth_House |
165
+ | True_Node | Lib | 22.82 | R | Fourth_House |
166
+ | Chiron | Tau | 4.17 | - | Tenth_House |
167
+ +-----------+------+-------+------+----------------+
168
+ +----------------+------+----------+
169
+ | House | Sign | Position |
170
+ +----------------+------+----------+
171
+ | First_House | Can | 18.0 |
172
+ | Second_House | Leo | 9.51 |
173
+ | Third_House | Vir | 4.02 |
174
+ | Fourth_House | Lib | 3.98 |
175
+ | Fifth_House | Sco | 9.39 |
176
+ | Sixth_House | Sag | 15.68 |
177
+ | Seventh_House | Cap | 18.0 |
178
+ | Eighth_House | Aqu | 9.51 |
179
+ | Ninth_House | Pis | 4.02 |
180
+ | Tenth_House | Ari | 3.98 |
181
+ | Eleventh_House | Tau | 9.39 |
182
+ | Twelfth_House | Gem | 15.68 |
183
+ +----------------+------+----------+
184
+
185
+ ```
186
+
187
+ And if you want to export it to a file:
188
+
189
+ ```bash
190
+ $ python3 your_script_name.py > file.txt
191
+ ```
192
+
193
+ ## Other exeples of possibles usecase
194
+
195
+ ```python
196
+ # Get all aspects between two persons:
197
+
198
+ from kerykeion import SynastryAspects, AstrologicalSubject
199
+ first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma")
200
+ second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 00, "Roma")
201
+
202
+ name = SynastryAspects(first, second)
203
+ aspect_list = name.get_relevant_aspects()
204
+ print(aspect_list[0])
205
+
206
+ #> Generating kerykeion object for Jack...
207
+ #> Generating kerykeion object for Jane...
208
+ #> {'p1_name': 'Sun', 'p1_abs_pos': 84.17867971515636, 'p2_name': 'Sun', 'p2_abs_pos': 211.90472999502984, 'aspect': 'trine', 'orbit': 7.726050279873476, 'aspect_degrees': 120, 'color': '#36d100', 'aid': 6, 'diff': 127.72605027987348, 'p1': 0, 'p2': 0}
209
+
210
+ ```
211
+
212
+ ## Documentation
213
+
214
+ Most of the functions and the classes are self documented by the types and have docstrings.
215
+ An auto-generated documentation [is available here](https://www.kerykeion.net/pydocs/kerykeion.html).
216
+
217
+ Sooner or later I'll try to write an extensive documentation.
218
+
219
+ ## Development
220
+
221
+ You can clone this repository or download a zip file using the right side buttons.
222
+
223
+ ## Contributing
224
+
225
+ Feel free to contribute to the code!
226
+
227
+ ## License
228
+
229
+ This project is licensed under the AGPL-3.0 License.
230
+ To understand how this impacts your use of the software, please see the [LICENSE](LICENSE) file for details.
231
+ If you have questions, you can reach out to me at my [email](mailto:battaglia.giacomo@yahoo.it?subject=Kerykeion) address.
232
+ As a rule of thumb, if you are using this library in a project, you should open source the code of the project with a compatible license.
233
+
234
+ You can implement the logic of kerkeion in your project and also keep it closed source by using a third party API, like the [AstrologerAPI](https://rapidapi.com/gbattaglia/api/astrologer/). The AstrologerAPI is AGPL-3.0 compliant. Subscribing to the API is also, currently, the best way to support the project.
235
+
236
+ """
237
+
238
+ # Local
239
+ from .astrological_subject import AstrologicalSubject
240
+ from .charts.kerykeion_chart_svg import KerykeionChartSVG
241
+ from .kr_types import *
242
+ from .relationship_score import RelationshipScore
243
+ from .aspects import SynastryAspects, NatalAspects
244
+ from .report import Report
245
+ from .settings import KerykeionSettingsModel, get_settings
246
+ from .enums import Planets, Aspects, Signs
@@ -15,6 +15,7 @@ from kerykeion.kr_types import (
15
15
  AstrologicalSubjectModel,
16
16
  LunarPhaseModel,
17
17
  KerykeionPointModel,
18
+ PointType
18
19
  )
19
20
  from kerykeion.utilities import (
20
21
  get_number_from_name,
@@ -24,7 +25,7 @@ from kerykeion.utilities import (
24
25
  get_moon_phase_name_from_phase_int,
25
26
  )
26
27
  from pathlib import Path
27
- from typing import Union, Literal
28
+ from typing import Union
28
29
 
29
30
  DEFAULT_GEONAMES_USERNAME = "century.boy"
30
31
 
@@ -330,7 +331,7 @@ class AstrologicalSubject:
330
331
  else:
331
332
  raise KerykeionException("Zodiac type not recognized! Please use 'Tropic' or 'Sidereal'")
332
333
 
333
- point_type: Literal["Planet", "House"] = "House"
334
+ point_type: PointType = "House"
334
335
  # creates the list of the house in 360°
335
336
  self.houses_degree_ut = swe.houses(self.julian_day, self.lat, self.lng)[0]
336
337
  # stores the house in singular dictionaries.
@@ -412,7 +413,7 @@ class AstrologicalSubject:
412
413
  """Defines body positon in signs and information and
413
414
  stores them in dictionaries"""
414
415
 
415
- point_type: Literal["Planet", "House"] = "Planet"
416
+ point_type: PointType = "Planet"
416
417
  # stores the planets in singular dictionaries.
417
418
  self.sun = calculate_position(self.planets_degrees_ut[0], "Sun", point_type=point_type)
418
419
  self.moon = calculate_position(self.planets_degrees_ut[1], "Moon", point_type=point_type)
@@ -474,13 +475,13 @@ class AstrologicalSubject:
474
475
 
475
476
  # Check in retrograde or not:
476
477
  planets_ret = []
477
- for p in self.planets_list:
478
- planet_number = get_number_from_name(p["name"])
478
+ for planet in self.planets_list:
479
+ planet_number = get_number_from_name(planet["name"])
479
480
  if swe.calc(self.julian_day, planet_number, self._iflag)[0][3] < 0:
480
- p["retrograde"] = True
481
+ planet["retrograde"] = True
481
482
  else:
482
- p["retrograde"] = False
483
- planets_ret.append(p)
483
+ planet["retrograde"] = False
484
+ planets_ret.append(planet)
484
485
 
485
486
  def _lunar_phase_calc(self) -> None:
486
487
  """Function to calculate the lunar phase"""
@@ -126,7 +126,7 @@ def draw_zodiac_slice(
126
126
 
127
127
  Args:
128
128
  - c1 (Union[int, float]): The value of c1.
129
- - chart_type (Literal["Natal", "ExternalNatal", "Synastry", "Transit"]): The type of chart.
129
+ - chart_type (ChartType): The type of chart.
130
130
  - seventh_house_degree_ut (Union[int, float]): The degree of the seventh house.
131
131
  - num (int): The number of the sign. Note: In OpenAstro it did refer to self.zodiac,
132
132
  which is a list of the signs in order, starting with Aries. Eg:
@@ -0,0 +1,53 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ This is part of Kerykeion (C) 2024 Giacomo Battaglia
4
+ """
5
+ from typing import Literal
6
+
7
+
8
+ ZodiacType = Literal["Tropic", "Sidereal"]
9
+ """Literal type for Zodiac Types"""
10
+
11
+
12
+ Sign = Literal["Ari", "Tau", "Gem", "Can", "Leo", "Vir", "Lib", "Sco", "Sag", "Cap", "Aqu", "Pis"]
13
+ """Literal type for Zodiac Signs"""
14
+
15
+
16
+ SignNumbers = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
17
+ """Literal type for Zodiac Sign Numbers"""
18
+
19
+
20
+ Houses = Literal["First_House", "Second_House", "Third_House", "Fourth_House", "Fifth_House", "Sixth_House", "Seventh_House", "Eighth_House", "Ninth_House", "Tenth_House", "Eleventh_House", "Twelfth_House"]
21
+ """Literal type for Houses"""
22
+
23
+
24
+ HouseNumbers = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
25
+ """Literal type for House Numbers"""
26
+
27
+
28
+ Planet = Literal["Sun", "Moon", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto", "Mean_Node", "True_Node", "Chiron"]
29
+ """Literal type for Planets"""
30
+
31
+
32
+ Element = Literal["Air", "Fire", "Earth", "Water"]
33
+ """Literal type for Elements"""
34
+
35
+
36
+ Quality = Literal["Cardinal", "Fixed", "Mutable"]
37
+ """Literal type for Qualities"""
38
+
39
+
40
+ ChartType = Literal["Natal", "ExternalNatal", "Synastry", "Transit"]
41
+ """Literal type for Chart Types"""
42
+
43
+
44
+ PointType = Literal["Planet", "House"]
45
+ """Literal type for Point Types"""
46
+
47
+
48
+ LunarPhaseEmoji = Literal["🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"]
49
+ """Literal type for Lunar Phases Emoji"""
50
+
51
+
52
+ LunarPhaseName = Literal["New Moon", "Waxing Crescent", "First Quarter", "Waxing Gibbous", "Full Moon", "Waning Gibbous", "Last Quarter", "Waning Crescent"]
53
+ """Literal type for Lunar Phases Name"""
@@ -4,43 +4,15 @@
4
4
  """
5
5
 
6
6
 
7
- from typing import Literal, Union, Optional
7
+ from typing import Union, Optional
8
8
  from pydantic import BaseModel
9
9
 
10
- from kerykeion.kr_types import LunarPhaseEmoji, LunarPhaseName, Planet, Houses, Quality, Element, Sign, ZodiacType
11
-
12
-
13
- class LunarPhaseModel(BaseModel):
14
- degrees_between_s_m: Union[float, int]
15
- moon_phase: int
16
- sun_phase: int
17
- moon_emoji: LunarPhaseEmoji
18
- moon_phase_name: LunarPhaseName
19
-
20
- def __str__(self):
21
- return (
22
- super()
23
- .model_dump(
24
- exclude_none=True,
25
- exclude_unset=True,
26
- exclude_defaults=True,
27
- by_alias=False,
28
- )
29
- .__str__()
30
- )
31
-
32
- def __repr__(self):
33
- return (
34
- super()
35
- .model_dump(
36
- exclude_none=True,
37
- exclude_unset=True,
38
- exclude_defaults=True,
39
- by_alias=False,
40
- )
41
- .__str__()
42
- )
10
+ from kerykeion.kr_types import LunarPhaseEmoji, LunarPhaseName, Planet, Houses, Quality, Element, Sign, ZodiacType, SignNumbers, HouseNumbers, PointType
43
11
 
12
+ class SubscriptableBaseModel(BaseModel):
13
+ """
14
+ Pydantic BaseModel with subscriptable support, so you can access the fields as if they were a dictionary.
15
+ """
44
16
  def __getitem__(self, key):
45
17
  return getattr(self, key)
46
18
 
@@ -53,8 +25,15 @@ class LunarPhaseModel(BaseModel):
53
25
  def get(self, key, default):
54
26
  return getattr(self, key, default)
55
27
 
28
+ class LunarPhaseModel(SubscriptableBaseModel):
29
+ degrees_between_s_m: Union[float, int]
30
+ moon_phase: int
31
+ sun_phase: int
32
+ moon_emoji: LunarPhaseEmoji
33
+ moon_phase_name: LunarPhaseName
34
+
56
35
 
57
- class KerykeionPointModel(BaseModel):
36
+ class KerykeionPointModel(SubscriptableBaseModel):
58
37
  """
59
38
  Kerykeion Point Model
60
39
  """
@@ -63,52 +42,16 @@ class KerykeionPointModel(BaseModel):
63
42
  quality: Quality
64
43
  element: Element
65
44
  sign: Sign
66
- sign_num: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
45
+ sign_num: SignNumbers
67
46
  position: float
68
47
  abs_pos: float
69
48
  emoji: str
70
- point_type: Literal["Planet", "House"]
71
- house: Optional[Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]] = None
49
+ point_type: PointType
50
+ house: Optional[HouseNumbers] = None
72
51
  retrograde: Optional[bool] = None
73
52
 
74
- def __str__(self):
75
- return (
76
- super()
77
- .model_dump(
78
- exclude_none=True,
79
- exclude_unset=True,
80
- exclude_defaults=True,
81
- by_alias=False,
82
- )
83
- .__str__()
84
- )
85
-
86
- def __repr__(self):
87
- return (
88
- super()
89
- .model_dump(
90
- exclude_none=True,
91
- exclude_unset=True,
92
- exclude_defaults=True,
93
- by_alias=False,
94
- )
95
- .__str__()
96
- )
97
-
98
- def __getitem__(self, key):
99
- return getattr(self, key)
100
-
101
- def __setitem__(self, key, value):
102
- setattr(self, key, value)
103
53
 
104
- def __delitem__(self, key):
105
- delattr(self, key)
106
-
107
- def get(self, key, default):
108
- return getattr(self, key, default)
109
-
110
-
111
- class AstrologicalSubjectModel(BaseModel):
54
+ class AstrologicalSubjectModel(SubscriptableBaseModel):
112
55
  # Data
113
56
  name: str
114
57
  year: int
@@ -137,6 +80,8 @@ class AstrologicalSubjectModel(BaseModel):
137
80
  uranus: KerykeionPointModel
138
81
  neptune: KerykeionPointModel
139
82
  pluto: KerykeionPointModel
83
+
84
+ # Optional Planets:
140
85
  chiron: Union[KerykeionPointModel, None]
141
86
 
142
87
  # Houses
@@ -4,29 +4,12 @@
4
4
  """
5
5
 
6
6
 
7
- from pydantic import BaseModel, Field
7
+ from pydantic import Field
8
8
  from typing import List
9
+ from kerykeion.kr_types.kr_models import SubscriptableBaseModel
9
10
 
10
11
 
11
- class CustomBaseModel(BaseModel):
12
- """
13
- Extends the BaseModel class of Pydantic to add some useful methods.
14
- """
15
-
16
- def __init__(self, **data):
17
- super().__init__(**data)
18
-
19
- def __getitem__(self, item):
20
- return getattr(self, item)
21
-
22
- def __str__(self) -> str:
23
- return str(self.model_dump())
24
-
25
- def get(self, item, default=None):
26
- return getattr(self, item, default)
27
-
28
-
29
- class KerykeionSettingsCelestialPointModel(CustomBaseModel):
12
+ class KerykeionSettingsCelestialPointModel(SubscriptableBaseModel):
30
13
  """
31
14
  Defines the model for a celestial point data.
32
15
  """
@@ -41,7 +24,7 @@ class KerykeionSettingsCelestialPointModel(CustomBaseModel):
41
24
 
42
25
 
43
26
  # Chart Colors Settings
44
- class KerykeionSettingsChartColorsModel(CustomBaseModel):
27
+ class KerykeionSettingsChartColorsModel(SubscriptableBaseModel):
45
28
  """
46
29
  Defines the model for the chart colors.
47
30
  """
@@ -87,7 +70,7 @@ class KerykeionSettingsChartColorsModel(CustomBaseModel):
87
70
 
88
71
 
89
72
  # Aspect Settings
90
- class KerykeionSettingsAspectModel(CustomBaseModel):
73
+ class KerykeionSettingsAspectModel(SubscriptableBaseModel):
91
74
  """
92
75
  Defines the model for an aspect.
93
76
  """
@@ -103,7 +86,7 @@ class KerykeionSettingsAspectModel(CustomBaseModel):
103
86
 
104
87
 
105
88
  # Language Settings
106
- class KerykeionLanguageCelestialPointModel(CustomBaseModel):
89
+ class KerykeionLanguageCelestialPointModel(SubscriptableBaseModel):
107
90
  """
108
91
  This class is used to define the labels, show in the chart, for the celestial points.
109
92
  It is used to translate the celestial points in the language of the chart.
@@ -128,7 +111,7 @@ class KerykeionLanguageCelestialPointModel(CustomBaseModel):
128
111
  Ic: str = Field(title="Imum Coeli", description="The name of Imum Coeli in the chart, in the language")
129
112
 
130
113
 
131
- class KerykeionLanguageModel(CustomBaseModel):
114
+ class KerykeionLanguageModel(SubscriptableBaseModel):
132
115
  """
133
116
  This model is used to store the language settings for the chart,
134
117
  it's used to translate the celestial points and the other labels
@@ -157,17 +140,17 @@ class KerykeionLanguageModel(CustomBaseModel):
157
140
  celestial_points: KerykeionLanguageCelestialPointModel
158
141
 
159
142
 
160
- class KerykeionGeneralSettingsModel(CustomBaseModel):
143
+ class KerykeionGeneralSettingsModel(SubscriptableBaseModel):
161
144
  axes_orbit: int = Field(title="Axes Orbit", description="The orbit of the axes in the chart")
162
145
  planet_in_zodiac_extra_points: int = Field(title="Planet in Zodiac Extra Points", description="The extra points of the planet in the zodiac")
163
146
  language: str = Field(title="Language", description="The language of the chart")
164
147
 
165
- class KerykeionChartSettingsModel(CustomBaseModel):
148
+ class KerykeionChartSettingsModel(SubscriptableBaseModel):
166
149
  basic_chart_viewBox: str = Field(title="Basic Chart ViewBox", description="The viewbox of the basic chart")
167
150
  wide_chart_viewBox: str = Field(title="Wide Chart ViewBox", description="The viewbox of the wide chart")
168
151
 
169
152
  # Settings Model
170
- class KerykeionSettingsModel(CustomBaseModel):
153
+ class KerykeionSettingsModel(SubscriptableBaseModel):
171
154
  """
172
155
  This class is used to define the global settings for the Kerykeion.
173
156
  """
@@ -1,47 +1,46 @@
1
1
  from kerykeion.kr_types import KerykeionPointModel, KerykeionException, KerykeionSettingsModel, AstrologicalSubjectModel
2
- from kerykeion.kr_types.kr_literals import LunarPhaseEmoji, LunarPhaseName
3
- from typing import Union, Literal
2
+ from kerykeion.kr_types.kr_literals import LunarPhaseEmoji, LunarPhaseName, PointType, Planet
3
+ from typing import Union
4
4
  import logging
5
5
  import math
6
6
 
7
7
 
8
8
 
9
- def get_number_from_name(name: str) -> int:
9
+ def get_number_from_name(name: Planet) -> int:
10
10
  """Utility function, gets planet id from the name."""
11
- name = name.lower()
12
11
 
13
- if name == "sun":
12
+ if name == "Sun":
14
13
  return 0
15
- elif name == "moon":
14
+ elif name == "Moon":
16
15
  return 1
17
- elif name == "mercury":
16
+ elif name == "Mercury":
18
17
  return 2
19
- elif name == "venus":
18
+ elif name == "Venus":
20
19
  return 3
21
- elif name == "mars":
20
+ elif name == "Mars":
22
21
  return 4
23
- elif name == "jupiter":
22
+ elif name == "Jupiter":
24
23
  return 5
25
- elif name == "saturn":
24
+ elif name == "Saturn":
26
25
  return 6
27
- elif name == "uranus":
26
+ elif name == "Uranus":
28
27
  return 7
29
- elif name == "neptune":
28
+ elif name == "Neptune":
30
29
  return 8
31
- elif name == "pluto":
30
+ elif name == "Pluto":
32
31
  return 9
33
- elif name == "mean_node":
32
+ elif name == "Mean_Node":
34
33
  return 10
35
- elif name == "true_node":
34
+ elif name == "True_Node":
36
35
  return 11
37
- elif name == "chiron":
36
+ elif name == "Chiron":
38
37
  return 15
39
38
  else:
40
- return int(name)
39
+ raise KerykeionException(f"Error in getting number from name! Name: {name}")
41
40
 
42
41
 
43
42
  def calculate_position(
44
- degree: Union[int, float], number_name: str, point_type: Literal["Planet", "House"]
43
+ degree: Union[int, float], number_name: str, point_type: PointType
45
44
  ) -> KerykeionPointModel:
46
45
  """Utility function to create a dictionary dividing the houses or the planets list."""
47
46
 
@@ -214,14 +213,14 @@ def setup_logging(level: str) -> None:
214
213
  Args:
215
214
  level: Log level as a string, options: debug, info, warning, error
216
215
  """
217
- logopt: dict[str, int] = {
216
+ logging_options: dict[str, int] = {
218
217
  "debug": logging.DEBUG,
219
218
  "info": logging.INFO,
220
219
  "warning": logging.WARNING,
221
220
  "error": logging.ERROR,
222
221
  }
223
222
  format: str = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
224
- loglevel: int = logopt.get(level, logging.INFO)
223
+ loglevel: int = logging_options.get(level, logging.INFO)
225
224
  logging.basicConfig(format=format, level=loglevel)
226
225
 
227
226
  def check_if_point_between(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kerykeion"
3
- version = "4.8.1"
3
+ version = "4.9.0"
4
4
  authors = ["Giacomo Battaglia <battaglia.giacomo@yahoo.it>"]
5
5
  description = "A python library for astrology."
6
6
  license = "AGPL-3.0"
@@ -1,109 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- This is part of Kerykeion (C) 2024 Giacomo Battaglia
4
-
5
- Kerykeion is a python library for Astrology.
6
- It can calculate all the planet and house position,
7
- also it can calculate the aspects of a single persone or between two, you can set how many planets you
8
- need in the settings in the utility module.
9
- It also can generate an SVG of a birthchart, a synastry chart or a transit chart.
10
-
11
- Here some examples:
12
-
13
- ```python
14
-
15
- # Import the main class for creating a kerykeion instance:
16
- >>> from kerykeion import AstrologicalSubject
17
-
18
- # Create a kerykeion instance:
19
- # Args: Name, year, month, day, hour, minuts, city, nation(optional)
20
- >>> kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta")
21
-
22
- # Get the information about the sun in the chart:
23
- # (The position of the planets always starts at 0)
24
- >>> kanye.sun
25
- {'name': 'Sun', 'quality': 'Mutable', 'element': 'Air', 'sign': 'Gem', 'sign_num': 2, 'pos': 17.598992059774275, 'abs_pos': 77.59899205977428, 'emoji': '♊️', 'house': '12th House', 'retrograde': False}
26
-
27
- # Get informations about the first house:
28
- >>> kanye.first_house
29
- {'name': '1', 'quality': 'Cardinal', 'element': 'Water', 'sign': 'Can', 'sign_num': 3, 'pos': 17.995779673209114, 'abs_pos': 107.99577967320911, 'emoji': '♋️'}
30
-
31
- # Get element of the moon sign:
32
- >>> kanye.moon.get("element")
33
- 'Water'
34
-
35
- ```
36
-
37
- ## Generate a SVG of the birthchart:
38
-
39
- ```python
40
- >>> from kerykeion import AstrologicalSubject, KerykeionChartSVG
41
-
42
- >>> first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma")
43
- >>> second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 00, "Roma")
44
-
45
- # Set the type, it can be Natal, Synastry or Transit
46
-
47
- >>> name = KerykeionChartSVG(first, chart_type="Synastry", second_obj=second)
48
- >>> name.makeSVG()
49
- >>> print(len(name.aspects_list))
50
- >>> Generating kerykeion object for Jack...
51
- Generating kerykeion object for Jane...
52
- Jack birth location: Roma, 41.89193, 12.51133
53
- SVG Generated Correctly
54
- 38
55
-
56
- ```
57
-
58
- ![alt text](http://centuryboy.altervista.org/JackSynastry_Chart.svg)
59
-
60
-
61
- ## Other exeples of possibles usecase
62
-
63
- ```python
64
- # Get all aspects between two persons:
65
-
66
- >>> from kerykeion import SynastryAspects, AstrologicalSubject
67
- >>> first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma")
68
- >>> second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 00, "Roma")
69
-
70
- >>> name = SynastryAspects(first, second)
71
- >>> aspect_list = name.relevant_aspects
72
- >>> print(aspect_list[0])
73
-
74
- Generating kerykeion object for Jack...
75
- Generating kerykeion object for Jane...
76
- {'p1_name': 'Sun', 'p1_abs_pos': 84.17867971515636, 'p2_name': 'Sun', 'p2_abs_pos': 211.90472999502984, 'aspect': 'trine', 'orbit': 7.726050279873476, 'aspect_degrees': 120, 'color': '#36d100', 'aid': 6, 'diff': 127.72605027987348, 'p1': 0, 'p2': 0}
77
-
78
- ```
79
-
80
- ## Documentation
81
-
82
- Most of the functions and the classes are self documented by the types and have docstrings.
83
- An auto-generated documentation [is available here](https://g-battaglia.github.io/kerykeion).
84
-
85
- Sooner or later I'll try to write an extensive documentation.
86
-
87
- ## Installation
88
-
89
- Kerykeion is a Python 3 package, make sure you have Python 3 installed on your system.
90
-
91
- ## Development
92
-
93
- You can clone this repository or download a zip file using the right side buttons.
94
-
95
- ## Contributing
96
-
97
- Feel free to contribute to the code!
98
-
99
- """
100
-
101
- # Local
102
- from .astrological_subject import AstrologicalSubject
103
- from .charts.kerykeion_chart_svg import KerykeionChartSVG
104
- from .kr_types import *
105
- from .relationship_score import RelationshipScore
106
- from .aspects import SynastryAspects, NatalAspects
107
- from .report import Report
108
- from .settings import KerykeionSettingsModel, get_settings
109
- from .enums import Planets, Aspects, Signs
@@ -1,68 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- This is part of Kerykeion (C) 2024 Giacomo Battaglia
4
- """
5
-
6
-
7
- from typing import Literal
8
-
9
- # Zodiac Types:
10
- ZodiacType = Literal["Tropic", "Sidereal"]
11
-
12
- # Sings:
13
- Sign = Literal[
14
- "Ari", "Tau", "Gem", "Can", "Leo", "Vir", "Lib", "Sco", "Sag", "Cap", "Aqu", "Pis"
15
- ]
16
-
17
- Houses = Literal[
18
- "First_House",
19
- "Second_House",
20
- "Third_House",
21
- "Fourth_House",
22
- "Fifth_House",
23
- "Sixth_House",
24
- "Seventh_House",
25
- "Eighth_House",
26
- "Ninth_House",
27
- "Tenth_House",
28
- "Eleventh_House",
29
- "Twelfth_House",
30
- ]
31
-
32
- Planet = Literal[
33
- "Sun",
34
- "Moon",
35
- "Mercury",
36
- "Venus",
37
- "Mars",
38
- "Jupiter",
39
- "Saturn",
40
- "Uranus",
41
- "Neptune",
42
- "Pluto",
43
- "Mean_Node",
44
- "True_Node",
45
- "Chiron",
46
- ]
47
-
48
- Element = Literal["Air", "Fire", "Earth", "Water"]
49
-
50
- Quality = Literal[
51
- "Cardinal",
52
- "Fixed",
53
- "Mutable",
54
- ]
55
-
56
- ChartType = Literal["Natal", "ExternalNatal", "Synastry", "Transit"]
57
-
58
- LunarPhaseEmoji = Literal["🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"]
59
- LunarPhaseName = Literal[
60
- "New Moon",
61
- "Waxing Crescent",
62
- "First Quarter",
63
- "Waxing Gibbous",
64
- "Full Moon",
65
- "Waning Gibbous",
66
- "Last Quarter",
67
- "Waning Crescent"
68
- ]
File without changes
File without changes
File without changes