|
2 | 2 |
|
3 | 3 | ## Cursor Cloud specific instructions |
4 | 4 |
|
5 | | -`jupyddl` (PythonPDDL) is a Python library + CLI for PDDL automated planning. It is a |
6 | | -thin wrapper around the Julia `PDDL.jl` parser, bridged through `pyjulia`/`PyCall.jl`. |
7 | | -There are no servers/databases — "running the app" means parsing PDDL domain/problem |
8 | | -files and running the planners, either via the library or the `scripts/ipc.py` CLI. |
| 5 | +`jupyddl` is a **pure-Python** PDDL planning framework (parser, grounder, |
| 6 | +planners, heuristics, benchmarking). The Julia/`PDDL.jl`/PyCall integration has |
| 7 | +been removed — there is no Julia, no native build step, and the core has zero |
| 8 | +runtime dependencies. |
9 | 9 |
|
10 | | -### Environment layout (baked into the VM snapshot) |
11 | | -- Julia 1.5.2 in `/opt/julia-1.5.2` (symlinked at `/usr/local/bin/julia`). |
12 | | -- Python 3.8 venv at `.venv`, built from the **deadsnakes** `/usr/bin/python3.8`. |
13 | | -- Julia packages `PyCall.jl` + the `APLA-Toolbox/PDDL.jl` fork live in `~/.julia`. |
14 | | - `PyCall` is built against `.venv/bin/python`. |
15 | | -- `.venv`, `logs/*`, and the `pddl-examples` submodule contents are git-ignored. |
| 10 | +### Environment |
| 11 | +- Python ≥ 3.9; a `.venv` (created with `uv`, Python 3.12) with an editable |
| 12 | + install: `uv pip install -e ".[dev]"` (add `viz` for matplotlib-based |
| 13 | + benchmark plots). `.venv` and `pddl-examples/` contents are git-ignored. |
| 14 | +- The `pddl-examples` git submodule supplies the domains/problems the tests use; |
| 15 | + it must be initialised (`git submodule update --init`). |
16 | 16 |
|
17 | | -### Running / testing / linting |
18 | | -Always use the venv interpreter and run from the repo root (relative `pddl-examples/...` |
19 | | -paths and the auto-created `logs/` dir depend on CWD): |
20 | | -- Library / hello-world: `.venv/bin/python -c "from jupyddl import AutomatedPlanner; ..."` |
21 | | -- CLI: `cd scripts && ../.venv/bin/python ipc.py <domain.pddl> <problem.pddl> <output>` |
22 | | -- Tests: `.venv/bin/python -m pytest --cov=./` (from repo root). |
23 | | -- Lint (as CI): `.venv/bin/python -m flake8 . --select=E9,F63,F7,F82` is the build-gating |
24 | | - check; the second CI `flake8` pass uses `--exit-zero` (style warnings only, non-blocking). |
| 17 | +### Running / testing / linting (use the venv interpreter) |
| 18 | +- Tests: `.venv/bin/python -m pytest` (add `--cov=jupyddl`). |
| 19 | +- Lint (as CI): `flake8 jupyddl tests` (config in `.flake8`, max-line 100). |
| 20 | +- CLI: `.venv/bin/python -m jupyddl.cli solve <domain> <problem> -s astar -H lmcut` |
| 21 | + or `... benchmark pddl-examples --csv out.csv`. Installed as `jupyddl` too. |
25 | 22 |
|
26 | | -### Non-obvious gotchas |
27 | | -- **pyjulia needs a dynamically-linked Python.** The `.venv` intentionally uses the |
28 | | - deadsnakes `python3.8` (dynamically linked). Do **not** rebuild the venv from a |
29 | | - `uv`-managed / python-build-standalone interpreter — those are statically linked to |
30 | | - libpython and break the in-process Julia bridge. |
31 | | -- **If the venv is recreated at a different path, rebuild PyCall** so it points at the new |
32 | | - interpreter: `PYTHON=/workspace/.venv/bin/python .venv/bin/python -c "import julia; julia.install()"`. |
33 | | -- **matplotlib backend.** `jupyddl/data_analyst.py` picks `TkAgg` when `DISPLAY` is set and |
34 | | - `Agg` otherwise. The VM has a virtual display (`DISPLAY=:1`) and `python3.8-tk` is |
35 | | - installed, so the default import works. For a purely headless run, invoke with |
36 | | - `env -u DISPLAY ...` (or `MPLBACKEND=Agg` when the import path allows it) to force `Agg`. |
37 | | -- **`DISPLAY` changes the test outcome.** `DataAnalyst.__get_all_pddl_from_data` only walks |
38 | | - the whole `pddl-examples/` folder when `DISPLAY` is set; otherwise it returns a hardcoded |
39 | | - `dinner`-only list. Headless (no `DISPLAY`, as in CI) the full suite is green — run tests |
40 | | - with `env -u DISPLAY .venv/bin/python -m pytest` to reproduce CI (all 77 pass). With this |
41 | | - VM's `DISPLAY=:1`, 19 `DataAnalyst` tests fail with `PyCall.jlwrap ... 'domain' keyword is |
42 | | - missing`: the folder walk pairs files from an unsorted `os.walk` assuming `domain.pddl` |
43 | | - precedes `problem.pddl`, but the `pallet` example is ordered the other way, so a problem |
44 | | - file is parsed as a domain. That is a pre-existing code bug, not an environment issue. |
45 | | -- **CI (`.github/workflows/*.yml`) is pinned to Python 3.8 on `ubuntu-latest`.** 3.8 is the |
46 | | - newest interpreter whose resolved deps keep NumPy at 1.x (matplotlib 3.5.1 breaks on NumPy |
47 | | - 2.x). macOS runners were dropped: they are arm64, which has no Julia 1.5.2 build and no EOL |
48 | | - Python build. CI builds PyCall against the runner Python with `python -c "import julia; |
49 | | - julia.install()"` before adding `PDDL.jl`. |
| 23 | +### Non-obvious notes |
| 24 | +- **Example data quirks (external submodule, do not "fix" in this repo):** |
| 25 | + `grid` uses numeric fluents and is intentionally unsupported (raises |
| 26 | + `UnsupportedFeatureError`); `vehicle` has typos in its problem file |
| 27 | + (`struck`/`truck`, `acessible`) so its goal is unreachable and it is correctly |
| 28 | + reported unsolvable. Tests treat both as expected. |
| 29 | +- **Conditional effects (`flip`)**: the delete-relaxation heuristics (`hadd`, |
| 30 | + `hff`, `lmcut`, `h^m`) are *not guaranteed admissible* on domains with |
| 31 | + conditional effects because each conditional effect is relaxed into its own |
| 32 | + operator. For guaranteed-optimal plans there use `bfs`, `dijkstra`, or |
| 33 | + `astar`/`idastar` with the `blind` heuristic. Optimality tests use these. |
| 34 | +- **Matplotlib is optional**: only `jupyddl.benchmark.plot_summary` (and |
| 35 | + `jupyddl solve/benchmark --plot`) need it; run headless with `MPLBACKEND=Agg` |
| 36 | + if no display. The test suite does not require it. |
| 37 | +- Extend via the registries: `jupyddl.search.PLANNERS` and |
| 38 | + `jupyddl.heuristics.HEURISTICS`. |
0 commit comments