kerykeion 4.12.0__tar.gz → 4.12.2__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.12.0 → kerykeion-4.12.2}/PKG-INFO +29 -3
  2. {kerykeion-4.12.0 → kerykeion-4.12.2}/README.md +28 -2
  3. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/astrological_subject.py +117 -16
  4. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/kr_types/kr_models.py +4 -0
  5. {kerykeion-4.12.0 → kerykeion-4.12.2}/pyproject.toml +1 -1
  6. {kerykeion-4.12.0 → kerykeion-4.12.2}/LICENSE +0 -0
  7. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/__init__.py +0 -0
  8. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/aspects/__init__.py +0 -0
  9. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/aspects/aspects_utils.py +0 -0
  10. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/aspects/natal_aspects.py +0 -0
  11. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/aspects/synastry_aspects.py +0 -0
  12. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/charts/__init__.py +0 -0
  13. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/charts/charts_utils.py +0 -0
  14. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/charts/kerykeion_chart_svg.py +0 -0
  15. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/charts/templates/chart.xml +0 -0
  16. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/enums.py +0 -0
  17. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/fetch_geonames.py +0 -0
  18. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/kr_types/__init__.py +0 -0
  19. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/kr_types/chart_types.py +0 -0
  20. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/kr_types/kerykeion_exception.py +0 -0
  21. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/kr_types/kr_literals.py +0 -0
  22. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/kr_types/settings_models.py +0 -0
  23. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/relationship_score.py +0 -0
  24. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/report.py +0 -0
  25. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/settings/__init__.py +0 -0
  26. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/settings/kerykeion_settings.py +0 -0
  27. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/settings/kr.config.json +0 -0
  28. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/sweph/README.md +0 -0
  29. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/sweph/seas_18.se1 +0 -0
  30. {kerykeion-4.12.0 → kerykeion-4.12.2}/kerykeion/utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kerykeion
3
- Version: 4.12.0
3
+ Version: 4.12.2
4
4
  Summary: A python library for astrology.
5
5
  Home-page: https://www.kerykeion.net/
6
6
  License: AGPL-3.0
@@ -236,7 +236,7 @@ And if you want to export it to a file:
236
236
  python3 your_script_name.py > file.txt
237
237
  ```
238
238
 
239
- ## Other exeples of possibles usecase
239
+ ## Other examples of possible use cases:
240
240
 
241
241
  ```python
242
242
  # Get all aspects between two persons:
@@ -257,7 +257,8 @@ print(aspect_list[0])
257
257
 
258
258
  ## Ayanamsa (Sidereal Modes)
259
259
 
260
- You can set the zodiac type and the sidereal mode in the AstrologicalSubject class:
260
+ By default, the zodiac type is set to Tropic (Tropical).
261
+ You can set the zodiac type to Sidereal and the sidereal mode in the AstrologicalSubject class:
261
262
 
262
263
  ```python
263
264
  johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US", zodiac_type="Sidereal", sidereal_mode="LAHIRI")
@@ -269,6 +270,7 @@ Full list of supported sidereal modes [here](https://www.kerykeion.net/pydocs/ke
269
270
 
270
271
  ## Houses Systems
271
272
 
273
+ By default, the houses system is set to Placidus.
272
274
  You can set the houses system in the AstrologicalSubject class:
273
275
 
274
276
  ```python
@@ -283,6 +285,7 @@ So far all the available houses system in the Swiss Ephemeris are supported but
283
285
 
284
286
  ## Perspective Type
285
287
 
288
+ By default, the perspective type is set to Apparent Geocentric (the most common standard for astrology).
286
289
  The perspective indicates the point of view from which the chart is calculated (Es. Apparent Geocentric, Heliocentric, etc.).
287
290
  You can set the perspective type in the AstrologicalSubject class:
288
291
 
