pyminizinc
MiniZinc 2.11 for Python, with the compiler linked in-process via nanobind. The API is minizinc-python's: existing code runs unchanged after switching the import, and no minizinc installation is needed. The wheel ships the standard library and the Gecode 6.6 and Chuffed 0.14 solvers.
import pyminizinc as minizinc
model = minizinc.Model()
model.add_string("set of int: S; var S: x; var S: y; constraint x < y; solve maximize x + y;")
model["S"] = {1, 5, 9}
result = minizinc.Instance(minizinc.Solver.lookup("gecode"), model).solve()
result.status # Status.OPTIMAL_SOLUTION
result["x"], result["y"] # (5, 9)
result.objective # 14
The package is imported as pyminizinc, so it can be installed next to minizinc-python (import minizinc). Importing it as minizinc keeps existing code unchanged.
Wheels are built for Linux (x86_64, aarch64), macOS (arm64, x86_64) and Windows (x86_64).
See the minizinc-python documentation for Model, Instance, Solver, solve_async, solutions, analyse, flat and the rest.
Compatibility
minizinc-python's own test suite runs against this package (tests/compat). Only the test that needs COIN-BC is skipped. default_driver is an InProcessDriver. Driver.find() and Driver(path) still drive an external minizinc executable.
Behaviour that differs from minizinc-python with a subprocess:
-
Runs are serialised: one solve at a time per Python process. Concurrent solves from
asyncio.gatheror threads give correct results, one after another. -
A crash inside libminizinc ends the interpreter. Solvers still run as child processes.
-
On Windows,
terminate()(e.g. breaking out ofsolutions()) stops compilation but not a running solver. -
default_driver.executableis the path of the extension module.
Additions: minizinc.run(args, model) gives the minizinc command line in-process and returns (code, stdout, stderr). MZN_VERSION and STDLIB_DIR describe the bundled MiniZinc.
The dzn extra (pip install pyminizinc[dzn]) adds DZN parsing, as in minizinc-python.
Solvers
Gecode is bundled as a static fzn-gecode executable and is the default solver. MiniZinc runs it as a child process, so Ctrl-C, terminate() and time limits stop it. Gecode is also linked into the compiler, for solution checkers (.mzc.mzn) and the -O3+ presolver. It is built without MPFR, so float trigonometric, exp and logarithm constraints raise MiniZincError. Linear and polynomial float constraints, sqrt, and integer pow work. See docs/dev/mpfr-gecode.md.
Chuffed is bundled the same way, as a static fzn-chuffed. It is a lazy clause generation solver and has no float variables. It is not linked into the compiler: it keeps process-global state and exits the process on some failures, so it runs only as a child process.
Other solvers are found the same way the minizinc executable finds them:
-
FlatZinc executables (OR-Tools, ...) via
.mscfiles on the solver search path. That path includesMZN_SOLVER_PATHand the usual system locations, e.g. Homebrew'sshare/minizinc/solvers. A same-version Gecode or Chuffed in a system location is ignored, because the bundled config is found first. One inMZN_SOLVER_PATHor~/.minizinc/solversis found before it and wins. SettingMZN_STDLIB_DIRto another install also drops the bundled solver. -
MIP libraries (HiGHS, CPLEX, Gurobi, SCIP, Xpress) are loaded with
dlopenat first use. If the library is not on the loader path, pass it assolve(**{"--highs-dll": path}). These run inside the process and cannot be interrupted.
Development
make build # compile the extension (first build fetches tree-sitter and Gecode)
make test
make qa # lint, format check, mypy, tests
Design notes are in docs/dev/:
-
minizinc-python.md: upstream provenance, the in-process driver, syncing. -
libminizinc-patches.md: local libminizinc changes.
License
-
MIT for this package's own code.
-
MPL-2.0 for the minizinc-python modules (
thirdparty/minizinc-python/LICENSE). -
MPL-2.0 for libminizinc and its standard library, which the wheel links and bundles (
thirdparty/libminizinc/LICENSE.txt). -
MIT for the bundled Gecode (
thirdparty/gecode/LICENSE) and Chuffed (thirdparty/chuffed/LICENSE).
Metadata
Release files for pyminizinc 0.1.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 |
|---|---|---|---|---|
| pyminizinc-0.1.0.tar.gz | 1.5 MB | Without provenance | Details for pyminizinc-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pyminizinc-0.1.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for pyminizinc-0.1.0-cp312-abi3-win_amd64.whl |
| pyminizinc-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details for pyminizinc-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
| pyminizinc-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 | Details for pyminizinc-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
| pyminizinc-0.1.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for pyminizinc-0.1.0-cp312-abi3-macosx_11_0_arm64.whl |
| pyminizinc-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl | CPython 3.12 | abi3 | macOS 10.15+ x86-64 | Details for pyminizinc-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl |
Total release size: 62.9 MB
Release files / pyminizinc-0.1.0.tar.gz
| Download URL | pyminizinc-0.1.0.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
687cc7268b859a7eefe5bbc212c037e0175596cee1c22f52cb54c7dc1967b696
|
|
BLAKE2b-256 checksum How to use checksums |
ddaea7fc915a0c7614246b22fc16c662577ab0c7d61257627940e96ea5b41632
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyminizinc-0.1.0-cp312-abi3-win_amd64.whl
| Download URL | pyminizinc-0.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 10.1 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8ba85ed4b365c7c3d5bec3eca798052cc4007663672664f460581fd03583ee41
|
|
BLAKE2b-256 checksum How to use checksums |
e7e4f35734157459d7836de916efdcd236e320c9aa13912367bfd6b8b5bb29e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyminizinc-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyminizinc-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 14.8 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
42d3b8a66bc8f4370bde13420f7fb5b8000a9a2236c56ae25898fb3e06979cd6
|
|
BLAKE2b-256 checksum How to use checksums |
d84ef51a936f584c012e773d64f2d1144a4e6fd6addf63eeb04c95a1680d0a45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyminizinc-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pyminizinc-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 13.7 MB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
cb8dad188947ef0813a4ba339c83627d97a8e292b784559287d81d44e172aead
|
|
BLAKE2b-256 checksum How to use checksums |
d794ebaaad1bea14e80da3e68fe94b409d7c411dbf9a530fe96ed5b1477a4543
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyminizinc-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | pyminizinc-0.1.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 10.7 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
74ab41baaac82b301d69baa0ad6c4f804fd8a43487b50800efaa9d4a3e5613f2
|
|
BLAKE2b-256 checksum How to use checksums |
0b8001eab60eb93a80f88def6696ad0cc9198c11f96e4d73ef08264e21b8ff95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyminizinc-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl
| Download URL | pyminizinc-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl |
|---|---|
| Size | 12.2 MB |
| Tags | CPython 3.12 abi3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
34df8e86784031d75c12c08a17226c6d3de81706c46b2c96f70c6ae9c4d775b1
|
|
BLAKE2b-256 checksum How to use checksums |
0fe1a9f1994a0bc55de5508c57ce7444494f23d0d8e1450853c4e980e6e96487
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for pyminizinc 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.
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.