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.14, < 0.1 for shared third-party native dependencies.

The shared workspace layout and general Python/CMake integration pattern are documented in the Planning and Learning build instructions.

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.14,<0.1'

cmake -S . -B build

CMake discovers the installed pyyggdrasil automatically through cmake/find_python_native_packages.cmake 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

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.14,<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.9.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.9-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

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

pypddl-1.0.9-cp313-cp313-macosx_11_0_arm64.whl (899.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.9-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

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

pypddl-1.0.9-cp312-cp312-macosx_11_0_arm64.whl (899.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

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

pypddl-1.0.9-cp311-cp311-macosx_11_0_arm64.whl (900.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.9-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

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

pypddl-1.0.9-cp310-cp310-macosx_11_0_arm64.whl (900.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.9-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

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

pypddl-1.0.9-cp39-cp39-macosx_11_0_arm64.whl (900.3 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pypddl-1.0.9.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.9.tar.gz
Algorithm Hash digest
SHA256 8641f7430eee8a7f66cf2f973bf921b33e5c3b4350992b0da1df677d1f913686
MD5 85cfe7bd3b6c5da0f827a6aac4ddcc50
BLAKE2b-256 5e0dfa625ca11ef2c851a8d100cc98483bc929336588e1f87a05199504a76840

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9.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.9-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e698ae67d5ade14c0bf42d12ff6ca67d85fc577105f548dde7a0b359f43b349
MD5 7bd2202a4e0eea37a1e5b8c823c23b2d
BLAKE2b-256 9beb8f02004b1d02e80163fbe58b6a78f4f8fdcb4a726d04dde07dd359a18cf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfa8e4fd4292f89d674976182d0fc011936383ecf7d9eca0d4d906c7fcc04346
MD5 d8591a3eb8fa8004eeb0fbcd4d3333b7
BLAKE2b-256 6e0f6d6e9af669c9c24b4fb53410711acfbc48666636cc20f55f058157ae75ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 246c156898730d2978239baf2c54856e0d6fd5b5820b9d4ecbb636c298f435e4
MD5 393bfde95b5cbce07d06dcd561ecbad7
BLAKE2b-256 053af2de14658f40f598c365a9c104602f240cdc1d01eaa786adfbc3bb94cb51

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fd46a229bad1aae6d713ec360801976372ad6f4bb7c36a56b7fb79a5acef708
MD5 8552d667291881af1a907f963dd41b29
BLAKE2b-256 5becfee551601864227d727715930c83ee1e0ab203ac185e741455e7cb8913fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cb0026402f54d0703b3b99c9640113718a5d7bbb8e56381ac8a415fab29e6476
MD5 c555a3f5cfe34e09ffcb3f8eff30c044
BLAKE2b-256 1a1fb1ac8addadd94da9bfea9c19e3a1ed29c5253c80458edd0ac24cdb163dec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7aa4c25fb0e806c3077ff6b3d8059744cb4c981206b2fb2ddc9952f0d89174d
MD5 67bb50961d366dfb9b04de77e886aec4
BLAKE2b-256 2cc4ccc2232e67674fe9ed78dfc02b41fad7ff093f76b38a11bf5ef4cef85385

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d2d3a99abccc2032059b4f5c1459af2386037118d4f142b44aee200f6ed171ae
MD5 53e1877c78ae544e0ae4f88b37a5ec18
BLAKE2b-256 986eaeba25da45e6b8ab536db4b053c79fe2ae01d663e1796db1fa2d433a0c83

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f132729a4a9cb6e211a8179e1b32f84a6366920e734d060cc54ea7c3d2a89df
MD5 cd0e4c4c26f801d1b914c0a608d9ffe9
BLAKE2b-256 311039876a63967114f3213d76b1441d9c43aff94f235940dc911804bceab688

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cd7470038551bbcdc0548191a9b15c9f32aa658b8693a34b75194615d6fa3eba
MD5 b37e32de8175e0910bc536333573072c
BLAKE2b-256 95f182b3efe01cf545d4b9d9d3bc22d4fcd09d736efd5b02c635131db32d40a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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.9-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.9-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d9b16593d89e70d8f08f396ec843f5e9600dc6bba06e4904fdacf58ae2891316
MD5 d69b08e641225b681a470363c83da2dc
BLAKE2b-256 29e74a79285a2b509cb401a6937490ddb20247cb35bc98e626a7b0cde7858427

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.9-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