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
icp.set_language("en")
```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
>>> jia_zi+1
Yi Chou
>>> jia_zi+60
Jia Zi

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
Ren  (9) Xu   (11) EARTH -----
Ren  (9) Shen (9 ) METAL -----
Ren  (9) Wu   (7 ) FIRE  -----
Xin  (8) You  (10) METAL -----
Xin  (8) Hai  (12) WATER -----
Xin  (8) Chou (2 ) EARTH -- --

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.4.tar.gz (13.5 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.4-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ichingpy-0.1.4.tar.gz
  • Upload date:
  • Size: 13.5 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.4.tar.gz
Algorithm Hash digest
SHA256 ba50473defe338f80f69e22548a5836d05ffd763672bdfec9bd2d227d787d543
MD5 0cf6a7bea7bbacbb3be8c56c64f4e455
BLAKE2b-256 ea50cd1b2a62676a3d2bb27e80f15404f443691a8d14ca2ccb22141de9d7edd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ichingpy-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: ichingpy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7713d73d40e88ae1e88fe5c0ba35f98b3210849a0a3bf1febd83222e391e33bc
MD5 194364c4621c444366468ce8e9427b4a
BLAKE2b-256 6780af15e497c6fe1f077368fb0fcdce8647e6cef31cff9976821c39d73fe05c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ichingpy-0.1.4-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