Skip to main content

Python-distributed native package for the Loki PDDL parser library

Project description

Loki: PDDL Parsing and Translation in C++ and Python

Loki is a C++20 library with Python bindings for parsing and translation of PDDL files. Loki separates the parsing and translation of domain and problem files, allowing users to effectively work with collection of problems.

The parser is based on the canonical parser structure proposed in the Boost Spirit X3 library.

The translator is based on the method presented in section four of the paper "Concise finite-domain representations for PDDL planning tasks by Malte Helmert (AIJ 2009)".

Supported PDDL Requirements

  • :strips
  • :typing
  • :negative-preconditions
  • :disjunctive-preconditions
  • :equality
  • :existential-preconditions
  • :universal-preconditions
  • :quantified-preconditions
  • :conditional-effects
  • :numeric-fluents
  • :adl
  • :derived-predicates
  • :action-costs
  • :non-deterministic (unsupported in the translator)
  • :probabilistic-effects (unsupported in the translator)

Dependencies

Loki depends on a fraction of Boost's header-only libraries (Fusion, Spirit x3, Container), its performance benchmarking framework depends on GoogleBenchmark, and its testing framework depends on GoogleTest.

Loki consumes native dependencies from Python packages:

  • pyyggdrasil >= 0.0.18, < 0.1 for shared third-party native dependencies.

The shared workspace layout, layered install order, and the common build-from-source and CMake-integration patterns are documented in the Planning and Learning build instructions; the sections below cover loki/pypddl-specific details.

For offline/local development, install pyyggdrasil from the sibling source checkout instead:

cd ../yggdrasil
uv pip install --python ../loki/.venv/bin/python .

Build C++

Install Loki's native dependency providers into the active Python environment, then configure CMake with their native prefixes:

python -m pip install 'pyyggdrasil>=0.0.18,<0.1'

cmake -S . -B build

CMake discovers the installed pyyggdrasil automatically through cmake/bootstrap_pyyggdrasil.cmake (which locates the package and adds its native prefix to CMAKE_PREFIX_PATH, after which find_package(yggdrasil) provides the shared helper functions) and links against the yggdrasil::yggdrasil target. To point at a different prefix explicitly:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -m pyyggdrasil --prefix)"

cmake --build build -j4

CMake options:

Option Default Description
LOKI_BUILD_TESTS OFF Build Loki tests.
LOKI_BUILD_EXECUTABLES OFF Build Loki executables.
LOKI_BUILD_PROFILING OFF Build Loki profiling targets.
LOKI_BUILD_PYPDDL OFF Build Loki for the pypddl Python wheel.
LOKI_ENABLE_FMT_FORMATTERS ON Enable the public fmt::formatter specializations of Loki and yggdrasil (LOKI_/YGG_ENABLE_FMT_FORMATTERS macros, both default-on in the headers).

Run tests from a build configured with -DLOKI_BUILD_TESTS=ON:

ctest --test-dir build --output-on-failure

Install Loki from a configured build directory with:

cmake --install build --prefix=<path/to/installation-directory>

Build Python

python -m pip install .

Python API

The Python package exposes the semantic parser, translator, and reparseable PDDL formatter through pypddl.formalism:

from pypddl import formalism as pddl

parser = pddl.Parser("""
(define (domain ready-domain)
  (:predicates (ready))
)
""")

translation = pddl.translate_domain(parser.domain())
domain_text = pddl.format_domain(translation.translated_domain)
reparsed = pddl.Parser(domain_text)
assert reparsed.domain().get_name() == "ready-domain"

C++ API

The umbrella header exposes the semantic parser, translator, and reparseable PDDL formatter through the top-level loki namespace:

#include <loki/loki.hpp>

#include <string>

int main()
{
    auto parser = loki::Parser(std::string { "(define (domain ready-domain) (:predicates (ready)))" });
    const auto translation = loki::translate_domain(parser.get_domain());
    const auto domain_text = loki::format_domain(translation.get_translated_domain());
    auto reparsed = loki::Parser(domain_text);
    return reparsed.get_domain().get_name() == "ready-domain" ? 0 : 1;
}

CMake Integration

This section covers pypddl-specific paths and targets; the general pattern for consuming the native prefixes from CMake is in the common CMake integration instructions.

The Python package pypddl installs Loki's native headers, shared library, and CMake package config under pypddl.native_prefix(). It depends on pyyggdrasil>=0.0.18,<0.1 for third-party native dependencies:

import pypddl
import pyyggdrasil

print(pypddl.cmake_prefix())       # prefix to put on CMAKE_PREFIX_PATH
print(pypddl.cmake_dir())          # directory containing lokiConfig.cmake
print(pyyggdrasil.cmake_prefix())

The same paths are available from the shell via python -m pypddl --prefix, --cmake-dir, --include-dir, and --version.

Downstream CMake projects should include the native prefixes of pypddl and its native package dependencies in CMAKE_PREFIX_PATH:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -m pypddl --prefix);$(python -m pyyggdrasil --prefix)"

