Skip to main content

qiantong · Guanyin fortune sticks in your terminal

Draw a Guanyin fortune stick (观音灵签) in the terminal: first ask for permission by tossing jiaobei blocks (掷筊), and once you get three holy tosses (圣杯) in a row, shake the lot tube and read your fortune poem and its interpretation.

The interface and the fortune texts are in Chinese.

Installation

Requires Python 3.9+. No third-party dependencies.

# Recommended: install as a standalone command
uv tool install qiantong
# or
pipx install qiantong
# or
pip install qiantong

# Latest code from GitHub
uv tool install git+https://github.com/mediapig/qiantong.git

After installing, run qiantong or chouqian.

How to play

Key Action
Space Start / stop (press once to start, again to stop)
q / Esc / Ctrl-C Quit
  1. Ask with jiaobei (掷筊请示). For each toss, press space to throw the two crescent-shaped blocks and press space again to land them. Each block lands yin or yang:

    • one yin, one yang: holy toss (圣杯) ✓
    • two yang: laughing toss (笑杯) ✗
    • two yin: yin toss (阴杯) ✗

    You need three holy tosses in a row before you may draw a lot. Any other result starts over from the first toss.

  2. Shake the tube (摇签). Press space to start shaking and space again to stop. A stick pops out. Its number stays hidden until the result is shown.

  3. Read the lot (解签). Shows the lot number, its rank, the story behind it, the poem and the interpretation.

In Japan: Sensō-ji fortunes

If either of the following is detected, the lots switch to the 100 Kannon fortunes of Sensō-ji in Asakusa, Tokyo (ranks 大吉 / 吉 / 半吉 / 小吉 / 末小吉 / 末吉 / 凶), and the jiaobei step is skipped:

  • the preferred system language is Japanese (macOS reads the system preferences, Windows reads the UI language, other systems read LANG and related variables);
  • the time zone is Japan (Asia/Tokyo, Japan, JST).

You can also choose explicitly:

qiantong --temple sensoji   # Sensō-ji
qiantong --temple guanyin   # Guanyin
TZ=Asia/Tokyo qiantong      # pretend to be in Japan

A command-line tool has no access to GPS, so location is not used.

Randomness

Every result is decided at the moment you press space to stop. The animation is only for show and has no effect on the outcome.

Quantum random numbers by default. At startup the program fetches 1024 bytes from the quantum random number service of the OTH Regensburg Laboratory for Digitalisation into a pool, and fetches more when the pool runs out. The bytes are produced by ID Quantique's Quantis quantum random number hardware (a PCIe card), whose randomness comes from quantum physical processes.

Local fallback. If the service is unreachable, times out (3 seconds) or misbehaves, the program falls back to Python's standard secrets module, i.e. the operating system's cryptographic random number generator. After one failure it stays offline for the rest of the run so that draws never stall. The startup line tells you which source is in use.

Each draw takes 32 random bytes, appends the nanosecond timestamp of your key press, hashes them with SHA-256, and maps the result onto the target range by rejection sampling. Every lot therefore has a probability of exactly 1/100, and each block is yin or yang with probability exactly 1/2.

Data sources

Guanyin lot texts vary slightly between regions. For entertainment and cultural interest only.

License

The code is released under the MIT License: anyone may use, modify and distribute it freely.

The fortune data in src/qiantong/data/ comes from the third-party repositories listed above. It is not covered by the MIT License, and its copyright remains with the original authors.

Metadata

Release files for qiantong 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qiantong 0.1.0
File Size Uploaded Provenance
qiantong-0.1.0.tar.gz 58.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for qiantong 0.1.0
File Interpreter ABI Platform
qiantong-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 113.6 kB

Release files / qiantong-0.1.0.tar.gz

Download URL qiantong-0.1.0.tar.gz
Size 58.2 kB
Tags Source
SHA-256 checksum
How to use checksums
621552d5c28e412a7af9e2d420370c997699b92f18d81cb024fa65099b0a77ce
BLAKE2b-256 checksum
How to use checksums
9ff15dd0d6d0412ed448f536ff365e069b99fbff56316afa19f8d25ad0b3332a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / qiantong-0.1.0-py3-none-any.whl

Download URL qiantong-0.1.0-py3-none-any.whl
Size 55.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d9eca417da387a5c88aa6c363f7183ea5cc4fa91170fd4bea5be96e923014cd
BLAKE2b-256 checksum
How to use checksums
061b7533bca36b74aed92a57609e971e725397ab4d27630bb1706445079b640c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for qiantong 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page