kerykeion 4.8.0__tar.gz → 4.8.1__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 (30) hide show
  1. {kerykeion-4.8.0 → kerykeion-4.8.1}/PKG-INFO +1 -1
  2. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/charts/charts_utils.py +48 -1
  3. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/charts/kerykeion_chart_svg.py +25 -32
  4. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/charts/templates/chart.xml +3 -3
  5. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/fetch_geonames.py +5 -2
  6. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/kr_types/chart_types.py +3 -4
  7. {kerykeion-4.8.0 → kerykeion-4.8.1}/pyproject.toml +1 -1
  8. {kerykeion-4.8.0 → kerykeion-4.8.1}/LICENSE +0 -0
  9. {kerykeion-4.8.0 → kerykeion-4.8.1}/README.md +0 -0
  10. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/__init__.py +0 -0
  11. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/aspects/__init__.py +0 -0
  12. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/aspects/aspects_utils.py +0 -0
  13. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/aspects/natal_aspects.py +0 -0
  14. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/aspects/synastry_aspects.py +0 -0
  15. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/astrological_subject.py +0 -0
  16. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/charts/__init__.py +0 -0
  17. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/enums.py +0 -0
  18. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/kr_types/__init__.py +0 -0
  19. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/kr_types/kerykeion_exception.py +0 -0
  20. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/kr_types/kr_literals.py +0 -0
  21. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/kr_types/kr_models.py +0 -0
  22. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/kr_types/settings_models.py +0 -0
  23. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/relationship_score.py +0 -0
  24. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/report.py +0 -0
  25. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/settings/__init__.py +0 -0
  26. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/settings/kerykeion_settings.py +0 -0
  27. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/settings/kr.config.json +0 -0
  28. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/sweph/README.md +0 -0
  29. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/sweph/seas_18.se1 +0 -0
  30. {kerykeion-4.8.0 → kerykeion-4.8.1}/kerykeion/utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kerykeion
3
- Version: 4.8.0
3
+ Version: 4.8.1
4
4
  Summary: A python library for astrology.
5
5
  Home-page: https://github.com/g-battaglia/kerykeion
6
6
  License: AGPL-3.0
