mahjong
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
- API reference
- Wiki — Supported rules and usage examples
How to install
pip install mahjong
Contributing
For guidance on setting up a development environment and contributing to mahjong, see Contributing to mahjong.
License
This library is licensed under the MIT license.
Metadata
Release files for mahjong 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mahjong-2.2.0.tar.gz | 54.5 kB | With provenance | Details for mahjong-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mahjong-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for mahjong-2.2.0-py3-none-any.whl |
Total release size: 142.6 kB
Release files / mahjong-2.2.0.tar.gz
| Download URL | mahjong-2.2.0.tar.gz |
|---|---|
| Size | 54.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d974358d962836402a4167a165a2052814e5ce078170a895e20ffea96cd6b58
|
|
BLAKE2b-256 checksum How to use checksums |
c09a15447deead1f0bc10c266df382ecd10996d4d22425bcd163aef3da4be6f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / mahjong-2.2.0-py3-none-any.whl
| Download URL | mahjong-2.2.0-py3-none-any.whl |
|---|---|
| Size | 88.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd878ded188dc63dda0cc8b115f84d9a80ff9bd99f9ba4f0925b95f725ec2bcf
|
|
BLAKE2b-256 checksum How to use checksums |
b2606cf9e1298042af8287c3b5e2db9ee5146344e02d49e32b6d7c4c0b7ce056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for mahjong 2.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mahjong-2.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA 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.