
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Kerykeion is a Python library for astrology. It computes planetary and house positions, detects aspects, and generates SVG charts—including birth, synastry, transit, and composite charts. You can also customize which planets to include in your calculations.
The main goal of this project is to offer a clean, data-driven approach to astrology, making it accessible and programmable.
Kerykeion also integrates seamlessly with LLM and AI applications.
Here is an example of a birthchart:
If you want to use Kerykeion in a web application, you can try the dedicated web API:
It is open source and directly supports this project.
Maintaining this project requires substantial time and effort. The Astrologer API alone cannot cover the costs of full-time development. If you find Kerykeion valuable and would like to support further development, please consider donating:
Kerykeion requires Python 3.9 or higher.
pip3 install kerykeion
Below is a simple example illustrating the creation of an astrological subject and retrieving astrological details:
from kerykeion import AstrologicalSubject
# Create an instance of the AstrologicalSubject class.
# Arguments: Name, year, month, day, hour, minutes, city, nation
kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta", "US")
# Retrieve information about the Sun:
kanye.sun
# > {'name': 'Sun', 'quality': 'Mutable', 'element': 'Air', 'sign': 'Gem', 'sign_num': 2, ...}
# Retrieve information about the first house:
kanye.first_house
# > {'name': 'First_House', 'quality': 'Cardinal', 'element': 'Water', 'sign': 'Can', ...}
# Retrieve the element of the Moon sign:
kanye.moon.element
# > 'Water'
To avoid using GeoNames online, specify longitude, latitude, and timezone instead of city and nation:
kanye = AstrologicalSubject(
"Kanye", 1977, 6, 8, 8, 45,
lng=50,
lat=50,
tz_str="Europe/Rome",
city="Rome"
)
from kerykeion import AstrologicalSubject, KerykeionChartSVG
birth_chart = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta", "US")
birth_chart_svg = KerykeionChartSVG(birth_chart)
birth_chart_svg.makeSVG()
The SVG file will be saved in the home directory.
from kerykeion import AstrologicalSubject, KerykeionChartSVG
first = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB")
second = AstrologicalSubject("Paul McCartney", 1942, 6, 18, 15, 30, "Liverpool", "GB")
synastry_chart = KerykeionChartSVG(first, "Synastry", second)
synastry_chart.makeSVG()
from kerykeion import AstrologicalSubject
transit = AstrologicalSubject("Transit", 2025, 6, 8, 8, 45, "Atlanta", "US")
subject = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB")
transit_chart = KerykeionChartSVG(subject, "Transit", transit)
transit_chart.makeSVG()
from kerykeion import CompositeSubjectFactory, AstrologicalSubject, KerykeionChartSVG
angelina = AstrologicalSubject("Angelina Jolie", 1975, 6, 4, 9, 9, "Los Angeles", "US", lng=-118.15, lat=34.03, tz_str="America/Los_Angeles")
brad = AstrologicalSubject("Brad Pitt", 1963, 12, 18, 6, 31, "Shawnee", "US", lng=-96.56, lat=35.20, tz_str="America/Chicago")
factory = CompositeSubjectFactory(angelina, brad)
composite_model = factory.get_midpoint_composite_subject_model()
composite_chart = KerykeionChartSVG(composite_model, "Composite")
composite_chart.makeSVG()
To save the SVG file in a custom location, specify new_output_directory
:
from kerykeion import AstrologicalSubject, KerykeionChartSVG
first = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB")
second = AstrologicalSubject("Paul McCartney", 1942, 6, 18, 15, 30, "Liverpool", "GB")
synastry_chart = KerykeionChartSVG(
first, "Synastry", second,
new_output_directory="."
)
synastry_chart.makeSVG()
You can switch chart language by passing chart_language
to the AstrologicalSubject
or KerykeionChartSVG
classes:
first = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB", chart_language="ES")
More details here.
from kerykeion import Report, AstrologicalSubject
kanye = AstrologicalSubject("Kanye", 1977, 6, 8, 8, 45, "Atlanta", "US")
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 |
| Mean_South_Node | Ari | 21.49 | R | Tenth_House |
| True_South_Node | Ari | 22.82 | R | Tenth_House |
| Chiron | Tau | 4.17 | - | Tenth_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 |
+----------------+------+----------+
To export to a file:
```bash
python3 your_script_name.py > file.txt
from kerykeion import SynastryAspects, AstrologicalSubject
first = AstrologicalSubject("Jack", 1990, 6, 15, 15, 15, "Roma", "IT")
second = AstrologicalSubject("Jane", 1991, 10, 25, 21, 0, "Roma", "IT")
name = SynastryAspects(first, second)
aspect_list = name.get_relevant_aspects()
print(aspect_list[0])
#> {'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}
By default, the zodiac type is Tropical. To use Sidereal, specify the sidereal mode:
johnny = AstrologicalSubject(
"Johnny Depp", 1963, 6, 9, 0, 0,
"Owensboro", "US",
zodiac_type="Sidereal",
sidereal_mode="LAHIRI"
)
More examples here.
Full list of supported sidereal modes here.
By default, houses are calculated using Placidus. Configure a different house system as follows:
johnny = AstrologicalSubject(
"Johnny Depp", 1963, 6, 9, 0, 0,
"Owensboro", "US",
houses_system="M"
)
More examples here.
Full list of supported house systems here.
So far all the available houses system in the Swiss Ephemeris are supported but the Gauquelin Sectors.
By default, Kerykeion uses the Apparent Geocentric perspective (the most standard in astrology). Other perspectives (e.g., Heliocentric) can be set this way:
johnny = AstrologicalSubject(
"Johnny Depp", 1963, 6, 9, 0, 0,
"Owensboro", "US",
perspective_type="Heliocentric"
)
More examples here.
Full list of supported perspective types here.
Kerykeion provides several chart themes:
Each theme offers a distinct visual style, allowing you to choose the one that best suits your preferences or presentation needs. If you prefer more control over the appearance, you can opt not to set any theme, making it easier to customize the chart by overriding the default CSS variables. For more detailed instructions on how to apply themes, check the documentation
Here's an example of how to set the theme:
from kerykeion import AstrologicalSubject, KerykeionChartSVG
dark_theme_subject = AstrologicalSubject("John Lennon - Dark Theme", 1940, 10, 9, 18, 30, "Liverpool", "GB")
dark_theme_natal_chart = KerykeionChartSVG(dark_high_contrast_theme_subject, theme="dark_high_contrast")
dark_theme_natal_chart.makeSVG()
Create an AstrologicalSubject
from a UTC ISO 8601 string:
subject = AstrologicalSubject.get_from_iso_utc_time(
"Johnny Depp", "1963-06-09T05:00:00Z", "Owensboro", "US"
)
If you set online=True
, provide a geonames_username
to allow city-based geolocation:
from kerykeion.astrological_subject import AstrologicalSubject
subject = AstrologicalSubject.get_from_iso_utc_time(
"Johnny Depp", "1963-06-09T05:00:00Z", "Owensboro", "US", online=True
)
Kerykeion supports both True and Mean Lunar Nodes:
"true_node"
(name kept without "north" for backward compatibility)."true_south_node"
."mean_node"
(name kept without "north" for backward compatibility)."mean_south_node"
.In instances of the AstrologicalSubject class, all of them are active by default.
In instances of the classes used to generate aspects and SVG charts, only the mean nodes are active. To activate the true nodes, you need to pass the active_points
parameter to the KerykeionChartSVG
class.
Example:
from kerykeion import AstrologicalSubject, KerykeionChartSVG
subject = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB")
chart = KerykeionChartSVG(
subject,
active_points=[
"Sun",
"Moon",
"Mercury",
"Venus",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
"Pluto",
"Mean_Node",
"Mean_South_Node",
"True_Node", # Activates True North Node
"True_South_Node", # Activates True South Node
"Ascendant",
"Medium_Coeli",
"Descendant",
"Imum_Coeli"
]
)
chart.makeSVG()
You can serialize the astrological subject (the base data used throughout the library) to JSON:
from kerykeion import AstrologicalSubject
johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US")
print(johnny.json(dump=False, indent=2))
You can find auto-generated documentation here. Most classes and functions include docstrings.
Clone the repository or download the ZIP via the GitHub interface.
If you would like to incorporate Kerykeion’s astrological features into your application, please reach out via email. Whether you need custom features, support, or specialized consulting, I am happy to discuss potential collaborations.
This project is covered under the AGPL-3.0 License. For detailed information, please see the LICENSE file. If you have questions, feel free to contact me at kerykeion.astrology@gmail.com.
As a rule of thumb, if you use this library in a project, you should open-source that project under a compatible license. Alternatively, if you wish to keep your source closed, consider using the AstrologerAPI, which is AGPL-3.0 compliant and also helps support the project.
Since the AstrologerAPI is an external third-party service, using it does not require your code to be open-source.
Contributions are welcome! Feel free to submit pull requests or report issues.
If using Kerykeion in published or academic work, please cite as follows:
Battaglia, G. (2025). Kerykeion: A Python Library for Astrological Calculations and Chart Generation.
https://github.com/g-battaglia/kerykeion
FAQs
A python library for astrology.
We found that kerykeion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.