Skip to main content

This is a metaphysical chart library, including six line

Project description

玄学排盘库 CI License

本库用于六爻排盘(六爻预测)和八字排盘(八字预测),提供了基础的六爻、八字相关实体、符号、五行、天干地支等数据结构和推演逻辑,适合用于命理、易学、占卜等相关应用的开发。致力于面向未来,面向AI

功能简介

六爻排盘

  • 支持六爻排盘的基本流程
  • 内置天干、地支、五行、六神、卦象等基础数据
  • 提供六爻相关实体和符号的操作

八字排盘

  • 支持八字排盘的基本流程
  • 提供格局、大运、流年、神煞等分析功能
  • 内置十神、纳音、十二长生等基础数据

安装

pip install divicast

或直接克隆仓库:

git clone https://github.com/wangsquirrel/divicast.git
cd divicast
pip install .

快速上手

以下是一个简单的六爻排盘示例:

更多用法请参考 examples/sixline_example.py。

from divicast.sixline import DivinatorySymbol, rich_draw_divination, to_standard_format

# 创建一个六爻卦象
d = DivinatorySymbol.create()

# 输出文本排版格式的卦象
rich_draw_divination(d)

# 输出卦象标准化json格式
print(to_standard_format(d).model_dump_json(exclude_none=True))

八字

以下是一个简单的八字排盘示例:

更多用法请参考 examples/bazi_example.py。

import datetime
from divicast.birth_chart import BirthChart, Gender

# 创建一个八字盘
chart = BirthChart.create(
    datetime.datetime(1990, 8, 15, 14, 30, 0),
    gender=Gender.Male,
)

# 输出八字标准化json格式
print(chart.to_standard_output().model_dump_json(exclude_none=True))

时间约定

  • 本库不处理时区、地点、真太阳时换算。
  • 传入 BirthChart.create()to_standard_format()DivinatorySymbol.create() 的时间,必须是调用方已经归一化好的排盘时间。
  • 当前只接受 naive datetime。如果传入带 tzinfo 的 aware datetime,库会直接拒绝。
  • 如果你的业务口径是“当地真太阳时排盘”,请先在调用方完成转换,再把转换后的 naive datetime 传入本库。

如有问题或建议,欢迎提交 issue 或 PR

Project details


Download files

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

Source Distribution

divicast-0.2.3.tar.gz (61.8 kB view details)

Uploaded Source

Built Distribution

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

divicast-0.2.3-py3-none-any.whl (69.7 kB view details)

Uploaded Python 3

File details

Details for the file divicast-0.2.3.tar.gz.

File metadata

  • Download URL: divicast-0.2.3.tar.gz
  • Upload date:
  • Size: 61.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for divicast-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2920816a4cd450f65bb4cbc82066e5156beb15b652663abc3bf22886b393cccd
MD5 9a3ae9f4118d032c207bc1ec2c2526a9
BLAKE2b-256 c95415f295da9021c7ee66660e3839f9378bcbf22d9fa7789a6694c8d17282f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for divicast-0.2.3.tar.gz:

Publisher: publish.yml on wangsquirrel/divicast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file divicast-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: divicast-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 69.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for divicast-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c7c32dd20be823556d396ddbd5035b3f354f7ba8c68688a5cf470cdb3940da
MD5 998e9c778f8c88cbf8ca6b986a31cc40
BLAKE2b-256 c015881e6a209d958e074d41857be9512921fb7b5bd886c6889240ff271b6d4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for divicast-0.2.3-py3-none-any.whl:

Publisher: publish.yml on wangsquirrel/divicast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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