Installation Guide

By following this guide you will be able to install the newground prototype.

Requirements

In addition to the the pip-packages listed below, it is necessary to have Python3 installed, where we support python versions >=3.11.

PIP-Packages Requirements

  • clingo>=5.6.2

  • clingox

  • networkx

  • future-fstrings

General Installation

For using the newground prototype an installation is not required, but recommended, as all dependencies are automatically installed.

General Installation Method

You can install the prototype by typing the following command in your CLI:

First check your python version (should be >=3.11):

$ python --version

Then install the prototype:

$ python -m pip install .

Check the installation:

$ newground --help

Which output should be:

$ newground --help
usage: newground [files]

positional arguments:
  files

options:
  -h, --help            show this help message and exit
  --no-show             Do not print #show-statements to avoid compatibility issues.
  --mode {rewrite-aggregates-ground-partly,rewrite-aggregates-no-ground,rewrite-aggregates-ground-fully}
  --aggregate-strategy {RA,RS,RS-PLUS,RS-STAR,RECURSIVE}
  --cyclic-strategy {assume-tight,level-mappings,shared-cycle-body-predicates,level-mappings-AAAI}

General Installation via make

If you have the make environment installed, you can use it to install newground. To install the general version, execute the following command.

$ make install

Check if newground was correctly installed:

$ newground --help
usage: newground [files]

positional arguments:
  files

options:
  -h, --help            show this help message and exit
  --no-show             Do not print #show-statements to avoid compatibility issues.
  --mode {rewrite-aggregates-ground-partly,rewrite-aggregates-no-ground,rewrite-aggregates-ground-fully}
  --aggregate-strategy {RA,RS,RS-PLUS,RS-STAR,RECURSIVE}
  --cyclic-strategy {assume-tight,level-mappings,shared-cycle-body-predicates,level-mappings-AAAI}

Uninstall

Although we would be very sad, if you would do it, you can uninstall Newground with the following command:

$ python -m pip uninstall newground

Or by using make:

$ make uninstall

Installation for development

We provide several different options for installation for specific purposes, which effectively means that you install additional dependencies that are not required for the prototype, but for development. This includes dependencies for code-linting, documentation and formatting.

Installation for Documentation

You can install the additional dependencies for installation by:

$ python -m pip install .[doc]

Or use the Makefile:

$ make install-doc

When installed you are able to compile the documentation via Sphinx. For doing this navigate to docs/sphinx and enter:

docs/sphinx$ sphinx-build -M html source/ build/

The resulting documentation is placed in the build folder. You can see a local preview of the documentation page by using a simple local http-server, which you can do e.g. by:

docs/sphinx/build/html$ python -m http.server

Autoformatting/Linting - Installing nox

nox environments are used for linting and autoformatting. Therefore we recommend you to install nox for these purposes. This can be done in the following way:

$ python -m pip install nox

Autoformatting with nox

For autoformatting the newground directory, use:

$ nox -s format

Linting with nox

We lint with two linters: Pylint and Flake8. For linting with Pylint enter:

$ nox -s lint_pylint

For linting with Flake8 enter:

$ nox -s lint_flake8

Installation for Autoformatting

It is not recommended to use the autoformatter directly! We recommend using the autoformatter with nox, e.g. by:

$ nox -s format

If you want to do it manually, you can install the dependencies for the autoformatter by entering the following command:

$ python -m pip install .[format]

Or use the Makefile:

$ make install-format

Installation for Linting

It is not recommended to directly use the linters, but use nox instead. Therefore, for linting with Pylint enter:

$ nox -s lint_pylint

For linting with Flake8 enter:

$ nox -s lint_flake8

But if you still want to install the linters, you can do this in the following way.

Install Dependencies for Pylint

$ python -m pip install .[lint_pylint]

Or use the Makefile:

$ make install-lint-pylint

Install Dependencies for Flake8

$ python -m pip install .[lint_flake8]

Or use the Makefile:

$ make install-lint-flake8

Install Everything

If you have make installed and want to install all dependencies, you can do this with:

$ make install-all

Direct Usage without Installation

Although an installation is generally recommended, it is possible to directly start the prototype with a Python script, without explicitly installing the prototype. For this first install the requirements with:

$ python -m pip install -r requirements.txt

And then directly call the prototype script:

$ python start_newground.py --help
usage: newground [files]

positional arguments:
  files

options:
  -h, --help            show this help message and exit
  --no-show             Do not print #show-statements to avoid compatibility issues.
  --mode {rewrite-aggregates-ground-partly,rewrite-aggregates-no-ground,rewrite-aggregates-ground-fully}
  --aggregate-strategy {RA,RS,RS-PLUS,RS-STAR,RECURSIVE}
  --cyclic-strategy {assume-tight,level-mappings,shared-cycle-body-predicates,level-mappings-AAAI}