No project description provided
Project description
I-Ching Python
Description
I-Ching Python is a fully object-oriented Python library for working with the I-Ching, an ancient Chinese divination text. This library provides tools for
- generating hexagrams using multiple methods,
- interpreting their meanings (TODO)
- performing divination based on the I-Ching (TODO)
- arithmetic operations on Heavenly Stems and Earthly Branches (干支)
Installation
pip install ichingpy
Quick Start
import ichingpy as icp
Create a Line (爻)
yin = icp.Line(status=icp.LineStatus.CHANGING)
Create a Trigram (八卦) The default constructor takes a list of Lines. An alternative constructor is to create from "binary" as defined in LineStatus:
- 0: changing yin (老阴)
- 1: static yang (少阳)
- 2: static yin (少阴)
- 3: changing yang (老阳)
qian = icp.Trigram.from_binary([1, 1, 1])
The order is from the inside (初爻, 二爻, 三爻).
Create a Hexagram with transformation (变卦)
qian_tai = icp.Hexagram.from_binary([3, 3, 3, 1, 1, 1]) # 乾之泰
A Hexagram can be also generated by using 50 yarrow stalks or 3 coins
hexagram = icp.Hexagram.from_three_coins()
hexagram = icp.Hexagram.from_yarrow_stalks()
-- --
-- --
-- --
----- O -> -- --
-- --
----- O -> -- --
Assign HeavenlyStems to a hexagram
from ichingpy.calculator.assigner import HexagramAssigner
hexagram = icp.Hexagram.from_yarrow_stalks()
assigner = HexagramAssigner()
assigner.assign_stems(hexagram)
hexagram.inner.stem
[<HeavenlyStem.Ji: 6>, <HeavenlyStem.Ji: 6>, <HeavenlyStem.Ji: 6>]
Arithmetic operations on Heavenly Stems and Earthly Branches (干支)
>>> icp.HeavenlyStem.Jia + 1
<HeavenlyStem.Yi: 2>
>>> gui = icp.HeavenlyStem.Gui
>>> jia = icp.HeavenlyStem.Jia
>>> jia + gui
<HeavenlyStem.Jia: 1>
>>> jia = icp.HeavenlyStem.Jia
>>> zi = icp.EarthlyBranch.Zi
>>> jia_zi = icp.SexagenaryCycle(jia, zi)
>>> jia_zi
甲子
>>> jia_zi+1
乙丑
>>> jia_zi+60
甲子
Assign Stem and Branch to a hexagram (装卦、纳甲)
>>> gou = icp.Hexagram.from_binary([2, 1, 1, 1, 1, 1])
>>> gou
-----
-----
-----
-----
-----
-- --
>>> assigner = icp.StemBranchAssigner()
>>> assigner.assign(gou)
>>> gou
壬 戌 -----
壬 申 -----
壬 午 -----
辛 酉 -----
辛 亥 -----
辛 丑 -- --
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ichingpy-0.1.1.tar.gz.
File metadata
- Download URL: ichingpy-0.1.1.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97a99724a51abf194f7fd1137505a9f1c9c80e92a907c9e8bfb8cc53dc9fa736
|
|
| MD5 |
ce57385b8735964f0fb55708068b45a4
|
|
| BLAKE2b-256 |
de69ae44ea00242f72a6723b8a05a4f39dde425923ec0d5c30c5e65c1ef97484
|
Provenance
The following attestation bundles were made for ichingpy-0.1.1.tar.gz:
Publisher:
python-publish.yml on JinyangWang27/ichingpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ichingpy-0.1.1.tar.gz -
Subject digest:
97a99724a51abf194f7fd1137505a9f1c9c80e92a907c9e8bfb8cc53dc9fa736 - Sigstore transparency entry: 159303109
- Sigstore integration time:
-
Permalink:
JinyangWang27/ichingpy@1660c4e510c35f46c6540d09e5caefae0c2407e9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/JinyangWang27
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1660c4e510c35f46c6540d09e5caefae0c2407e9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ichingpy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ichingpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f00b46e181409153e04f2a5a3ab813626d05e22e4d1bc8fa2d37af15f9e2a2f
|
|
| MD5 |
a75ee9b3d44096377ba9710902d28684
|
|
| BLAKE2b-256 |
396896f581b8b76c8c2a55a634142268fe8f75a88c6adf955142baa715813022
|
Provenance
The following attestation bundles were made for ichingpy-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on JinyangWang27/ichingpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ichingpy-0.1.1-py3-none-any.whl -
Subject digest:
9f00b46e181409153e04f2a5a3ab813626d05e22e4d1bc8fa2d37af15f9e2a2f - Sigstore transparency entry: 159303110
- Sigstore integration time:
-
Permalink:
JinyangWang27/ichingpy@1660c4e510c35f46c6540d09e5caefae0c2407e9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/JinyangWang27
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1660c4e510c35f46c6540d09e5caefae0c2407e9 -
Trigger Event:
release
-
Statement type: