{"id":13935619,"url":"https://github.com/MiniZinc/minizinc-python","last_synced_at":"2025-07-19T20:33:24.519Z","repository":{"id":37886171,"uuid":"281842347","full_name":"MiniZinc/minizinc-python","owner":"MiniZinc","description":"Access to all MiniZinc functionality directly from Python","archived":false,"fork":false,"pushed_at":"2024-04-08T02:03:27.000Z","size":1507,"stargazers_count":131,"open_issues_count":8,"forks_count":19,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2024-04-08T03:23:17.594Z","etag":null,"topics":["constraint-programming","integer-programming","linear-programming","minizinc","optimisation-problem","python","sat-solver"],"latest_commit_sha":null,"homepage":"https://minizinc-python.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MiniZinc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-07-23T03:37:52.000Z","updated_at":"2024-04-15T05:15:21.821Z","dependencies_parsed_at":"2023-10-05T06:57:44.777Z","dependency_job_id":"77a5815f-ce77-421c-9d1e-eef885e613c4","html_url":"https://github.com/MiniZinc/minizinc-python","commit_stats":{"total_commits":404,"total_committers":8,"mean_commits":50.5,"dds":"0.027227722772277252","last_synced_commit":"81f6ee364bd18f7a794cbc727a60034159dd7414"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiniZinc%2Fminizinc-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiniZinc%2Fminizinc-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiniZinc%2Fminizinc-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiniZinc%2Fminizinc-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MiniZinc","download_url":"https://codeload.github.com/MiniZinc/minizinc-python/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226677138,"owners_count":17666013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constraint-programming","integer-programming","linear-programming","minizinc","optimisation-problem","python","sat-solver"],"created_at":"2024-08-07T23:01:56.090Z","updated_at":"2025-07-19T20:33:24.507Z","avatar_url":"https://github.com/MiniZinc.png","language":"Python","readme":"\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/MiniZinc/minizinc-python\"\u003e\n    \u003cimg src=\"https://www.minizinc.org/MiniZn_logo.png\" alt=\"Logo\" width=\"80\" height=\"80\"\u003e\n  \u003c/a\u003e\n\n  \u003ch3 align=\"center\"\u003eMiniZinc Python\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    The python package that allows you to access all of MiniZinc's functionalities directly from Python.\n    \u003cbr /\u003e\n    \u003ca href=\"https://python.minizinc.dev/en/latest/\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/MiniZinc/minizinc-python/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/MiniZinc/minizinc-python/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n## Table of Contents\n\n* [About the Project](#about-the-project)\n* [Getting Started](#getting-started)\n  * [Installation](#installation)\n  * [Usage](#usage)\n* [Testing](#testing)\n* [Roadmap](#roadmap)\n* [Contributing](#contributing)\n* [License](#license)\n* [Contact](#contact)\n\u003c!-- * [Acknowledgements](#acknowledgements) --\u003e\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\n_MiniZinc Python_ provides an interface from Python to the MiniZinc driver. The\nmost important goal of this project are to allow easy access to MiniZinc using\nnative Python structures. This will allow you to more easily make scripts to run\nMiniZinc, but will also allow the integration of MiniZinc models within bigger\n(Python) projects. This module also aims to expose an interface for meta-search.\nFor problems that are hard to solve, meta-search can provide solutions to reach\nmore or better solutions quickly.\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\nTo get a MiniZinc Python up and running follow these simple steps.\n\n### Installation\n\n_MiniZinc Python_ can be installed by running `pip install minizinc`. It\nrequires [MiniZinc](https://www.minizinc.org/) 2.6+ and\n[Python](https://www.python.org/) 3.8+ to be installed on the system. MiniZinc\npython expects the `minizinc` executable to be available on the executable path,\nthe `$PATH` environmental variable, or in a default installation location.\n\n_For more information, please refer to the\n[Documentation](https://python.minizinc.dev/en/latest/)_\n\n\n### Usage\n\nOnce all prerequisites and MiniZinc Python are installed, a `minizinc` module\nwill be available in Python. The following Python code shows how to run a\ntypical MiniZinc model.\n\n```python\nimport minizinc\n\n# Create a MiniZinc model\nmodel = minizinc.Model()\nmodel.add_string(\"\"\"\nvar -100..100: x;\nint: a; int: b; int: c;\nconstraint a*(x*x) + b*x = c;\nsolve satisfy;\n\"\"\")\n\n# Transform Model into a instance\ngecode = minizinc.Solver.lookup(\"gecode\")\ninst = minizinc.Instance(gecode, model)\ninst[\"a\"] = 1\ninst[\"b\"] = 4\ninst[\"c\"] = 0\n\n# Solve the instance\nresult = inst.solve(all_solutions=True)\nfor i in range(len(result)):\n    print(\"x = {}\".format(result[i, \"x\"]))\n```\n\n_For more examples, please refer to the\n[Documentation](https://python.minizinc.dev/en/latest/)_\n\n\u003c!-- TESTING INSTRUCTIONS --\u003e\n## Testing\n\nMiniZinc Python uses [uv](https://docs.astral.sh/uv/) to manage its\ndependencies. To install the development dependencies run `uv sync --dev`.\n\nAlthough continuous integration will test any code, it can be convenient to run\nthe tests locally. The following commands can be used to test the MiniZinc\nPython package.\n\n- We use [PyTest](https://docs.pytest.org/en/stable/) to run a suite of unit\ntests. You can run these tests by executing:\n```bash\nuv run pytest\n```\n- We use [Ruff](https://docs.astral.sh/ruff/) to test against a range of Python\nstyle and performance guidelines. You can run the general linting using:\n```bash\nuv run ruff check\n```\nYou can format the codebase to be compatible using:\n```bash\nuv run ruff format\n```\n(The continous integration will test that the code is correctly formatted using\nthe `--check` flag.)\n- We use [Mypy](https://mypy.readthedocs.io/en/stable/) to check the type\ncorrectness of the codebase (for as far as possible). You can run the type\nchecking using:\n```bash\nuv run mypy .\n```\n\n\u003c!-- ROADMAP --\u003e\n## Roadmap\n\nSee the [open issues](https://github.com/MiniZinc/minizinc-python/issues) for a\nlist of proposed features (and known issues).\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to\nbe learn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the Mozilla Public License Version 2.0. See `LICENSE` for more information.\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\n👤 **Jip J. Dekker**\n  * Twitter: [@DekkerOne](https://twitter.com/DekkerOne)\n  * Github: [Dekker1](https://github.com/Dekker1)\n\n🏛 **MiniZinc**\n  * Website: [https://www.minizinc.org/](https://www.minizinc.org/)\n\n\u003c!-- ACKNOWLEDGEMENTS --\u003e\n\u003c!-- ## Acknowledgements --\u003e\n\n\u003c!-- * []() --\u003e\n\u003c!-- * []() --\u003e\n\u003c!-- * []() --\u003e\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMiniZinc%2Fminizinc-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMiniZinc%2Fminizinc-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMiniZinc%2Fminizinc-python/lists"}