Skip to main content

ms_toollib

pypi MIT docs

A cross-platform minesweeper algorithm toolbox with a native Rust core.

Supports Python 3.7–3.13 on Windows, Linux, and macOS.


Installation

pip install ms_toollib

No additional dependencies required.


Features

Category Description
Mine Laying Random mine placement (first-click safe, Win7-style), no-guess mine generation (filter & adjustment methods)
Board Metrics 3BV, 3BV/s, openings (Op), islands (Isl), ZiNi (Greedy/Human/Random)
Probabilities Per-cell mine probability with block decomposition and enumeration
Deduction Solver 3-tier solver: direct subset, subtract-and-compare, full enumeration (≤55 cells)
Solvability Check Determine if a board is no-guess, find unsolvable structures
Game State Machine MinesweeperBoard / SafeMinesweeperBoard that accepts mouse clicks and tracks full game state
Replay Parsing Read AVF, EVF, MVF, RMV formats; save/write EVF (v0–v4) and EVFS containers
Optical Recognition Recognize board state from an RGBA image via ONNX neural network (Sobel, Hough, DP)

Quick Start

import ms_toollib as ms

# Generate a no-guess Beginner board
board = ms.laymine_solvable(9, 9, 10)
print(ms.cal_bbbv(board))          # 3BV
print(ms.cal_zini(board, 1))       # Greedy ZiNi

# Per-cell mine probability
prob = ms.cal_probability_onboard(board, 10)

# Parse a replay
video = ms.AvfVideo("replay.avf")
video.parse()
video.analyse()
print(video.bbbv)

See the full documentation for detailed API references.


Public API

Functions (30+): cal_all_solution, cal_bbbv, cal_board_numbers, cal_hzini, cal_op, cal_probability, cal_probability_onboard, cal_rzini, cal_zini, get_all_not_and_is_mine_on_board, is_able_to_solve, is_guess_while_needless, is_solvable, laymine, laymine_op, laymine_solvable, laymine_solvable_adjust, laymine_solvable_thread, mark_board, obr_board, refresh_board, refresh_matrix, refresh_matrixs, refresh_matrixses, sample_bbbvs_exp, solve_direct, solve_enumerate, solve_minus, unsolvable_structure, valid_time_period

Classes (15): AvfVideo, BaseVideo, Board, EvfVideo, Evfs, EvfsCell, GameBoard, KeyDynamicParams, MinesweeperBoard, MvfVideo, RmvVideo, SafeBoard, SafeBoardRow, SafeMinesweeperBoard, VideoActionStateRecorder


Supported Platforms

OS Architectures
Windows x86, x64
Linux x86, x86_64, aarch64, armv7, ppc64le, s390x
macOS x86_64, aarch64

Source & Issues

Generate Python Type Stubs

The source-based generator requires Python 3.10+ and two development-only packages:

pip install "tree-sitter>=0.25,<0.27" "tree-sitter-rust>=0.24,<0.25"
python python_package/generate_pyi.py --compare python_package/ms_toollib.pyi

Run from the repository root. By default this writes python_package/ms_toollib.generated.pyi, leaving the existing stub unchanged. Use --output python_package/ms_toollib.pyi to explicitly replace the package stub. Use --check to verify the output is current without writing it, and --diff with --compare for a full text diff in addition to the semantic API report.

The generator parses registered PyO3 functions and classes, renamed bindings, constructors, properties, signatures/defaults, documentation and nested Rust types. It expands the single-identifier generate_video! template used here. Unregistered event classes referenced by signatures are emitted as private support types. Getter-only properties remain read-only; setter-only properties use writable attribute annotations. Complex Rust default expressions use ....

This is a source parser, not a Rust compiler: general macro expansion, conditional compilation, externally defined types and arbitrary PyO3 extensions are not supported. Unknown Rust types and unsupported top-level macros cause an error. PyAny remains Any; types selected dynamically inside Rust function bodies cannot be recovered from signatures. API comparison normalizes typing.List and typing.Tuple aliases, but is not a complete type-equivalence checker.

Regression tests: python -m unittest discover -s python_package -p test_generate_pyi.py.

Metadata

Release files for ms_toollib 1.6.2

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

Source distribution (sdist)

Source distribution for ms_toollib 1.6.2
File Size Uploaded Provenance Actions
ms_toollib-1.6.2.tar.gz 370.8 kB Without provenance Details for ms_toollib-1.6.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ms_toollib 1.6.2
File Actions
ms_toollib-1.6.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for ms_toollib-1.6.2-cp38-abi3-win_amd64.whl
ms_toollib-1.6.2-cp38-abi3-win32.whl CPython 3.8 abi3 Windows x86-32 Details for ms_toollib-1.6.2-cp38-abi3-win32.whl
ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details for ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_x86_64.whl
ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_i686.whl CPython 3.8 abi3 Linux musl 1.2+ x86-32 Details for ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_i686.whl
ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details for ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_aarch64.whl
ms_toollib-1.6.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for ms_toollib-1.6.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
ms_toollib-1.6.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for ms_toollib-1.6.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
ms_toollib-1.6.2-cp38-abi3-manylinux2010_i686.manylinux_2_12_i686.whl CPython 3.8 abi3 Linux glibc 2.12+ x86-32 Details for ms_toollib-1.6.2-cp38-abi3-manylinux2010_i686.manylinux_2_12_i686.whl
ms_toollib-1.6.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for ms_toollib-1.6.2-cp38-abi3-macosx_11_0_arm64.whl
ms_toollib-1.6.2-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for ms_toollib-1.6.2-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 36.0 MB

