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.15, < 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.15,<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.15,<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.10.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.10-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.10-cp313-cp313-macosx_11_0_arm64.whl (899.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.10-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.10-cp312-cp312-macosx_11_0_arm64.whl (899.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.10-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.10-cp311-cp311-macosx_11_0_arm64.whl (900.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.10-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.10-cp310-cp310-macosx_11_0_arm64.whl (900.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.10-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.10-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.10.tar.gz.

File metadata

  • Download URL: pypddl-1.0.10.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.10.tar.gz
Algorithm Hash digest
SHA256 d5b6b736c89b90604535df9994a78e5f58ac7d69c785db163b9746b2e4b9425b
MD5 fef264170bbf1bf42d98debc3d27f82c
BLAKE2b-256 e58b677157695f289fb7c9cac2037a6f5cd170ade6819d253f9184948ffbb689

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 50abd172ccb125b808dc1e626ef633d00c45a41cce826001346126cbace72a63
MD5 397ede57ad0651937922b006f14f9de7
BLAKE2b-256 782cf466dc82107d723c4e725c6019089a2c8e441c994f94c8abe1738344fd84

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9be35e77e141bb532f7619aa45ef8273fe36333f7bd4888c6d549c4c5651847e
MD5 c924953ea3aaa889db69af1cdde03370
BLAKE2b-256 ed4aa822b039db54a6af3e41045e39a0e1dcc40f2b31ada7c79d742a5d685f8b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 49081c63964170eea6941a7eb2e1c0791b666d2c0ac0138851bf85e94a6ee9ef
MD5 adbd19e71159dd8ec876b530240bd17e
BLAKE2b-256 97524e459588ef31150f1451dcac069fdda12a3315578630d61240e1b1fc413b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7966608279c010dc3f3e012742f70f6d9312711c93ebd227d550efcbfffbd0af
MD5 5c4cb8583cf1abe62dc847e9f661897d
BLAKE2b-256 40612cf289e2f587f511c4c370373fce71a8de779d7302553070fdece2856a4f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9085fd42f77a2daad5be03f3e4d768f2316d1b0550c27d674b7fc15794c9e68c
MD5 dbd61480455c9e7d2be691ef1527b0ca
BLAKE2b-256 5980f097be26bea4abd40b2f4370ea604f925db022ccf0ae9b1dfb1c3becb0b5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 647072129dbf97776e9704eb1b946afb67091fa28bc50b8efdf4f2c726bd5fd0
MD5 65d9915e53a590ce6c3c73334f97623d
BLAKE2b-256 141de966048e612aecf0a40fde223de90e132d4b9ce6f571cb501d9c3b7923d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9ecdf6d426b14c5c42ce73924c787558417a46677a4b799e140d436eec2bb15e
MD5 3db815878e6557061243d4fcc2085b5c
BLAKE2b-256 c0a889a129540d80ed5c418ad6095b3d7eb1973f77f1623e9026b0644a96a6e2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60c6d82d2d77961a71ac92a1993a796af1dddf13052d1c645ce9813e9db8b1a1
MD5 f173c9b7598f75bd5f8e7144cf184e93
BLAKE2b-256 33a7ed71c85638b58b55771215b278bd970b27ef8a08f98e9fbbec87329dc32b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 945d3e7414ab0aa1a4f5fa5c54698979f305aeb1be43a264ebf9ab300a4b0023
MD5 8bb5589def3bb12333b937912cf16a96
BLAKE2b-256 76134ce340b37f0d36fcc94d66a909246aa88eb29be711b8b17763977a6c2483

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.10-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2451deda347ab081d8c5c7216c3f7250cdeab23476b0e30627a962788412b8bd
MD5 a4c5f3076e4db375f63bf7c6847b943f
BLAKE2b-256 7b835a2ff1ddb85a3172b3e43f1b194ef2b17f3c9bb67000a3469454300d45a8

See more details on using hashes here.

Provenance

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