PythonESE is a Python web app to execute logic programs with different solvers, using the EmbASP framework.
The project is still at an early stage of development
It currently supports only the following formalisms and solvers:
- ASP (Answer Set Programming)
- DLV2
- DLV
- Clingo
- Datalog
- I-DLV
We encourage any feedback, but we do NOT recommend it for production yet.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
It requires only Python® and the Tornado package.
Download the Latest Release of PythonESE
Go to the directory where you downloaded the release and run the following command:
python setup.py install
Can be invoked using the WebSocket protocol, as explained in the Wiki of EmbASPServerExecutor
This repository provides also Docker containerization for PythonESE. Docker enables the encapsulation of the PythonESE Module within a lightweight, portable container, ensuring smooth deployment across various environments.
Deploying PythonESE using Docker is straightforward:
Ensure Docker is installed on your system (refer to the official Docker documentation for installation instructions). Then, clone this repository using the following command:
git clone https://github.com/DeMaCS-UNICAL/PythonESE.git
A Docker image is a package that contains all the necessary to run application and it's used to create Docker containers. To create one navigate to the cloned repository directory and build the Docker image using the provided Dockerfile:
docker build -t python-ese .
Once the Docker image is built, you can run a Docker container using the following command:
docker run -d --network host --mount type=bind,source=[your/path/to/config],target=/app/config --privileged=true python-ese
The --network host
option in the docker run command tells Docker to use the host network for the container. This means the container shares the same network stack as the host and can access network services running on the host directly.
The --mount type=bind, source=[your/path/to/config], target=/app/config
option is used to create a bind mount. A bind mount is a type of mount that allows you to map a host file or directory to a container file or directory (for more information refer to the official Docker documentation).
In this case we use mounts to provide the configuration file to the container.
The configuration file is a JSON file that contains the configuration of PythonESE. It must be placed in a directory on the host and the full path to this directory must be specified in the source option of the --mount option. The JSON schema needs also to be in the same directory.
For examples on how to create or modify the configuration file refer to the ne xt section. If no configuration file is provided the default configuration will be used.
The --privileged=true
option is used to give the container full access to the host system. This is necessary to run the logic solvers like Clingo in a safe environment using Bubblewrap.
This configuration file contains the settings for the PythonESE module.
This section contains paths to various resources.
executables
: Paths to different Logic Solvers likedlv
,clingo
,dlv2
,idlv
, and a timeout script(we use this).certificate
: Paths to the certificate and key files for secure communication.
This section contains properties related to the server.
port_number
: The port number on which the server is running.cors_origins
: A list of origins that are allowed to access the server resources.
This section contains properties related to the output of the logic solvers.
max_chars
: The maximum number of characters that the output can contain.
This section contains limits for the execution of the logic solvers.
time
: The maximum amount of time (in seconds) that the solver is allowed to run.memory
: The maximum amount of memory (in kilobytes) that the solver is allowed to use.
This section contains options that can be passed to the logic solvers. Each solver has its own set of options.
- EmbASP - To execute logic programs with different solvers
- Tornado - To manage the web app
- timeout - To limit time and memory consumption of the executors under Linux
We use Semantic Versioning for versioning. For the versions available, see the releases on this repository.
- Stefano Germano
From the Department of Mathematics and Computer Science of the University of Calabria and the Department of Computer Science of the University of Oxford
This project is licensed under the MIT License