|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +`dynamicsyntax` (a.k.a. DyLan) is a single Python package (`>=3.11`) managed with **uv**. |
| 6 | +There is no database, container stack, or backend API — every surface runs as a local |
| 7 | +Python process or static files. The startup update script already runs `uv sync --group dev`, |
| 8 | +so a `.venv` with dev tools is present when a session begins. |
| 9 | + |
| 10 | +### Product surfaces |
| 11 | +- **Core library** (`dynamicsyntax` / `dylan`): programmatic incremental parser producing TTR semantics. |
| 12 | +- **Induction CLI** (`dsttr-induction`): YAML-driven EM lexicon learning + evaluation. |
| 13 | +- **Flet GUI** (`dylan-gui`): desktop parser UI (also runnable in a browser). |
| 14 | +- **Pyodide web shell** (`web/`): static browser app running the parser via WebAssembly. |
| 15 | + |
| 16 | +### Running / testing (standard commands live in `README.md`, `pyproject.toml` `[project.scripts]`, and `.github/workflows/ci.yml`) |
| 17 | +- Lint (CI scope): `uv run ruff check tests` (locally you can also lint `src`). |
| 18 | +- Tests: `uv run pytest -q` — full suite takes ~1 min; a few induction tests use `@pytest.mark.timeout`. |
| 19 | +- Build wheel/sdist: `uv build`. |
| 20 | +- Library hello-world: `uv run python -c "import dynamicsyntax as ds; print(ds.parse('a man knows you','ttr').semantics)"`. |
| 21 | +- Induction pipeline: `uv run dsttr-induction --config configs/induction/holdout.yaml` (writes to `out/runs/<timestamp>_<name>/`; ~2 min for `class1.txt`). |
| 22 | + |
| 23 | +### Non-obvious gotchas |
| 24 | +- **Prefer `uv run <cmd>`** rather than activating the venv; it always uses the project `.venv`. |
| 25 | +- **Flet GUI in this headless VM must use web mode**: run `DYLAN_FLET_WEB=1 uv run dylan-gui` |
| 26 | + and open `http://127.0.0.1:8550/`. Two caveats in web mode: |
| 27 | + - It logs a non-fatal `TimeoutException ... Window(...).center` traceback at startup |
| 28 | + (`page.window.center()` is desktop-only); the UI still renders and works. |
| 29 | + - The "Load grammar" button uses a **native directory picker** that does not work in a |
| 30 | + browser, so grammar loading (and therefore parsing) can't be completed via the web GUI. |
| 31 | + Use the library API / `dsttr-induction` CLI for end-to-end parsing in this environment, |
| 32 | + or run the GUI in native desktop mode where the picker works. |
| 33 | +- **Pyodide web shell**: build + copy the wheel first (`uv build` then |
| 34 | + `uv run python scripts/sync_web_wheel.py`, producing `web/dist/package.whl`), then serve |
| 35 | + with `uv run dylan-serve-web` (port 8000). It needs network access to the pinned Pyodide |
| 36 | + CDN (`cdn.jsdelivr.net/pyodide/v0.26.4`). Note: the bundled `micropip` rejects the wheel |
| 37 | + because it is served as `package.whl` (`InvalidWheelFilename: wrong number of parts`), so |
| 38 | + Python fails to boot in the browser — a pre-existing code-level issue, not an env/setup one. |
| 39 | +- Conventional Commits are required (see `docs/CONTRIBUTING.md`); the `commit-msg` hook in |
| 40 | + `scripts/git-hooks/` is optional and not enabled by default. |
0 commit comments