Skip to main content

A python library for astrology.

Project description

Kerykeion

 

Kerykeion is a python library for Astrology. It can calculate all the planet and house position, also it can calculate the aspects of a single persone or between two, you can set how many planets you need in the settings in the utility module. It also can generate an SVG of a birthchart, a synastry chart or a transit chart.

Here's an example of a birthchart: Kanye Birth Chart

Web API

If you want to use Kerykeion in a web application, I've created a web API for this purpose, you can find it here:

AstrologerAPI

It's open source, it's a way to support me and the project.

Donate

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.

If you want to support me, you can do it here:

ko-fi

Installation

Kerykeion is a Python 3.9 package, make sure you have Python 3.9 or above installed on your system.

pip3 install kerykeion

Usage

Here some examples:

# Import the main class for creating a kerykeion instance:
from kerykeion import AstrologicalSubject

# Create a kerykeion instance:
# Args: Name, year, month, day, hour, minuts, city, nation(optional)
kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta")

# Get the information about the sun in the chart:
# (The position of the planets always starts at 0)
kanye.sun

#> {'name': 'Sun', 'quality': 'Mutable', 'element': 'Air', 'sign': 'Gem', 'sign_num': 2, 'pos': 17.598992059774275, 'abs_pos': 77.59899205977428, 'emoji': '♊️', 'house': '12th House', 'retrograde': False}

# Get information about the first house:
kanye.first_house

#> {'name': 'First_House', 'quality': 'Cardinal', 'element': 'Water', 'sign': 'Can', 'sign_num': 3, 'pos': 17.995779673209114, 'abs_pos': 107.99577967320911, 'emoji': '♋️'}

# Get element of the moon sign:
kanye.moon.element

#> 'Water'

To avoid connecting to GeoNames (eg. avoiding hourly limit or no internet connection) you should instance kerykeion like this:

kanye = AstrologicalSubject(
    "Kanye", 1977, 6, 8, 8, 45,
    lng=50, lat=50, tz_str="Europe/Rome"
    )

Generate a SVG Chart:

from kerykeion import AstrologicalSubject, KerykeionChartSVG

first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma")
second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 00, "Roma")

# Set the type, it can be Natal, Synastry or Transit

name = KerykeionChartSVG(first, chart_type="Synastry", second_obj=second)
name.makeSVG()
print(len(name.aspects_list))

#> Generating kerykeion object for Jack...
#> Generating kerykeion object for Jane...
#> Jack birth location: Roma, 41.89193, 12.51133
#> SVG Generated Correctly
#> 38

Synastry Chart

Report

To print a report of all the data:

from kerykeion import Report, AstrologicalSubject

kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta")
report = Report(kanye)
report.print_report()

Returns:

+- Kerykeion report for Kanye -+
+----------+------+-------------+-----------+----------+
| Date     | Time | Location    | Longitude | Latitude |
+----------+------+-------------+-----------+----------+
| 8/6/1977 | 8:45 | Atlanta, US | -84.38798 | 33.749   |
+----------+------+-------------+-----------+----------+
+-----------+------+-------+------+----------------+
| Planet    | Sign | Pos.  | Ret. | House          |
+-----------+------+-------+------+----------------+
| Sun       | Gem  | 17.6  | -    | Twelfth_House  |
| Moon      | Pis  | 16.43 | -    | Ninth_House    |
| Mercury   | Tau  | 26.29 | -    | Eleventh_House |
| Venus     | Tau  | 2.03  | -    | Tenth_House    |
| Mars      | Tau  | 1.79  | -    | Tenth_House    |
| Jupiter   | Gem  | 14.61 | -    | Eleventh_House |
| Saturn    | Leo  | 12.8  | -    | Second_House   |
| Uranus    | Sco  | 8.27  | R    | Fourth_House   |
| Neptune   | Sag  | 14.69 | R    | Fifth_House    |
| Pluto     | Lib  | 11.45 | R    | Fourth_House   |
| Mean_Node | Lib  | 21.49 | R    | Fourth_House   |
| True_Node | Lib  | 22.82 | R    | Fourth_House   |
+-----------+------+-------+------+----------------+
+----------------+------+----------+
| House          | Sign | Position |
+----------------+------+----------+
| First_House    | Can  | 18.0     |
| Second_House   | Leo  | 9.51     |
| Third_House    | Vir  | 4.02     |
| Fourth_House   | Lib  | 3.98     |
| Fifth_House    | Sco  | 9.39     |
| Sixth_House    | Sag  | 15.68    |
| Seventh_House  | Cap  | 18.0     |
| Eighth_House   | Aqu  | 9.51     |
| Ninth_House    | Pis  | 4.02     |
| Tenth_House    | Ari  | 3.98     |
| Eleventh_House | Tau  | 9.39     |
| Twelfth_House  | Gem  | 15.68    |
+----------------+------+----------+

And if you want to export it to a file:

$ python3 your_script_name.py > file.txt

Other exeples of possibles usecase

# Get all aspects between two persons:

from kerykeion import SynastryAspects, AstrologicalSubject
first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma")
second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 00, "Roma")

name = SynastryAspects(first, second)
aspect_list = name.get_relevant_aspects()
print(aspect_list[0])

#> Generating kerykeion object for Jack...
#> Generating kerykeion object for Jane...
#> {'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}

Documentation

Most of the functions and the classes are self documented by the types and have docstrings. An auto-generated documentation is available here.

Sooner or later I'll try to write an extensive documentation.

Development

You can clone this repository or download a zip file using the right side buttons.

Contributing

Feel free to contribute to the code!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kerykeion-4.0.2.tar.gz (286.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kerykeion-4.0.2-py3-none-any.whl (300.8 kB view details)

Uploaded Python 3

File details

Details for the file kerykeion-4.0.2.tar.gz.

File metadata

  • Download URL: kerykeion-4.0.2.tar.gz
  • Upload date:
  • Size: 286.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for kerykeion-4.0.2.tar.gz
Algorithm Hash digest
SHA256 7b65ee3db3b15f9ea43d98e1f27a6b8445d5762c39188b74d81de7d2cc8bf208
MD5 2414fc913abb11943424b73cffa01daa
BLAKE2b-256 33a8db64e1b36dfcab8887e64fb7f052215d07a5605c35d7dfaef78057b4642d

See more details on using hashes here.

File details

Details for the file kerykeion-4.0.2-py3-none-any.whl.

File metadata

  • Download URL: kerykeion-4.0.2-py3-none-any.whl
  • Upload date:
  • Size: 300.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for kerykeion-4.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db91d47c1dd76eaf2d8d14ba51619f76f05e8ae6e96af6bc70e26309ffa1e8df
MD5 38e1b21220f44e8369c9a00b49ebbcb3
BLAKE2b-256 20f1055ccf9c010df9ff257e42bcd85c847bc0f6ffdce1bd0b77cbc856ff6bff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page