Skip to main content

Python bindings for the Glasgow Constraint Solver

Project description

Glasgow Constraint Solver CPMpy Interface

The code in this directory creates a simple Python interface for the Glasgow Constraint Solver, primarily intended for use by the CPMpy modelling library. Essentially it wraps all the relevant functionality in a single class defined in api.hh, api.cc using only standard library types, and then generates bindings for the methods using pybind11 (submoduled in the extern directory).

How to install

I've not entirely got the installation process streamlined yet, but the current procedure is as follows.

  1. Clone the whole repository, including the pybind11 submodule:
git clone --recurse-submodules https://github.com/ciaranm/glasgow-constraint-solver.git
  1. Build the libraries (including the python module) using CMake (the XCSP support is not required):
cd glasgow-constraint-solver
cmake -S . -B build -DGCS_ENABLE_XCSP=OFF -GCS_ENABLE_CPMPY=ON
cmake --build build
  1. The cpmpy/gcspy directory should now contain a shared library file that can be imported as a python module. Optionally this can now be tested with some simple python unit tests
cd cpmpy
python3 gcspytest.py
  1. To make this available system-wide, or in a virtual environment, the package can now be pip installed: (ensure still in the cpmpy directory)
pip3 install .

Packaging for PyPi (untested)

I think that after doing steps 1-3 we should be able to just do:

python3 -m build
python3 -m twine upload dist/*

And then anyone should be able to install the package with simply:

pip3 install gcspy

I'm not sure about the cross-platform compatability of this though, and I haven't tested it yet.

API Functions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcspy-0.0.1.tar.gz (530.6 kB view hashes)

Uploaded Source

Built Distribution

gcspy-0.0.1-py3-none-any.whl (535.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page