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.1

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.1
File Size Uploaded Provenance Actions
ms_toollib-1.6.1.tar.gz 360.4 kB Without provenance Details for ms_toollib-1.6.1.tar.gz

Built distributions (wheels)

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

Total release size: 29.8 MB

Release files / ms_toollib-1.6.1.tar.gz

Download URL ms_toollib-1.6.1.tar.gz
Size 360.4 kB
Tags Source
SHA-256 checksum
How to use checksums
67a7d4c582a223c0a1a744f82516425d011f87ab12892de22ae130e78a2e7162
BLAKE2b-256 checksum
How to use checksums
24ba24d43ab08b75fd0b904f91a663e125568febb78152153b0f8cadf80bd90e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-win_amd64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-win_amd64.whl
Size 2.8 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9ae6764a8f7522a30367b2f465f09ba8d10a6115f16ab9db4a9a1688baa74b0a
BLAKE2b-256 checksum
How to use checksums
951abcd01c38de59d55029d67752b5b4e54a7e081dbd734be052aabc179c1078
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-win32.whl

Download URL ms_toollib-1.6.1-cp38-abi3-win32.whl
Size 2.3 MB
Tags CPython 3.8 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
37b29520bcd98547c728333d51bcd76615eb486bd1021a2f2720cc7ae8d01aff
BLAKE2b-256 checksum
How to use checksums
6661a272bcc3748bc2df90caab4e580c75c2005dc219f744be5ad9758bba26d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-musllinux_1_2_x86_64.whl
Size 3.4 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
752ad9736f1a167019efbf5d7d53d4ac6a8ffdef65b104051b9a5cf24edfe093
BLAKE2b-256 checksum
How to use checksums
0832897134fa832dee9b325c3431eb28e543f8ab847d8d815ddf949bf1133fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-musllinux_1_2_i686.whl

Download URL ms_toollib-1.6.1-cp38-abi3-musllinux_1_2_i686.whl
Size 3.0 MB
Tags CPython 3.8 Linux musl 1.2+ x86-32 abi3
SHA-256 checksum
How to use checksums
9b00cee6c0ed77a7743adf13ead9b4996fc0f9723b43664b668e3f66b57aaf66
BLAKE2b-256 checksum
How to use checksums
117d4873725628c707d1a6fe602b65e3d85c8ab2e51c260c3e37ae07e033d36a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-musllinux_1_2_aarch64.whl
Size 3.4 MB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
8bea365ff5d4854e163dede7bb3e70e58d99541e2766255a3ecac88da65d4b4c
BLAKE2b-256 checksum
How to use checksums
08cf44065dfdd8e74aa23894a826c8c2bc1fdfece7d1bddc2e05480ae55f6f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
37c35804b3cd199ee2099a04e8d64f0c88cf1878a3977a22220bf8473dd89d8d
BLAKE2b-256 checksum
How to use checksums
2b5e4a0000fc8be0ae61b99b73d3892d02e8eac79470bbf27c778195d6853fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.2 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
6033180743d078d2a89d9639c456297df913c617a0750251787d3cf88d8f6e0a
BLAKE2b-256 checksum
How to use checksums
ef07899deb30b9583acc9ed78dd2601e7896a85bc2cef08a7809fe9cac5c7ddb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-manylinux2010_i686.manylinux_2_12_i686.whl

Download URL ms_toollib-1.6.1-cp38-abi3-manylinux2010_i686.manylinux_2_12_i686.whl
Size 2.9 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-32 abi3
SHA-256 checksum
How to use checksums
b780715545a786e00d7d7292449584464f3d93450cc4a272c5ca0fca660d8741
BLAKE2b-256 checksum
How to use checksums
4df140bd2930274206dc38d8365274e937ce41f94fd32a36545df0a1ded4b594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-macosx_11_0_arm64.whl
Size 2.6 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4c66ace28115e753c0f903536cf651ecf55b4664a0304d9ff64235b8d3f64298
BLAKE2b-256 checksum
How to use checksums
33ff9027c73080ef961a746f38f2e8a51b8e06ab8a4d5571864cf291213ba2d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL ms_toollib-1.6.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.7 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b93f5dc30b7904100aa29acc738be15a4b261e9e6ba3abecf5e7e86dbb22a6f4
BLAKE2b-256 checksum
How to use checksums
afeae939df55a736e51aaba927b0cb6669d4f9b8155079b66e23c5ff3dbd3ad2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.1

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.1 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