@@ -394,4 +394,51 @@ def draw_transit_ring(r: Union[int, float], paper_1_color: str, zodiac_transit_r
394
394
  out = f'<circle cx="{r}" cy="{r}" r="{r - radius_offset}" style="fill: none; stroke: {paper_1_color}; stroke-width: 36px; stroke-opacity: .4;"/>'
395
395
  out += f'<circle cx="{r}" cy="{r}" r="{r}" style="fill: none; stroke: {zodiac_transit_ring_3_color}; stroke-width: 1px; stroke-opacity: .6;"/>'
396
396
 
397
- return out
397
+ return out
398
+
399
+
400
+ def draw_first_circle(r: Union[int, float], stroke_color: str, chart_type: ChartType, c1: Union[int, float, None] = None) -> str:
401
+ """
402
+ Draws the first circle.
403
+
404
+ Args:
405
+ - r (Union[int, float]): The value of r.
406
+ - color (str): The color of the circle.
407
+ - chart_type (ChartType): The type of chart.
408
+ - c1 (Union[int, float]): The value of c1.
409
+
410
+ Returns:
411
+ str: The SVG path of the first circle.
412
+ """
413
+ if chart_type == "Synastry" or chart_type == "Transit":
414
+ return f'<circle cx="{r}" cy="{r}" r="{r - 36}" style="fill: none; stroke: {stroke_color}; stroke-width: 1px; stroke-opacity:.4;" />'
415
+ else:
416
+ if c1 is None:
417
+ raise KerykeionException("c1 is None")
418
+
419
+ return f'<circle cx="{r}" cy="{r}" r="{r - c1}" style="fill: none; stroke: {stroke_color}; stroke-width: 1px; " />'
420
+
421
+
422
+ def draw_second_circle(r: Union[int, float], stroke_color: str, fill_color: str, chart_type: ChartType, c2: Union[int, float, None] = None) -> str:
423
+ """
424
+ Draws the second circle.
425
+
426
+ Args:
427
+ - r (Union[int, float]): The value of r.
428
+ - stroke_color (str): The color of the stroke.
429
+ - fill_color (str): The color of the fill.
430
+ - chart_type (ChartType): The type of chart.
431
+ - c2 (Union[int, float]): The value of c2.
432
+
433
+ Returns:
434
+ str: The SVG path of the second circle.
435
+ """
436
+
437
+ if chart_type == "Synastry" or chart_type == "Transit":
438
+ return f'<circle cx="{r}" cy="{r}" r="{r - 72}" style="fill: {fill_color}; fill-opacity:.4; stroke: {stroke_color}; stroke-opacity:.4; stroke-width: 1px" />'
439
+
440
+ else:
441
+ if c2 is None:
442
+ raise KerykeionException("c2 is None")
443
+
444
+ return f'<circle cx="{r}" cy="{r}" r="{r - c2}" style="fill: {fill_color}; fill-opacity:.2; stroke: {stroke_color}; stroke-opacity:.4; stroke-width: 1px" />'
@@ -25,7 +25,9 @@ from kerykeion.charts.charts_utils import (
25
25
  convert_decimal_to_degree_string,
26
26
  draw_transit_ring_degree_steps,
27
27
  draw_degree_ring,
28
- draw_transit_ring
28
+ draw_transit_ring,
29
+ draw_first_circle,
30
+ draw_second_circle
29
31
  )
30
32
  from pathlib import Path
31
33
  from scour.scour import scourString
@@ -47,6 +49,11 @@ class KerykeionChartSVG:
47
49
  - lang: language settings (default: "EN")
48
50
  - new_settings_file: Set the settings file (default: kr.config.json)
49
51
  """
52
+
53
+ # Constants
54
+ _DEFAULT_HEIGHT = 546.0
55
+ _DEFAULT_FULL_WIDTH = 1200
56
+ _DEFAULT_NATAL_WIDTH = 772.2
50
57
 
51
58
  # Set at init
52
59
  first_obj: AstrologicalSubject
@@ -66,8 +73,7 @@ class KerykeionChartSVG:
66
73
  c3: float
67
74
  homedir: Path
68
75
  xml_svg: Path
69
- natal_width: float
70
- full_width: float
76
+ width: Union[float, int]
71
77
  language_settings: dict
72
78
  chart_colors_settings: dict
73
79
  planets_settings: dict
@@ -87,8 +93,7 @@ class KerykeionChartSVG:
87
93
  t_points_sign: list
88
94
  t_points_retrograde: list
89
95
  t_houses_sign_graph: list
90
- screen_width: float
91
- screen_height: float
96
+ height: float
92
97
  location: str
93
98
  geolat: float
94
99
  geolon: float
@@ -116,10 +121,6 @@ class KerykeionChartSVG:
116
121
 
117
122
  self.xml_svg = DATA_DIR / "templates/chart.xml"
118
123
 
119
- # SVG Width
120
- self.natal_width = 772.2
121
- self.full_width = 1200
122
-
123
124
  self.parse_json_settings(new_settings_file)
124
125
  self.chart_type = chart_type
125
126
 
@@ -217,11 +218,12 @@ class KerykeionChartSVG:
217
218
  self.t_houses_sign_graph.append(h["sign_num"])
218
219
 
219
220
  # screen size
220
- if self.chart_type == "Natal":
221
- self.screen_width = 772.2
221
+
222
+ self.height = self._DEFAULT_HEIGHT
223
+ if self.chart_type == "Synastry" or self.chart_type == "Transit":
224
+ self.width = self._DEFAULT_FULL_WIDTH
222
225
  else:
223
- self.screen_width = 1200
224
- self.screen_height = 772.2
226
+ self.width = self._DEFAULT_NATAL_WIDTH
225
227
 
226
228
  # default location
227
229
  self.location = self.user.city
@@ -1153,13 +1155,6 @@ class KerykeionChartSVG:
1153
1155
  # Calculate the elements points
1154
1156
  self._calculate_elements_points_from_planets()
1155
1157
 
1156
- # width and height from screen
1157
- ratio = float(self.screen_width) / float(self.screen_height)
1158
- if ratio < 1.3: # 1280x1024
1159
- wm_off = 130
1160
- else: # 1024x768, 800x600, 1280x800, 1680x1050
1161
- wm_off = 100
1162
-
1163
1158
  # Viewbox and sizing
1164
1159
  svgHeight = "100%"
1165
1160
  svgWidth = "100%"
@@ -1191,10 +1186,8 @@ class KerykeionChartSVG:
1191
1186
  td["degreeRing"] = draw_transit_ring_degree_steps(r, self.user.seventh_house.abs_pos)
1192
1187
 
1193
1188
  # circles
1194
- td["c1"] = f'cx="{r}" cy="{r}" r="{r - 36}"'
1195
- td["c1style"] = f'fill: none; stroke: {self.chart_colors_settings["zodiac_transit_ring_2"]}; stroke-width: 1px; stroke-opacity:.4;'
1196
- td["c2"] = 'cx="' + str(r) + '" cy="' + str(r) + '" r="' + str(r - 72) + '"'
1197
- td["c2style"] = f"fill: {self.chart_colors_settings['paper_1']}; fill-opacity:.4; stroke: {self.chart_colors_settings['zodiac_transit_ring_1']}; stroke-opacity:.4; stroke-width: 1px"
1189
+ td["first_circle"] = draw_first_circle(r, self.chart_colors_settings["zodiac_transit_ring_2"], self.chart_type)
1190
+ td["second_circle"] = draw_second_circle(r, self.chart_colors_settings['zodiac_transit_ring_1'], self.chart_colors_settings['paper_1'], self.chart_type)
1198
1191
 
1199
1192
  td["c3"] = 'cx="' + str(r) + '" cy="' + str(r) + '" r="' + str(r - 160) + '"'
1200
1193
  td["c3style"] = f"fill: {self.chart_colors_settings['paper_1']}; fill-opacity:.8; stroke: {self.chart_colors_settings['zodiac_transit_ring_0']}; stroke-width: 1px"
@@ -1202,23 +1195,23 @@ class KerykeionChartSVG:
1202
1195
  td["makeAspects"] = self._makeAspectsTransit(r, (r - 160))
1203
1196
  td["makeAspectGrid"] = self._makeAspectTransitGrid(r)
1204
1197
  td["makePatterns"] = ""
1205
- td["chart_width"] = self.full_width
1206
1198
  else:
1207
1199
  td["transitRing"] = ""
1208
1200
  td["degreeRing"] = draw_degree_ring(r, self.c1, self.user.seventh_house.abs_pos, self.chart_colors_settings["paper_0"])
1209
1201
 
1210
- # circles
1211
- td["c1"] = f'cx="{r}" cy="{r}" r="{r - self.c1}"'
1212
- td["c1style"] = f'fill: none; stroke: {self.chart_colors_settings["zodiac_radix_ring_2"]}; stroke-width: 1px; '
1213
- td["c2"] = f'cx="{r}" cy="{r}" r="{r - self.c2}"'
1214
- td["c2style"] = f'fill: {self.chart_colors_settings["paper_1"]}; fill-opacity:.2; stroke: {self.chart_colors_settings["zodiac_radix_ring_1"]}; stroke-opacity:.4; stroke-width: 1px'
1202
+ td['first_circle'] = draw_first_circle(r, self.chart_colors_settings["zodiac_radix_ring_2"], self.chart_type, self.c1)
1203
+
1204
+ td["second_circle"] = draw_second_circle(r, self.chart_colors_settings["zodiac_radix_ring_1"], self.chart_colors_settings["paper_1"], self.chart_type, self.c2)
1205
+
1215
1206
  td["c3"] = f'cx="{r}" cy="{r}" r="{r - self.c3}"'
1216
1207
  td["c3style"] = f'fill: {self.chart_colors_settings["paper_1"]}; fill-opacity:.8; stroke: {self.chart_colors_settings["zodiac_radix_ring_0"]}; stroke-width: 1px'
1208
+
1217
1209
  td["makeAspects"] = self._makeAspects(r, (r - self.c3))
1218
1210
  td["makeAspectGrid"] = self._makeAspectGrid(r)
1219
1211
  td["makePatterns"] = self._makePatterns()
1220
- td["chart_width"] = self.natal_width
1221
-
1212
+
1213
+ td["chart_height"] = self.height
1214
+ td["chart_width"] = self.width
1222
1215
  td["circleX"] = str(0)
1223
1216
  td["circleY"] = str(0)
1224
1217
  td["svgWidth"] = str(svgWidth)
@@ -12,7 +12,7 @@
12
12
  <g transform="translate($cfgTranslate)">
13
13
  <g transform="rotate($cfgRotate)">
14
14
  <g transform="scale($cfgZoom)">
15
- <rect x="0" y="0" width="$chart_width" height="546.0" style="fill: $paper_color_1" />
15
+ <rect class="background-rectangle" x="0" y="0" width="$chart_width" height="$chart_height" style="fill: $paper_color_1" />
16
16
  <text x="20" y="30" style="fill: $paper_color_0; font-size: 24px">$stringTitle</text>
17
17
  <text x="20" y="50" style="fill: $paper_color_0; font-size: 11px">$stringName</text>
18
18
  <text x="20" y="62" style="fill: $paper_color_0; font-size: 11px">$stringLocation</text>
@@ -471,10 +471,10 @@
471
471
  $makeZodiac
472
472
 
473
473
  <!-- First Circle -->
474
- <circle $c1 style="$c1style" />
474
+ $first_circle
475
475
 
476
476
  <!-- Second Circle -->
477
- <circle $c2 style="$c2style" />
477
+ $second_circle
478
478
 
479
479
  <!-- Third Circle -->
480
480
  <circle $c3 style="$c3style" />
@@ -82,7 +82,9 @@ class FetchGeonames:
82
82
  "contry": country_code,
83
83
  "username": self.username,
84
84
  "maxRows": 1,
85
- "style": "FULL",
85
+ "style": "SHORT",
86
+ "featureClass": "A",
87
+ "featureClass": "P",
86
88
  }
87
89
 
88
90
  prepared_request = Request("GET", self.base_url, params=params).prepare()
@@ -91,6 +93,7 @@ class FetchGeonames:
91
93
  try:
92
94
  response = self.session.send(prepared_request)
93
95
  response_json = response.json()
96
+ logging.debug(f"Response from GeoNames: {response_json}")
94
97
 
95
98
  except Exception as e:
96
99
  logging.error(f"Error in fetching {self.base_url}: {e}")
@@ -133,5 +136,5 @@ if __name__ == "__main__":
133
136
  from kerykeion.utilities import setup_logging
134
137
  setup_logging(level="debug")
135
138
 
136
- geonames = FetchGeonames("Roma", "IT")
139
+ geonames = FetchGeonames("Montichiari", "IT")
137
140
  print(geonames.get_serialized_data())
@@ -4,15 +4,14 @@ from typing import TypedDict
4
4
  class ChartTemplateDictionary(TypedDict):
5
5
  transitRing: str
6
6
  degreeRing: str
7
- c1: str
8
- c1style: str
9
- c2: str
10
- c2style: str
7
+ first_circle: str
8
+ second_circle: str
11
9
  c3: str
12
10
  c3style: str
13
11
  makeAspects: str
14
12
  makeAspectGrid: str
15
13
  makePatterns: str
14
+ chart_height: float
16
15
  chart_width: float
17
16
  circleX: str
18
17
  circleY: str
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kerykeion"
3
- version = "4.8.0"
3
+ version = "4.8.1"
4
4
  authors = ["Giacomo Battaglia <battaglia.giacomo@yahoo.it>"]
5
5
  description = "A python library for astrology."
6
6
  license = "AGPL-3.0"
File without changes
File without changes
File without changes
File without changes