Skip to main content

mahjong

PyPI License Supported Python versions PyPI Downloads Linters and tests API Docs

Japanese riichi mahjong hand calculator library.

Compute hand cost (han, fu, yaku, and scores), validate winning hands, and calculate shanten (minimum tiles to tenpai).

The code was validated on tenhou.net phoenix replays in total on 26,148,038 hands.

So, we can say that our hand calculator works the same way that tenhou.net hand calculation.

Documentation

How to install

pip install mahjong

Local development setup

To set up the project locally for development:

  1. Clone the repository:

    git clone https://github.com/MahjongRepository/mahjong.git
    cd mahjong
    
  2. Setup env using uv:

    uv sync
    
  3. Run tests to verify setup:

    make tests
    # Or directly:
    uv run pytest
    
  4. Run full checks before committing:

    make check   # Runs format, lint, and tests
    

License

This library is licensed under the MIT license.

Metadata

Release files for mahjong 2.0.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 mahjong 2.0.0
File Size Uploaded
mahjong-2.0.0.tar.gz 52.8 kB Details

Built distribution (wheel)

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

Total release size: 138.9 kB

Release files / mahjong-2.0.0.tar.gz

Download URL mahjong-2.0.0.tar.gz
Size 52.8 kB
Tags Source
SHA-256 checksum
How to use checksums
08c424be257d6aebdf320e90fd8ee11628bf7a463860490ad007162bb62f22be
BLAKE2b-256 checksum
How to use checksums
9a4489c67394c97ee060b86f02868c819c2c63cf199fda40f6c47eee08d1818d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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 / mahjong-2.0.0-py3-none-any.whl

Download URL mahjong-2.0.0-py3-none-any.whl
Size 86.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52f63a8dfda5a9e81542642ed315f0e1e8626c0d324c8d8eabb3418ae7d43870
BLAKE2b-256 checksum
How to use checksums
3002687973dca9ab7372a8db48752fd3350a6b9c36b7807efdeb55e1ebf3779c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}
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