kerykeion 4.12.1__py3-none-any.whl → 4.12.2__py3-none-any.whl

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.

@@ -36,6 +36,16 @@ DEFAULT_GEONAMES_USERNAME = "century.boy"
36
36
  DEFAULT_SIDEREAL_MODE = "FAGAN_BRADLEY"
37
37
  DEFAULT_HOUSES_SYSTEM = "P"
38
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
+
39
49
  NOW = datetime.now()
40
50
 
41
51
 
@@ -190,20 +200,7 @@ class AstrologicalSubject:
190
200
  # This message is set to encourage the user to set a custom geonames username
191
201
  if geonames_username is None and online:
192
202
  logging.warning(
193
- "\n"
194
- "********" +
195
- "\n" +
196
- "NO GEONAMES USERNAME SET!" +
197
- "\n" +
198
- "Using the default geonames username is not recommended, please set a custom one!" +
199
- "\n" +
200
- "You can get one for free here:" +
201
- "\n" +
202
- "https://www.geonames.org/login" +
203
- "\n" +
204
- "Keep in mind that the default username is limited to 2000 requests per hour and is shared with everyone else using this library." +
205
- "\n" +
206
- "********"
203
+
207
204
  )
208
205
 
209
206
  self.geonames_username = DEFAULT_GEONAMES_USERNAME
@@ -687,6 +684,71 @@ class AstrologicalSubject:
687
684
 
688
685
  return float_time
689
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
751
+
690
752
  if __name__ == "__main__":
691
753
  import json
692
754
  from kerykeion.utilities import setup_logging
@@ -724,8 +786,4 @@ if __name__ == "__main__":
724
786
  print(johnny.json(dump=True, indent=2))
725
787
 
726
788
  # With Topocentric Perspective
727
- johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US", perspective_type="Topocentric")
728
-
729
- # Print the utc time
730
- print(johnny.utc_time)
731
- print(johnny.local_time)
789
+ johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US", perspective_type="Topocentric")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kerykeion
3
- Version: 4.12.1
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.
@@ -4,7 +4,7 @@ kerykeion/aspects/__init__.py,sha256=9FlDVI1ndCJga0-chNIhcLitjU_x3kbtAFfFqVp2ejc
4
4
  kerykeion/aspects/aspects_utils.py,sha256=ZCOnhgW6CZQrCruAGaf8vkUlBtjubbfKOqXy6qyQupE,5321
5
5
  kerykeion/aspects/natal_aspects.py,sha256=R47UToYKqbVrRmGzmY4pgsikcoXNmJvs5KhSmz7HZtM,4460
6
6
  kerykeion/aspects/synastry_aspects.py,sha256=BqG0E4tDZJjPQm3NTX3G6LkTuijP0AsKtI9pwH0F_Mc,3946
7
- kerykeion/astrological_subject.py,sha256=D4uKyUf7RMtRUu9cil2uDm2btR2AjPtsTTI9cldNIBA,28799
7
+ kerykeion/astrological_subject.py,sha256=NHeEp9lGG1pXPJfxyCe0gWGweSXqL0QqLe-3jhtfm7s,31126
8
8
  kerykeion/charts/__init__.py,sha256=Juxkduy2TaagWblh_7CE8Acrg3dHL27-WEddJhau_eQ,127
9
9
  kerykeion/charts/charts_utils.py,sha256=Pfy-SkPnABIy5ZkKgypnGqxXOAKhTRIeQX3fQKO8DgQ,15065
10
10
  kerykeion/charts/kerykeion_chart_svg.py,sha256=P3xRWedqdbYjeI1xX9saL729IXBfJ_8TWLz1AzUF5vI,64864
@@ -25,8 +25,8 @@ kerykeion/settings/kr.config.json,sha256=1Yhv9RGHom5U9e-JZZRWVfT2Ubllz2WrckdwadD
25
25
  kerykeion/sweph/README.md,sha256=L7FtNAJTWtrZNGKa8MX87SjduFYPYxwWhaI5fmtzNZo,73
26
26
  kerykeion/sweph/seas_18.se1,sha256=X9nCqhZU43wJpq61WAdueVQJt9xL2UjrwPqn1Kdoa1s,223002
27
27
  kerykeion/utilities.py,sha256=1GxV7Du2L9QZEwNKc0oDjNsEddpAFCqY_kyWx38IRiA,11392
28
- kerykeion-4.12.1.dist-info/LICENSE,sha256=UTLH8EdbAsgQei4PA2PnBCPGLSZkq5J-dhkyJuXgWQU,34273
29
- kerykeion-4.12.1.dist-info/METADATA,sha256=C84nyQ5laKPmvntBPmArcKuUI5JahMB4FCM6zzR8Su0,12573
30
- kerykeion-4.12.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
- kerykeion-4.12.1.dist-info/entry_points.txt,sha256=5SmANYscFDDTdeovHvGQ-cnj0hdFvGoxPaWLCpyDFnQ,49
32
- kerykeion-4.12.1.dist-info/RECORD,,
28
+ kerykeion-4.12.2.dist-info/LICENSE,sha256=UTLH8EdbAsgQei4PA2PnBCPGLSZkq5J-dhkyJuXgWQU,34273
29
+ kerykeion-4.12.2.dist-info/METADATA,sha256=bb53HhXqKyYf_IQW1InjRvBq6kf-pnlQfj0vBblRYxo,13680
30
+ kerykeion-4.12.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
+ kerykeion-4.12.2.dist-info/entry_points.txt,sha256=5SmANYscFDDTdeovHvGQ-cnj0hdFvGoxPaWLCpyDFnQ,49
32
+ kerykeion-4.12.2.dist-info/RECORD,,