Kerykeion Documentation #
Kerykeion is a Python library for computational astrology. This documentation targets 6.0.3, a stable v6 maintenance release. It provides planetary and house position calculations (via libephemeris, with optional Swiss Ephemeris backend), aspect detection, relationship scoring, transit forecasting, and SVG chart generation with a factory-based API and Pydantic models.
What you can do with Kerykeion #
- Calculate positions for 53 chart points (planets, asteroids, TNOs, Uranian points, Arabic parts) plus fixed stars from a 1,447-name catalog
- Generate professional SVG charts in 3 themes (plus
theme=None), 2 styles, and 10 languages - Analyze aspects, element/quality distributions, and relationship compatibility
- Forecast with solar/lunar returns, transits over time ranges, and ephemeris data
- Integrate with AI/LLMs via structured XML context serialization
- Export everything as JSON via Pydantic models
Building a production app? Skip the server setup with Astrologer API – get charts, calculations, and AI interpretations via REST API. Learn more
Installation #
pip install --upgrade "kerykeion"
Requires Python 3.12 or higher.
For v4/v5 upgrades, follow the migration guide; v6 changes calculation defaults and removes deprecated APIs.
Quick Start #
from kerykeion import AstrologicalSubjectFactory, ChartDataFactory, ChartDrawer
# Create an astrological subject (offline mode with explicit coordinates)
subject = AstrologicalSubjectFactory.from_birth_data(
"John Doe", 1990, 7, 15, 10, 30,
lng=12.4964, lat=41.9028, tz_str="Europe/Rome",
online=False
)
# Access planetary positions
print(f"Sun: {subject.sun.sign} at {subject.sun.position:.2f}°") # position = 0-30° within sign
print(f"Moon: {subject.moon.sign} at {subject.moon.position:.2f}°")
print(f"Ascendant: {subject.first_house.sign}")
print(f"Sun absolute position: {subject.sun.abs_pos:.2f}°") # abs_pos = 0-360° on zodiac
# Generate an SVG chart
chart_data = ChartDataFactory.create_natal_chart_data(subject)
drawer = ChartDrawer(chart_data)
svg_string = drawer.generate_svg_string()
Output:
Sun: Can at 22.61°
Moon: Ari at 21.21°
Ascendant: Vir
Sun absolute position: 112.61°
positionvsabs_pos: Every celestial point has two position fields.positionis the degree within its sign (0-30°), whileabs_posis the absolute ecliptic longitude (0-360°). Usepositionfor display andabs_posfor calculations.
For more examples, see the Examples Gallery.
Getting Started #
- Complete Tutorial: Build a full astrology application from scratch (recommended starting point).
- Astrologer API: Production-ready REST API for commercial projects.
- Migration Guide (v4/v5 to v6): Step-by-step migration instructions for existing users.
- Troubleshooting & FAQ: Common issues and solutions.
- Glossary: Astrological terms explained for developers.
Core #
- Astrological Subject Factory: Creating astrological subjects from birth data, ISO timestamps, or current time.
- Chart Data Factory: Calculating structured chart data for natal, synastry, transit, composite, and return charts.
- Charts Module: Rendering professional SVG charts with
ChartDrawer, in the modern or classic style and at three planet-cluster sizes (glyph_size). - Chart Glyphs: Visual reference for every glyph rendered in charts (planets, points, signs, aspects).
- Report Module: Generating human-readable text reports.
Analysis #
- Aspects: Calculating angular relationships between planets (11 ecliptic aspect types plus declination parallels, configurable orbs).
- Composite Subject Factory: Creating midpoint composite charts for relationships.
- Relationship Score Factory: Quantitative compatibility scoring (Ciro Discepolo method).
- House Comparison: Bidirectional synastry house overlay analysis.
- Element & Quality Distribution: Analyzing element (Fire/Earth/Air/Water) and quality (Cardinal/Fixed/Mutable) balance.
- Chart Dominants: Dominant planet/sign/element/quality via modern, Almuten Figuris, or elemental schools.
- Mutual Receptions: Mutual reception detection via
MutualReceptionsFactory. - Horary Indicators: Horary chart significators and considerations via
HoraryIndicatorsFactory.
Forecasting #
- Planetary Return Factory: Calculating solar and lunar returns with relocation support.
- Moon Phase Details Factory: Rich lunar phase context with illumination, upcoming phases, eclipses, sun info, and moonrise/moonset.
- Transits Time Range Factory: Tracking transit aspects over a date range.
- Ephemeris Data Factory: Generating time-series planetary position data.
- Secondary Progressions: Day-for-a-year progressions via
SecondaryProgressionFactory. - Solar Arc Directions: Solar arc directed charts via
SolarArcFactory. - Primary Directions: Placidus semi-arc method via
PrimaryDirectionsFactory. - Zodiacal Releasing: Hellenistic aphesis time-lord periods from the Lot of Fortune or Spirit.
- Profections: Annual profection timeline via
ProfectionsFactory. - Firdaria: Persian planetary time-lord periods via
FirdariaFactory. - Lunation Finder: New/First-Quarter/Full/Last-Quarter Moons over a date range.
- Retrograde Stations: Planetary retrograde/direct stations over a date range, or complete retrograde periods via
retrograde_periods_from_iso_range(Chiron is opt-in). - Sign Ingresses: Planet sign-change moments over a date range, or the sign occupancy periods between them via
sign_periods_from_iso_range. - Mundane Aspects: Exact transiting-to-transiting aspects for calendar aspectarians.
- Void-of-Course Moon: Current void state and complete void windows over a range.
- Sun Times: Sunrise, sunset, twilight, solar noon, and day length.
- Planetary Hours: The 24 unequal Chaldean hours for a civil moment.
Advanced Calculations #
- Eclipse Factory: Solar and lunar eclipse search (global or location-specific).
- Planetary Phenomena: Elongation, phase, magnitude, morning/evening star status, and the solar phase (cazimi / combust / under the beams / free).
- Planetary Nodes & Apsides: Ascending/descending nodes and the orbit’s periapsis/apoapsis.
- Heliacal Risings & Settings: First/last visibility of planets relative to the Sun.
- Occultation Factory: Lunar occultation search (global or location-specific).
- Relocated Charts: Chart relocation preserving planetary positions.
- Fixed Star Discovery: Dynamic fixed star conjunction detection.
- Astro-Cartography: ACG planetary angular lines across the globe.
- Midpoints: Cosmobiology 90° dial midpoint analysis with aspect activations.
Reference #
- Types & Schemas: Complete Pydantic model and type reference.
- Active Points: Reference for the 53 non-star chart points, separately configured fixed stars, and their presets.
- Cookbook: Practical recipes and code snippets for common tasks.
- Constants: Exhaustive lists of points, aspects, and preset constants.
- Utilities: Helper functions for zodiac math, Julian Day, and SVG processing.
- Settings: Global configuration, translation utilities, and presets.
- Chart Internals: Low-level SVG rendering functions (advanced).
- Fetch Geonames: GeoNames API integration for location resolution.
- Ephemeris Backend: Backend configuration (libephemeris vs Swiss Ephemeris).
- Backend Precision Comparison: Numerical and behavioral differences between the two backends.
- Swiss Ephemeris Configuration: Optional Swiss Ephemeris backend setup, fixed-star catalog, and precision notes.
- Legacy API: Migration info for v4/v5 users (removed in v6).
Integration #
- AI Context Serializer: Serializing chart data to non-qualitative XML for LLM/AI consumption.
- Command Line Interface: The optional
kerykeion[cli]extra — every chart, technique and factory from the terminal.