Code does the chart. AI does the reading.
Chinese astrology (Zi Wei Dou Shu) chart engine
Zi Wei Dou Shu — Chinese "Purple Star" astrology — charts a life from a birth date and hour. A Rust core casts it, with bindings for Rust, Python and Go; every field carries a translated name plus a stable key, and one call turns the whole chart into text an LLM can read. Charts match JS iztro field for field — 716,314 golden cases hold that line.
Not writing code? Start here →- Solar
- 2000-8-16
- Soul
- Po Jun
- Element
- Wood 3
- golden cases
- 716,314
- tolerated deviations
- 0
- pattern rules
- 64
- output languages
- 6
What the model gets
One call renders the whole chart as structured text — paste it into any LLM and start asking. Brackets are brightness and the four transformations; there is a matching call for horoscopes.
How it is generated →=== Basic Info ===
Gender: female
Solar Date: 2000-8-16
Lunar Date: 二〇〇〇年七月十七
Chinese Date: geng chen - jia shen - bing woo - geng yin
…
Soul Palace Branch: woo
Body Palace Branch: xu
Soul Star: rebel
Body Star: scholar
Five Elements Class: wood 3rd
Birth-Year Mutagen: sunA, generalB, moonC, fortunateD
=== Palaces ===
--- wealth ---
…
Major Stars: general([+1])[B], minister([+3])
Minor Stars: horse
Adjective Stars: considery, senior, ageless, psychic, gourmet, gloomy, upset
… (the other eleven palaces)x-iztro and iztro
Identical to JS iztro
- Charts, twelve palaces (body and Original palace included), six horoscope levels
- Palace queries, surrounded palaces, flying stars
- Serialized JSON, key for key
- 716,314 golden cases, zero tolerated deviations
Beyond iztro
- 64 pattern rules — each hit names its palace, variant and the stars that triggered it
- Knowledge packs — reading texts in swappable JSON, default pack included
- Reverse lookup — BaZi pillars or chart features back to birth dates
from x_iztro import Astro
astro = Astro()
# time_index 2 = Tiger hour
chart = astro.by_solar("2000-8-16", 2, "female")
chart.soul # soul star
chart.palace("soulPalace") # soul palace
chart.patterns() # pattern hits
astro.astrolabe_to_prompt(chart) # chart -> textComplete charts and horoscopes
Natal chart plus six horoscope levels — decadal (a childhood scope runs before it begins), age fortune, yearly, monthly, daily and hourly — with mutagens, flowing stars and surrounded palaces.
Configurable schools and boundaries
Six switches for the year, horoscope, age and late-Rat-hour boundaries, the school and the chart perspective. Defaults match iztro exactly; custom mutagen and brightness tables are supported.
Language-independent keys
Every translatable field carries a stable key. Write the logic once; it behaves identically across all six output languages.
An interface built for AI
Prompt output is deterministic, with a stable field order — usable directly as a tool-call result. The docs ship llms.txt, and every docs page serves plain text with .md appended.
- No global state
- Invalid input errors, never panics
- Python: abi3, zero deps
- Go: no cgo
- MIT licensed