Loki exports the loki::parsers target.

Running the Executables

The executable illustrates how to use Loki. It is disabled by default and can be enabled with -DLOKI_BUILD_EXECUTABLES=ON. Example PDDL inputs are available from the benchmark submodule:

git submodule update --init --recursive data/planning-benchmarks
./build/exe/loki \
  data/planning-benchmarks/tests/classical/gripper/domain.pddl \
  data/planning-benchmarks/tests/classical/gripper/test-1.pddl

Citing Loki

If you use Loki in your research, please cite it as follows:

@misc{drexler-zenodo2026,
  author =       "Dominik Drexler",
  title =        "{Loki}: A {PDDL} Parser and Normalizer",
  publisher =    "Zenodo",
  year =         "2026",
  doi =          "10.5281/zenodo.20081136",
  url =          "https://doi.org/10.5281/zenodo.20081136",
}

Acknowledgements

This work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation.

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

pypddl-1.0.11.tar.gz (3.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pypddl-1.0.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.11-cp313-cp313-macosx_11_0_arm64.whl (854.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.11-cp312-cp312-macosx_11_0_arm64.whl (854.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.11-cp311-cp311-macosx_11_0_arm64.whl (854.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.11-cp310-cp310-macosx_11_0_arm64.whl (854.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.11-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.11-cp39-cp39-macosx_11_0_arm64.whl (854.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pypddl-1.0.11.tar.gz.

File metadata

  • Download URL: pypddl-1.0.11.tar.gz
  • Upload date:
  • Size: 3.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pypddl-1.0.11.tar.gz
Algorithm Hash digest
SHA256 2e4541583d2d920391ba59bebacd07874ef0489cb0436848fb424e4890093edc
MD5 7cdccb1d81ec952fd511e5d4d6c50afc
BLAKE2b-256 3092756d44e163037a62dbcea6366da2fe419cfd301b941cfc25d455ab24ce11

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11.tar.gz:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 156a76fddc668f3ccab034a77655e9ef623948d6f4f9861b48c8c2fafe22f1d7
MD5 b62b241f211c76ded3e1df67b87058ab
BLAKE2b-256 c74a5eac424d6d4a8845e189f2c57e9bf74ed172e6439c63f530540bdd168fb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9474d0e944e12b3ae6286ffe5c2ed49cded23c20e8d2d6252f482788ff977c0d
MD5 8495e8cfccc525f99bf3d2081724ee46
BLAKE2b-256 290e425df4888c90bcc344a389faa829e5834f53832b268da2d13d81adb5a6dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 acaa208f5e49a0a98b0a60fa605588c5b9a53efc69a97be7784b9ee41afde364
MD5 5314a38efdcca7d27cc0980b5904136c
BLAKE2b-256 d40f9871535421ca94da1ecc4d893054786bf01ac11e3a482385a694f3cafa59

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edde2b5e4fa42de7f267bdb37d7eb00db253f8bbd0c7cf46bf533a8ee04054b7
MD5 d70b366854f48ecf66668fd1a264e4fb
BLAKE2b-256 f64c06a8e4d43c0d44842769be7a60964885e66f37fd60311ac0cb7ab446f06a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 445bc07ea770f7103824072a8fd245b447851e760ede4d0510b9ea43dce8b5dd
MD5 0141614290728f8366e190b9e211387b
BLAKE2b-256 d8f642a9eba4ef67e27ee90b4a89d8ce3536318b73465534139c262e3b6a3bb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5fbbf72ae00a776550a2641b096fe4fc8b5e132edc5081a82b2ab7ff8169490
MD5 a8cc951b8e669254cf0fedc92c278e23
BLAKE2b-256 6ff3711b29862f35f5a66e6647534d0caaccb6c77268926ec7507a9920c92f7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b44dacd57524c6ce8068907dd023ecd72fc5f341d6568cbd3fe3b2cfbc6e5b88
MD5 817d06a60b19ccfdb9d500e65084f133
BLAKE2b-256 209b06b554d955c211bfe6f9b07ff258ab1262b3b4484f37790c21efd70202ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f15e35a6d326032f532a408fcd42613b414cdc17e626bde6d1c48274a0d70414
MD5 6adabe2401b7b5e60d2f26b71395ea40
BLAKE2b-256 f75a82401dc061a81f07500edc5729d06146c074011391c615be089860b8be73

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 53ffc0f405c6cb92cdfe812902655ecaf6208132572bd14aa648cd155590fc7d
MD5 ce264233b6d187bbaa4c9506226f407d
BLAKE2b-256 07b0634facf372c93367509f6cc28f4d6d5bcb755c47cbc402a3a5bc0126fd91

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.11-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.11-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a804e7baa09ca488708c2f69dd9e5e52d0cb3e4e152a4354d1218db0893c0d4
MD5 679ba31dd9c0728e2ae185885edf5870
BLAKE2b-256 e5669ecd474d7d66553e967831a0a4c600c271642927c9da282701242809ef2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.11-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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