Skip to main content

pddl

PyPI PyPI - Python Version PyPI - Status PyPI - Implementation PyPI - Wheel GitHub

test lint docs codecov

pddl aims to be an unquestionable and complete parser for PDDL 3.1.

Install

  • from PyPI:
pip install pddl
  • from source (main branch):
pip install git+https://github.com/AI-Planning/pddl.git
  • or, clone the repository and install:
git clone https://github.com/AI-Planning/pddl.git
cd pddl
pip install .

Quickstart

You can use the pddl package in two ways: as a library, and as a CLI tool.

As a library

This is an example of how you can build a PDDL domain or problem programmatically:

from pddl.logic import Predicate, constants, variables
from pddl.core import Domain, Problem
from pddl.action import Action
from pddl.requirements import Requirements

# set up variables and constants
x, y, z = variables("x y z", types=["type_1"])
a, b, c = constants("a b c", type_="type_1")

# define predicates
p1 = Predicate("p1", x, y, z)
p2 = Predicate("p2", x, y)

# define actions
a1 = Action(
    "action-1",
    parameters=[x, y, z],
    precondition=p1(x, y, z) & ~p2(y, z),
    effect=p2(y, z),
)

# define the domain object.
requirements = [Requirements.STRIPS, Requirements.TYPING]
domain = Domain(
    "my_domain",
    requirements=requirements,
    types={"type_1": None},
    constants=[a, b, c],
    predicates=[p1, p2],
    actions=[a1],
)

print(domain)

that gives:

(define (domain my_domain)
    (:requirements :strips :typing)
    (:types type_1)
    (:constants a b c - type_1)
    (:predicates (p1 ?x - type_1 ?y - type_1 ?z - type_1)  (p2 ?x - type_1 ?y - type_1))
    (:action action-1
        :parameters (?x - type_1 ?y - type_1 ?z - type_1)
        :precondition (and (p1 ?x ?y ?z) (not (p2 ?y ?z)))
        :effect (p2 ?y ?z)
    )
)

As well as a PDDL problem:

problem = Problem(
    "problem-1",
    domain=domain,
    requirements=requirements,
    objects=[a, b, c],
    init=[p1(a, b, c), ~p2(b, c)],
    goal=p2(b, c),
)
print(problem)

Output:

(define (problem problem-1)
    (:domain my_domain)
    (:requirements :strips :typing)
    (:objects a b c - type_1)
    (:init (not (p2 b c)) (p1 a b c))
    (:goal (p2 b c))
)

Example parsing:

from pddl import parse_domain, parse_problem, parse_plan

domain = parse_domain("d.pddl")
problem = parse_problem("p.pddl")
plan = parse_plan("p.plan")

As CLI tool

The package can also be used as a CLI tool. Supported invocations are:

  • pddl DOMAIN_FILE: validate a PDDL domain file, and print it formatted.
  • pddl DOMAIN_FILE PROBLEM_FILE: validate both files, check the problem against the domain, and print both formatted.
  • pddl DOMAIN_FILE PROBLEM_FILE PLAN_FILE: validate all three files, check the plan against the domain and problem, and print all formatted.

Features

Supported PDDL 3.1 requirements:

  • :strips
  • :typing
  • :negative-preconditions
  • :disjunctive-preconditions
  • :equality
  • :existential-preconditions
  • :universal-preconditions
  • :quantified-preconditions
  • :conditional-effects
  • :fluents
  • :numeric-fluents
  • :non-deterministic (see 6th IPC: Uncertainty Part)
  • :adl
  • :durative-actions
  • :duration-inequalities
  • :derived-predicates
  • :timed-initial-literals
  • :preferences
  • :constraints
  • :action-costs

Development

If you want to contribute, here's how to set up your development environment.

  • Install uv
  • Clone the repository: git clone https://github.com/AI-Planning/pddl.git && cd pddl
  • Install development dependencies: uv sync --dev
  • Install the git hooks: uv run pre-commit install

Tests

To run tests: uv run tox

To run only the code tests: uv run tox -e py310

To run only the code style checks: uv run ruff check .

Docs

To build the docs: mkdocs build

To view documentation in a browser: mkdocs serve and then go to http://localhost:8000

Authors

License

pddl is released under the MIT License.

Copyright (c) 2021-2025 WhiteMech

Acknowledgements

The pddl project is partially supported by the ERC Advanced Grant WhiteMech (No. 834228), the EU ICT-48 2020 project TAILOR (No. 952215), the PRIN project RIPER (No. 20203FFYLK), and the JPMorgan AI Faculty Research Award "Resilience-based Generalized Planning and Strategic Reasoning".

Metadata

Release files for pddl 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pddl 0.6.1
File Size Uploaded Provenance Actions
pddl-0.6.1.tar.gz 1.4 MB Without provenance Details for pddl-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pddl 0.6.1
File Interpreter ABI Platform Actions
pddl-0.6.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for pddl-0.6.1-py2.py3-none-any.whl

Total release size: 1.5 MB

Release files / pddl-0.6.1.tar.gz

Download URL pddl-0.6.1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ae2c5cb79255187b04c5339ecbe0e2ae4039b385c958d9c6fad49e8fe51722f1
BLAKE2b-256 checksum
How to use checksums
0ff5c5a4db53237ae6e8acb00f59e12e6dc00d8138f509f723a9197b6c55f0cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / pddl-0.6.1-py2.py3-none-any.whl

Download URL pddl-0.6.1-py2.py3-none-any.whl
Size 60.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1384796e136d176c2ce06dc3758ecf3738353e936aac95f67a01d62aee5f6c9e
BLAKE2b-256 checksum
How to use checksums
65875def287a20383dff6209f847d755a982a1191cdd6011c0745a11edbd3696
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for pddl 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page