Skip to main content

pencil-puzzles for Python

Generate, solve, rate and check sudoku, nurikabe and kakurasu puzzles. Generated puzzles have exactly one solution and a difficulty from easy to expert, set by the hardest solving technique they need.

import pencil_puzzles as pp

g = pp.generate("sudoku", (9, 9), difficulty="medium", seed=42)
print(g.puzzle.givens)
print(g.rating.level, g.rating.techniques)

assert pp.solve(g.puzzle) == g.solution
assert pp.rate(g.puzzle) == g.rating
assert pp.check(g.puzzle, g.solution) == []
print(pp.hint(g.puzzle))          # the first step a solver would take

same = pp.Puzzle.from_id(g.puzzle.id)

The same arguments and package version always give the same puzzle. To save or share a puzzle, use its ID. Every operation takes limits=pp.Limits(work=..., attempts=...) and cancel=pp.CancellationToken(); running out of a limit raises an error. Cancellation can come from another thread, and Ctrl-C raises KeyboardInterrupt.

All public names are listed in docs/design/python-api.md.

Building

pip install maturin
maturin build --release
pip install target/wheels/pencil_puzzles-*.whl
python -m unittest discover -s python/tests

CPython 3.10+ on Windows, macOS and Linux.

Metadata

Release files for pencil-puzzles 0.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 pencil-puzzles 0.1.0
File Size Uploaded Provenance Actions
pencil_puzzles-0.1.0.tar.gz 140.1 kB With provenance Details for pencil_puzzles-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pencil-puzzles 0.1.0
File Interpreter ABI Platform Actions
pencil_puzzles-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pencil_puzzles-0.1.0-cp310-abi3-win_amd64.whl
pencil_puzzles-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for pencil_puzzles-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pencil_puzzles-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pencil_puzzles-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 2.4 MB

Release files / pencil_puzzles-0.1.0.tar.gz

Download URL pencil_puzzles-0.1.0.tar.gz
Size 140.1 kB
Tags Source
SHA-256 checksum
How to use checksums
867bbc4c95d04410149ea6cf2450a6296fbd0fa684382a2d3d4087f8891dd7c8
BLAKE2b-256 checksum
How to use checksums
380cc487922b232f8c98976101b65be21dde92aa8ab76b363b6dda1484a523f6
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 5, 2026.

Transparency log

Release files / pencil_puzzles-0.1.0-cp310-abi3-win_amd64.whl

Download URL pencil_puzzles-0.1.0-cp310-abi3-win_amd64.whl
Size 697.4 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b6e321826860e5375afa08eac91c86bcf82937df1b33f808d932e870259e61d3
BLAKE2b-256 checksum
How to use checksums
3e53b1c03046fe7d7a49bd4a8e0ae8b7926ffef35242468a8add2b041bb3cfa3
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 5, 2026.

Transparency log

Release files / pencil_puzzles-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pencil_puzzles-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 821.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
0cd21e23b08f27b849fb72d92c683910d6a363c85ac44cd085a86215553f1506
BLAKE2b-256 checksum
How to use checksums
c0548d35b670a2d245236398c16d19aa0bdb75da08394769808dfe27a5c3a5f6
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 5, 2026.

Transparency log

Release files / pencil_puzzles-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL pencil_puzzles-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 737.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6b465bb3d5885e8af9870beeb6b27d47f4d538f6793de17954caa09bb7cba56e
BLAKE2b-256 checksum
How to use checksums
47d4a7912cbfd9b8e52438e30dbb2d832667182d00b6b25099b55001f5921bfb
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 5, 2026.

Transparency log

Security for pencil-puzzles 0.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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for pencil_puzzles-0.1.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 5, 2026.

Transparency log

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.

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