PuzzleKit
Solve logic puzzles from a puzz.link URL, and open the answer in pzpr-trace.
PuzzleKit is a thin Python layer over the Rust cspuz_core constraint solver. Give it a puzzle link and it returns the solution status, the solver's board, the answer in pzpr FileIO format, and a pzpr-trace link that restores the puzzle with the answer filled in.
- Link in, answer out. Works with the puzzle links you already have, in the pzpr format used by puzz.link and pzpr-trace.
- Native pzpr output. The exported answer is the same text pzpr saves, so any pzpr-based tool can load it.
- Tells you about uniqueness. Results are
unique,multiple,no_solutionorunknown; for multiple solutions you get the marks that hold in all of them. - Install and go. Prebuilt wheels for Linux, macOS and Windows. No Rust toolchain and no other Python dependencies.
Installation
pip install puzzlekit
# or
uv add puzzlekit # in a uv project
uv pip install puzzlekit # in any virtual environment
Requires Python 3.10 or newer. Wheels are published for Linux (x86-64 and ARM64, glibc), macOS (Apple silicon and Intel) and Windows (x86-64). One wheel per platform serves every supported Python version. On other platforms pip builds from source, which needs Rust, a C/C++ compiler, Git and network access for the pinned dependencies.
Quick start
import puzzlekit
result = puzzlekit.solve("https://puzz.link/p?slither/3/2/h17d")
print(result.status) # unique
print(result.to_pzpr()) # puzzle and answer in pzpr FileIO format
print(result.to_trace_url()) # open the answer in pzpr-trace
pzprv3.1
slither
2
3
. . 1
2 . 3
0 0 0
0 0 0
1 1 -1 -1
1 -1 -1 1
1 -1 -1
-1 1 1
1 1 1
https://pzpr-trace.net/p?state=K6gqKCoz1jPkKs7JLMlILeIy4jLm0lPQUzBU4DICUsYKXAYKIAijDIEyumDEBWMgMbnAXEOIMiAFAA&slither/3/2/h12g3
The trace link opens the puzzle in pzpr-trace with the solution already drawn.
Input
solve() takes a single string. All of these are equivalent:
puzzlekit.solve("https://puzz.link/p?slither/3/2/h17d") # puzz.link URL
puzzlekit.solve("?slither/3/2/h17d") # query only
puzzlekit.solve("slither/3/2/h17d") # bare path
puzzlekit.solve("https://pzpr-trace.net/p?slither/3/2/h17d") # trace link
The host is ignored; only the puzzle path (type/columns/rows/data) matters.
A state= parameter in a trace link is skipped. The path starts with the
puzzle's URL token, such as slither, nurikabe or yajilin. The tokens
and aliases for each puzzle are in the adapter guide.
Dataset text, a puzzle type argument and legacy solver options (as in
PuzzleKit 0.3) are not accepted; solve() raises ValueError for them.
Output
solve() returns a PuzzleResult:
| Member | Description |
|---|---|
status |
unique, multiple, no_solution or unknown (see below). |
has_solution |
True, False, or None when undetermined. |
unique |
True for one solution, False for several, None if unknown. |
is_solved |
True when the status is unique. |
board |
The cspuz board as a Python dict (cspuz's rendering format). |
board_json |
The same board as a JSON string. |
normalized_url |
The puzzle link after PuzzleKit's normalization. |
to_pzpr() |
Puzzle and answer in pzpr FileIO text. |
to_state() |
The compressed state used by pzpr-trace. |
to_trace_url() |
A pzpr-trace link that restores puzzle and answer. |
| Status | Meaning |
|---|---|
unique |
Exactly one solution. |
multiple |
Several solutions. Exports contain only the marks shared by all of them; the rest stay empty. |
no_solution |
The puzzle has no solution. |
unknown |
The solver could not determine uniqueness. |
to_pzpr(), to_state() and to_trace_url() work for unique and
multiple results of the supported puzzles below. For no_solution and
unknown they raise ValueError, as they do for puzzles without a verified
adapter. Unreadable or unsupported input raises ValueError; an internal
solver failure raises RuntimeError.
board is available for every puzzle the pinned backend can solve, even when
there is no pzpr export. puzzlekit.supported_puzzles() lists the backend's
coverage; this is wider than the verified list below.
Supported puzzles
PuzzleKit currently supports 137 of the 346 puzzle types registered in pzpr. puzzlekit-dataset holds 39,405 problems (33,692 with answers) for 77 of them.
The puzzle table lists every pzpr puzzle with its support status, dataset size and largest board. The names are pzpr IDs, so they can be pasted straight into pzpr-trace. The adapter guide gives each puzzle's URL tokens, answer marks and known limits.
"Supported" means a verified adapter: URL solving, native pzpr FileIO and pzpr-trace state, checked against real puzzles and the custom pzprjs used by pzpr-trace.
Upgrading from 0.3
0.4 is a rewrite. The OR-Tools solvers and the dataset-text interface were
removed in favor of the cspuz backend and puzzle URLs. solve() now takes a
URL and returns a PuzzleResult. Pin puzzlekit<0.4 if you depend on the
old API.
Related projects
- puzz.link and pzprjs — the puzzle player and the pzpr format PuzzleKit reads and writes.
- pzpr-trace — view and replay puzzle states; the target of
to_trace_url(). - cspuz_core — the Rust constraint solver and puzzle models PuzzleKit builds on, and cspuz-solver2, a web solver built on it.
- Penpa+ — a general puzzle editor and solver-checker.
- puzzlekit-dataset — about 40,000 puzzle instances used to test PuzzleKit.
- puzzlekit-web — a step-by-step, explainable solver in the browser.
Development
git clone https://github.com/SmilingWayne/puzzlekit
cd puzzlekit
python -m pip install -e '.[dev]'
python -m pytest -q
Building needs Rust, a C/C++ compiler and Git. The contributor guide covers adding a puzzle, and cspuz integration describes the backend bridge. Releasing lists the release checklist.
License
PuzzleKit is released under the MIT license. The bundled cspuz components have their own terms in LICENSE-cspuz.
Metadata
Release files for puzzlekit 0.4.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 |
|---|---|---|---|---|
| puzzlekit-0.4.0.tar.gz | 114.4 kB | Without provenance | Details for puzzlekit-0.4.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| puzzlekit-0.4.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for puzzlekit-0.4.0-cp310-abi3-win_amd64.whl |
| puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details for puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl |
| puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl |
| puzzlekit-0.4.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for puzzlekit-0.4.0-cp310-abi3-macosx_11_0_arm64.whl |
| puzzlekit-0.4.0-cp310-abi3-macosx_10_15_x86_64.whl | CPython 3.10 | abi3 | macOS 10.15+ x86-64 | Details for puzzlekit-0.4.0-cp310-abi3-macosx_10_15_x86_64.whl |
Total release size: 11.4 MB
Release files / puzzlekit-0.4.0.tar.gz
| Download URL | puzzlekit-0.4.0.tar.gz |
|---|---|
| Size | 114.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dde62520d9c3ed36f8c98861abbdf463810dca080d6f40be4fc2339f0621647a
|
|
BLAKE2b-256 checksum How to use checksums |
68a77c842d2622e13bf1e9950bfa5700913b44dc81860570a32000066067a6dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / puzzlekit-0.4.0-cp310-abi3-win_amd64.whl
| Download URL | puzzlekit-0.4.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f3307e0475090cd60c63d4af97cad088603d464bb50258a59b5fa3c2c978f35f
|
|
BLAKE2b-256 checksum How to use checksums |
604d199f5398f207f21896d2ceae1cd5610b822bd9d9663b1a0f62e16eaa544d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2c161964ff137b00694bfdb4b80d3eacb40b69370846588f8c59e337d0eb231a
|
|
BLAKE2b-256 checksum How to use checksums |
814d9eeef8c1575f99327a9afaabb9bace14eb08525f93a84d57c786a5c2c4be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | puzzlekit-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
812803ea6c012ea22a9f29ec2564c8ea8d865017d061e07d430c31580555f15b
|
|
BLAKE2b-256 checksum How to use checksums |
b518e6caa63cd2a4454db526f341bc79b08685fb3d3ab928ade1eea184e625ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / puzzlekit-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | puzzlekit-0.4.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1eea8c56460b30e66e848e03264156b342c7b156f7ec91fbcde137dcb833e8f4
|
|
BLAKE2b-256 checksum How to use checksums |
0e8e16786830966c370b5f87251b8534201fbc0343345e9d4b5b6c060b371fe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / puzzlekit-0.4.0-cp310-abi3-macosx_10_15_x86_64.whl
| Download URL | puzzlekit-0.4.0-cp310-abi3-macosx_10_15_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 abi3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
7dbfa6207bb5d506724717f9f838e65a29f6f652dac1acf2ad49dcbdbc021148
|
|
BLAKE2b-256 checksum How to use checksums |
5a006be86fe0ad309f674aeb4f6586084fa49ffe4dd750a94de0c1bfb1ab76cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for puzzlekit 0.4.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.