Skip to main content

No project description provided

Project description

I-Ching Python

汉语文档由此

pypi license

Description

I-Ching objects construction using Python type hints.

Pattern-based implementation without hard-coded mappings. Define how philosophical concepts in pure Python.

Features

  1. generating hexagrams using multiple methods,
  2. interpreting their meanings (TODO)
  3. performing divination based on the I-Ching (TODO)
  4. arithmetic operations on Heavenly Stems and Earthly Branches (干支)

A few implementations are in Chinese, as the author is not satisfied with their current translation. In the future, both Chinese and English will be supported.

Installation

pip install ichingpy

A Simple Example

import ichingpy as icp
```python 
hexagram = icp.Hexagram.from_yarrow_stalks()
-- --
-- --
-- --
----- 
-- -- X -> -----
----- O -> -- --

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


Download files

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

Source Distribution

ichingpy-0.1.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

ichingpy-0.1.2-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file ichingpy-0.1.2.tar.gz.

File metadata

  • Download URL: ichingpy-0.1.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for ichingpy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 54f81de0fb33d9bc709b41c430ea08248be0fb8d68cc7aee7b2371cd6221fb0f
MD5 bec9d1f5dc486459bc064a58a24a6940
BLAKE2b-256 9a926869250f42b37f891523fee525e7b5853817ff114ff9890f60bf95b6dd7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ichingpy-0.1.2.tar.gz:

Publisher: python-publish.yml on JinyangWang27/ichingpy

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

File details

Details for the file ichingpy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ichingpy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for ichingpy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ae0f93ac173fe884552a425386a749a22a1efce138fa21419e88cf8ad8dc9d9
MD5 9ef19f8b939ee982a52393fa063e061c
BLAKE2b-256 958693d69af0031436ac95df78fb31f5e9f516ccd67d8148ba0f839f1a929590

See more details on using hashes here.

Provenance

The following attestation bundles were made for ichingpy-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on JinyangWang27/ichingpy

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