Release files / ms_toollib-1.6.2.tar.gz

Download URL ms_toollib-1.6.2.tar.gz
Size 370.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ea307ebc0746383d930f2408aaf165f204e3070073da5f61cb6fba095a559aa2
BLAKE2b-256 checksum
How to use checksums
575566f05f33b240a8094a8cd73aa99ec05bbece9d93618b3e1b953c3d56e8f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-win_amd64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-win_amd64.whl
Size 3.7 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
be3d6135d04a6b2a480ffe96aaaa7f1bcd726cfd6b7f5f79ba7e00aa0f548b72
BLAKE2b-256 checksum
How to use checksums
b42a39ea74ea63430f2aa2bde023260f56939f9b7e288338e58f9086d005861a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-win32.whl

Download URL ms_toollib-1.6.2-cp38-abi3-win32.whl
Size 3.0 MB
Tags CPython 3.8 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
e68f3794a9e9094cb9db2cda23f618dcd38f960b0caf0451ceae5614bc7bf48c
BLAKE2b-256 checksum
How to use checksums
3049b4a3c1b66bf33c1b581348990a3950f76ba26bd311d7913408cdf479bd04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_x86_64.whl
Size 4.0 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
0eb7d71e18eb6d285acdc2ad69ee727ba3273008f1899d05a9219c4ac0b0a861
BLAKE2b-256 checksum
How to use checksums
b42fa3ae78806ec3c53be3d9c3f4efa22db2e25b7c09e0c941400ded82ce7efe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_i686.whl

Download URL ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_i686.whl
Size 3.5 MB
Tags CPython 3.8 Linux musl 1.2+ x86-32 abi3
SHA-256 checksum
How to use checksums
fe97076f00bee7b90cde4918342ce7ff23efecafc012f6fddb0fd12c1c4676a9
BLAKE2b-256 checksum
How to use checksums
bb823432d1a9665513cd790452486464167160dd868ef9ade5ef5bd383de0677
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-musllinux_1_2_aarch64.whl
Size 3.9 MB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
8b8e013cf461c9f6b18a719661a0dac420bfec7f87f97a8398b540cd110b20ac
BLAKE2b-256 checksum
How to use checksums
5e6c0212d5b2ef19cc5ce2ca67de976d252265ed68389762e74bda8183a0a5a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
0e5980f2d7d43df4be11077ac057023d4c008905fcbad36c70b8ed18a383c923
BLAKE2b-256 checksum
How to use checksums
693e3c7d99a6bbf0d68f6c17e3801e9ce4a86d3bbea765180b577547b91bae95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.8 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
477d93bfec7fcef8be5a475ae509b22386bc331cb72fc0057e400f6b4240c4a7
BLAKE2b-256 checksum
How to use checksums
88e8303758f739468cdb41baf2f7f6f27ac4caa8c8fc89c7e5ca457d66999370
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-manylinux2010_i686.manylinux_2_12_i686.whl

Download URL ms_toollib-1.6.2-cp38-abi3-manylinux2010_i686.manylinux_2_12_i686.whl
Size 3.4 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-32 abi3
SHA-256 checksum
How to use checksums
657ff6adb05d72901149c430aca72dcc8a4edb23da975b74df116333256ec202
BLAKE2b-256 checksum
How to use checksums
b6b2418b222ccb19621070d88853ecb3a7f3c5f098d540c8a43d992ee1764482
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-macosx_11_0_arm64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
49f5089e62f5dd195833668bad3a8f337d9cb7b45075a857d63407ed5d4765ca
BLAKE2b-256 checksum
How to use checksums
5de242b7c30d8818b0bf89b339844548068e85f17ab9d330eae4e11cc88605f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ms_toollib-1.6.2-cp38-abi3-macosx_10_12_x86_64.whl

Download URL ms_toollib-1.6.2-cp38-abi3-macosx_10_12_x86_64.whl
Size 3.3 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ed4f10bbb7b5304fdb68841eb8e60ab2e1a2a7a773ddda1090f282a2c72fb1ee
BLAKE2b-256 checksum
How to use checksums
97a55ccdb86e27587b4ac1747827153e75b18a3b342b49ddf81898c3aa7e881a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ms_toollib 1.6.2

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

1.6.2 This release

11 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