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: 26,148,050 four-player and 8,406,421 three-player winning 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.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 mahjong 2.1.0
File Size Uploaded Provenance
mahjong-2.1.0.tar.gz 54.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 141.4 kB

Release files / mahjong-2.1.0.tar.gz

Download URL mahjong-2.1.0.tar.gz
Size 54.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a61fa4f0b3680fb6838c67f13d083177d50e55a1326aa3c3ec248811837c78bf
BLAKE2b-256 checksum
How to use checksums
2ba18cd6025d7c88a238e4bf3ff031af8e50ce965dadc04a60a579d3a7793984
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.1.0-py3-none-any.whl

Download URL mahjong-2.1.0-py3-none-any.whl
Size 87.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c9ad88fe0e8df74d43f466a05517209104a52494d9cf0fbc544442a10c0e91c
BLAKE2b-256 checksum
How to use checksums
5f96f4c41448135d469e77885307456c2e7fc99b5c5b4195fac0162eec7d6997
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}

Security for mahjong 2.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.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files No provenance

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