pychoco: all-inclusive Python bindings for the Choco-solver constraint programming library - Justeau-Allaire, Dimitri; Prud’homme, Charles (Journal of open source software, 2025)
Constraint Programming (CP) is a well-established and powerful Artificial Intelligence (AI) paradigm for modelling and solving complex combinatorial problems (Rossi et al., 2006). Many CP solvers are currently available, and despite a generally shared common base, each solver exhibits specific features that make it more or less suited to certain types of problems and tasks. Performance and flexibility are important features of CP solvers, which is why most state-of-the-art solvers rely on statically typed and compiled programming languages, such as Java or C++. Because of this, CP has long remained a niche field that is difficult for non-specialists to access. Recently, the emergence of high-level, solver-independent modelling languages such as MiniZinc (Nethercote et al., 2007), XCSP³ (Audemard et al., 2020), and CPMpy (Guns, 2019) has made CP more accessible by allowing users to seamlessly use state-of-the-art solvers from user-friendly interpreted languages such as Python. To make CP even more accessible to a wider audience, we developed pychoco, a Python library that provides an all-inclusive binding to the Java Choco-solver library (Prud’homme & Fages, 2022). By all-inclusive, we mean thatpychoco has no external dependencies and does not require the installation of Choco-solver or Java on the user’s system. The choice of Python was motivated by its widespread use in the data science and AI communities, as well as its extensive use in education. The pychoco Python library supports almost all features of Choco-solver, is regularly updated, and is automatically built and distributed through PyPI for Linux, Windows, and MacOSX at each release. As a result, pychoco can seamlessly integrate into high-level constraint modelling Python libraries such as CPMpy (Guns, 2019) and PyCSP³ (Lecoutre & Szczepanski, 2024). Moreover, users who need to use features specific to Choco-solver (e.g., graph variables and constraints) can now rely on pychoco without prior knowledge of Java programming. We believe that along with initiatives such as CPMpy and PyCSP, the availability of CP technologies in the Python ecosystem will foster new uses and the appropriation of CP by a wider scientific and industrial public.