@@ -294,6 +297,29 @@ More examples [here](https://www.kerykeion.net/docs/examples/perspective-type/).
294
297
 
295
298
  Full list of supported perspective types [here](https://www.kerykeion.net/pydocs/kerykeion/kr_types/kr_literals.html#PerspectiveType).
296
299
 
300
+ ## Alternative Initialization
301
+
302
+ You can initialize the AstrologicalSubject from a **UTC** ISO 8601 string:
303
+
304
+ ```python
305
+ subject = AstrologicalSubject.get_from_iso_utc_time(
306
+ "Johnny Depp", "1963-06-09T05:00:00Z", "Owensboro", "US")
307
+ ```
308
+
309
+ Note : The default time zone is UTC, with Greenwich longitude and latitude.
310
+
311
+
312
+ The default online/offline mode is set to offline, if you set it online the default latitude and longitude will be ignored and
313
+ calculated from the city and nation. Remember to pass also the geonames_username parameter if you want to use the online mode, like this:
314
+
315
+ ```python
316
+ from kerykeion.astrological_subject import AstrologicalSubject
317
+
318
+ # Use the static method get_from_iso_utc_time to create an instance of AstrologicalSubject
319
+ subject2 = AstrologicalSubject.get_from_iso_utc_time(
320
+ "Johnny Depp", "1963-06-09T05:00:00Z", "Owensboro", "US", online=True)
321
+ ```
322
+
297
323
  ## Documentation
298
324
 
299
325
  Most of the functions and the classes are self documented by the types and have docstrings.
@@ -199,7 +199,7 @@ And if you want to export it to a file:
199
199
  python3 your_script_name.py > file.txt
200
200
  ```
201
201
 
202
- ## Other exeples of possibles usecase
202
+ ## Other examples of possible use cases:
203
203
 
204
204
  ```python
205
205
  # Get all aspects between two persons:
@@ -220,7 +220,8 @@ print(aspect_list[0])
220
220
 
221
221
  ## Ayanamsa (Sidereal Modes)
222
222
 
223
- You can set the zodiac type and the sidereal mode in the AstrologicalSubject class:
223
+ By default, the zodiac type is set to Tropic (Tropical).
224
+ You can set the zodiac type to Sidereal and the sidereal mode in the AstrologicalSubject class:
224
225
 
225
226
  ```python
226
227
  johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US", zodiac_type="Sidereal", sidereal_mode="LAHIRI")
@@ -232,6 +233,7 @@ Full list of supported sidereal modes [here](https://www.kerykeion.net/pydocs/ke
232
233
 
233
234
  ## Houses Systems
234
235
 
236
+ By default, the houses system is set to Placidus.
235
237
  You can set the houses system in the AstrologicalSubject class:
236
238
 
237
239
  ```python
@@ -246,6 +248,7 @@ So far all the available houses system in the Swiss Ephemeris are supported but
246
248
 
247
249
  ## Perspective Type
248
250
 
251
+ By default, the perspective type is set to Apparent Geocentric (the most common standard for astrology).
249
252
  The perspective indicates the point of view from which the chart is calculated (Es. Apparent Geocentric, Heliocentric, etc.).
250
253
  You can set the perspective type in the AstrologicalSubject class:
251
254
 
@@ -257,6 +260,29 @@ More examples [here](https://www.kerykeion.net/docs/examples/perspective-type/).
257
260
 
258
261
  Full list of supported perspective types [here](https://www.kerykeion.net/pydocs/kerykeion/kr_types/kr_literals.html#PerspectiveType).
259
262
 
263
+ ## Alternative Initialization
264
+
265
+ You can initialize the AstrologicalSubject from a **UTC** ISO 8601 string:
266
+
267
+ ```python
268
+ subject = AstrologicalSubject.get_from_iso_utc_time(
269
+ "Johnny Depp", "1963-06-09T05:00:00Z", "Owensboro", "US")
270
+ ```
271
+
272
+ Note : The default time zone is UTC, with Greenwich longitude and latitude.
273
+
274
+
275
+ The default online/offline mode is set to offline, if you set it online the default latitude and longitude will be ignored and
276
+ calculated from the city and nation. Remember to pass also the geonames_username parameter if you want to use the online mode, like this:
277
+
278
+ ```python
279
+ from kerykeion.astrological_subject import AstrologicalSubject
280
+
281
+ # Use the static method get_from_iso_utc_time to create an instance of AstrologicalSubject
282
+ subject2 = AstrologicalSubject.get_from_iso_utc_time(
283
+ "Johnny Depp", "1963-06-09T05:00:00Z", "Owensboro", "US", online=True)
284
+ ```
285
+
260
286
  ## Documentation
261
287
 
262
288
  Most of the functions and the classes are self documented by the types and have docstrings.
@@ -8,6 +8,7 @@ import swisseph as swe
8
8
  import logging
9
9
 
10
10
  from datetime import datetime
11
+ from functools import cached_property
11
12
  from kerykeion.fetch_geonames import FetchGeonames
12
13
  from kerykeion.kr_types import (
13
14
  KerykeionException,
@@ -35,6 +36,16 @@ DEFAULT_GEONAMES_USERNAME = "century.boy"
35
36
  DEFAULT_SIDEREAL_MODE = "FAGAN_BRADLEY"
36
37
  DEFAULT_HOUSES_SYSTEM = "P"
37
38
  PERSPECTIVE_TYPE = "Apparent Geocentric"
39
+ GEONAMES_DEFAULT_USERNAME_WARNING = (
40
+ "\n********\n"
41
+ "NO GEONAMES USERNAME SET!\n"
42
+ "Using the default geonames username is not recommended, please set a custom one!\n"
43
+ "You can get one for free here:\n"
44
+ "https://www.geonames.org/login\n"
45
+ "Keep in mind that the default username is limited to 2000 requests per hour and is shared with everyone else using this library.\n"
46
+ "********"
47
+ )
48
+
38
49
  NOW = datetime.now()
39
50
 
40
51
 
@@ -189,20 +200,7 @@ class AstrologicalSubject:
189
200
  # This message is set to encourage the user to set a custom geonames username
190
201
  if geonames_username is None and online:
191
202
  logging.warning(
192
- "\n"
193
- "********" +
194
- "\n" +
195
- "NO GEONAMES USERNAME SET!" +
196
- "\n" +
197
- "Using the default geonames username is not recommended, please set a custom one!" +
198
- "\n" +
199
- "You can get one for free here:" +
200
- "\n" +
201
- "https://www.geonames.org/login" +
202
- "\n" +
203
- "Keep in mind that the default username is limited to 2000 requests per hour and is shared with everyone else using this library." +
204
- "\n" +
205
- "********"
203
+
206
204
  )
207
205
 
208
206
  self.geonames_username = DEFAULT_GEONAMES_USERNAME
@@ -310,6 +308,10 @@ class AstrologicalSubject:
310
308
  self._planets_in_houses()
311
309
  self._lunar_phase_calc()
312
310
 
311
+ # Deprecated properties
312
+ self.utc_time
313
+ self.local_time
314
+
313
315
  def __str__(self) -> str:
314
316
  return f"Astrological data for: {self.name}, {self.iso_formatted_utc_datetime} UTC\nBirth location: {self.city}, Lat {self.lat}, Lon {self.lng}"
315
317
 
@@ -646,6 +648,106 @@ class AstrologicalSubject:
646
648
 
647
649
  return AstrologicalSubjectModel(**self.__dict__)
648
650
 
651
+ @cached_property
652
+ def utc_time(self) -> float:
653
+ """
654
+ Deprecated property, use iso_formatted_utc_datetime instead, will be removed in the future.
655
+ Returns the UTC time as a float.
656
+ """
657
+ dt = datetime.fromisoformat(self.iso_formatted_utc_datetime)
658
+
659
+ # Extract the hours, minutes, and seconds
660
+ hours = dt.hour
661
+ minutes = dt.minute
662
+ seconds = dt.second + dt.microsecond / 1_000_000
663
+
664
+ # Convert time to float hours
665
+ float_time = hours + minutes / 60 + seconds / 3600
666
+
667
+ return float_time
668
+
669
+ @cached_property
670
+ def local_time(self) -> float:
671
+ """
672
+ Deprecated property, use iso_formatted_local_datetime instead, will be removed in the future.
673
+ Returns the local time as a float.
674
+ """
675
+ dt = datetime.fromisoformat(self.iso_formatted_local_datetime)
676
+
677
+ # Extract the hours, minutes, and seconds
678
+ hours = dt.hour
679
+ minutes = dt.minute
680
+ seconds = dt.second + dt.microsecond / 1_000_000
681
+
682
+ # Convert time to float hours
683
+ float_time = hours + minutes / 60 + seconds / 3600
684
+
685
+ return float_time
686
+
687
+
688
+ @staticmethod
689
+ def get_from_iso_utc_time(
690
+ name: str,
691
+ iso_utc_time: str,
692
+ city: str = "Greenwich",
693
+ nation: str = "GB",
694
+ tz_str: str = "Etc/GMT",
695
+ online: bool = False,
696
+ lng: Union[int, float] = 0,
697
+ lat: Union[int, float] = 51.5074,
698
+ geonames_username: str = DEFAULT_GEONAMES_USERNAME
699
+ ) -> "AstrologicalSubject":
700
+ """
701
+ Creates an AstrologicalSubject object from an iso formatted UTC time.
702
+ This method is offline by default, set online=True to fetch the timezone and coordinates from geonames.
703
+
704
+ Args:
705
+ - name (str): The name of the subject.
706
+ - iso_utc_time (str): The iso formatted UTC time.
707
+ - city (str, optional): City or location of birth. Defaults to "Greenwich".
708
+ - nation (str, optional): Nation of birth. Defaults to "GB".
709
+ - tz_str (str, optional): Timezone of the birth location. Defaults to "Etc/GMT".
710
+ - online (bool, optional): Sets if you want to use the online mode, which fetches the timezone and coordinates from geonames.
711
+ If you already have the coordinates and timezone, set this to False. Defaults to False.
712
+ - lng (Union[int, float], optional): Longitude of the birth location. Defaults to 0 (Greenwich, London).
713
+ - lat (Union[int, float], optional): Latitude of the birth location. Defaults to 51.5074 (Greenwich, London).
714
+ - geonames_username (str, optional): The username for the geonames API. Note: Change this to your own username to avoid rate limits!
715
+ You can get one for free here: https://www.geonames.org/login
716
+
717
+ Returns:
718
+ - AstrologicalSubject: The AstrologicalSubject object.
719
+ """
720
+ dt = datetime.fromisoformat(iso_utc_time)
721
+
722
+ if online == True:
723
+ if geonames_username == DEFAULT_GEONAMES_USERNAME:
724
+ logging.warning(GEONAMES_DEFAULT_USERNAME_WARNING)
725
+
726
+ geonames = FetchGeonames(
727
+ city,
728
+ nation,
729
+ username=geonames_username,
730
+ )
731
+ city_data: dict[str, str] = geonames.get_serialized_data()
732
+ lng = float(city_data["lng"])
733
+ lat = float(city_data["lat"])
734
+
735
+ subject = AstrologicalSubject(
736
+ name=name,
737
+ year=dt.year,
738
+ month=dt.month,
739
+ day=dt.day,
740
+ hour=dt.hour,
741
+ minute=dt.minute,
742
+ city=city,
743
+ nation=city,
744
+ lng=lng,
745
+ lat=lat,
746
+ tz_str=tz_str,
747
+ online=False
748
+ )
749
+
750
+ return subject
649
751
 
650
752
  if __name__ == "__main__":
651
753
  import json
@@ -684,5 +786,4 @@ if __name__ == "__main__":
684
786
  print(johnny.json(dump=True, indent=2))
685
787
 
686
788
  # With Topocentric Perspective
687
- johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US", perspective_type="Topocentric")
688
- print(johnny.json(dump=True, indent=2))
789
+ johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US", perspective_type="Topocentric")
@@ -109,6 +109,10 @@ class AstrologicalSubjectModel(SubscriptableBaseModel):
109
109
  # Lunar Phase
110
110
  lunar_phase: LunarPhaseModel
111
111
 
112
+ # Deprecated properties
113
+ utc_time: float
114
+ local_time: float
115
+
112
116
  # Lists
113
117
  # houses_list: list[KerykeionPointModel]
114
118
  # planets_list: list[KerykeionPointModel]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kerykeion"
3
- version = "4.12.0"
3
+ version = "4.12.2"
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