commit ff78dc5b1435f4092a5b80f717c680d769e2e6ef Author: Dasemu Date: Mon Oct 19 03:59:33 2026 +0200 feat: extract vnpipe pipeline from faust-vn Generic "classic novels to visual novels" pipeline extracted from faust-vn (source commit 6486ab1). The work-specific data (Faust text, annotations, assets, generated project) stays in faust-vn. Changes versus the source: --work defaults to the current directory, the renpy command writes to /vn, the Ren'Py SDK is located through RENPY_SDK, and tests only use fixtures. Co-Authored-By: Claude Opus 5.5 diff --git a/.claude/bootstrap-version b/.claude/bootstrap-version new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/.claude/bootstrap-version @@ -0,0 +1 @@ +2 diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..49da0e9 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,25 @@ +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Edit|Write", + "hooks": [ + { + "type": "command", + "command": "uv run --quiet ruff format --quiet src tests 2>/dev/null || true" + } + ] + } + ], + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "uv run --quiet ruff check --quiet . && uv run --quiet pytest -q -x 2>&1 | tail -3" + } + ] + } + ] + } +} diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..cbe3148 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +# Path to an unpacked Ren'Py SDK (tests that need it are skipped when unset and +# ./tools/renpy-sdk does not exist) +RENPY_SDK= diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1c86571 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + pull_request: + branches: [development] + push: + branches: [development, main] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - run: uv sync --locked + - name: Lint + run: uv run ruff check . && uv run ruff format --check . + - name: Test + run: uv run pytest -q diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..0d07108 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,65 @@ +name: Version bump + +on: + push: + branches: [development, main] + +permissions: + contents: write + +jobs: + bump: + if: github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, '[skip ci]') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Bump version + id: bump + run: | + set -e + CURRENT=$(cat VERSION) + MAJOR=$(echo "$CURRENT" | cut -d. -f1) + MINOR=$(echo "$CURRENT" | cut -d. -f2) + PATCH=$(echo "$CURRENT" | cut -d. -f3) + + if [ "${{ github.ref_name }}" = "development" ]; then + PATCH=$((PATCH + 1)) + elif [ "${{ github.ref_name }}" = "main" ]; then + # Did this push bring in commits that all come from development + # (i.e. an approved development -> main PR merge)? + PARENTS=$(git log -1 --pretty=%P HEAD) + PARENT_COUNT=$(echo "$PARENTS" | wc -w) + if [ "$PARENT_COUNT" -gt 1 ] && [ "${{ github.event.head_commit.message }}" != "" ] && git log -1 --pretty=%B | grep -qi "development"; then + MINOR=$((MINOR + 1)) + PATCH=0 + else + PATCH=$((PATCH + 1)) + fi + fi + + NEW_VERSION="$MAJOR.$MINOR.$PATCH" + echo "$NEW_VERSION" > VERSION + echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT" + + - name: Commit version bump + run: | + git add VERSION + git commit -m "chore(release): v${{ steps.bump.outputs.new_version }} [skip ci]" + git push origin HEAD:${{ github.ref_name }} + + - name: Merge main back into development + if: github.ref_name == 'main' + run: | + git fetch origin development + git checkout development + git merge --no-edit main + git push origin development diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37d29b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +__pycache__/ +*.pyc +.venv/ +.pytest_cache/ +.ruff_cache/ +dist/ +.env +# Local Ren'Py SDK and builds +/tools +build/ +# Local agent state (shared settings in .claude/settings.json are committed) +.claude/settings.local.json +.claude/worktrees/ +.mcp.json diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3ffd0aa --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,31 @@ +# CLAUDE.md + +`vnpipe`: work-agnostic pipeline that turns a public-domain text into a Ren'Py visual novel. +Works (texts) live in their own repos, e.g. `../Faust-VN`. + +## Rules +- Repo content in English; game text comes from the source and is never rewritten. +- Nothing work-specific in `src/vnpipe`: no hard-coded work ids, paths, characters or text. + Work details go in the work's `work.toml`. +- Every stage must be deterministic and idempotent; LLM/image outputs are cached by input hash. +- Data contracts live in `src/vnpipe/schemas/*.schema.json`; change schema + tests together. +- Tests use only `tests/fixtures/`; never depend on a real work's data. + +## Commands +- `uv sync` — install. `uv run pytest` — tests. `uv run ruff check . && uv run ruff format --check .` — lint. +- `uv run vnpipe --help` — CLI (`--work` defaults to the current directory). Stages: `fetch`, + `parse`, `annotate {chunk,status,prompt,merge}`, `assets {...}`, `renpy [--with-test]` + (default output `/vn`). +- Ren'Py SDK: set `RENPY_SDK` to the unpacked SDK directory (tests that need it are skipped + otherwise; fallback `tools/renpy-sdk`). See `docs/running.md`. +- In the sandbox: `export UV_CACHE_DIR=$TMPDIR/uv-cache`. + +## Branches and versions +- `development` is the integration branch; `main` receives reviewed merges from it. + Feature work branches off `development` (`feat/...`, `fix/...`). +- `VERSION` is bumped by `.github/workflows/version.yml` on push. Do not edit it by hand. +- CI (`.github/workflows/ci.yml`) runs ruff and pytest. + +## Layout +`src/vnpipe/` code, `schemas/`, `prompts/`, `renpy_templates/`; `tests/`; `docs/` +(see `docs/pipeline.md`). diff --git a/LESSONS.md b/LESSONS.md new file mode 100644 index 0000000..5a33ae9 --- /dev/null +++ b/LESSONS.md @@ -0,0 +1,18 @@ +# Lessons + +Recurring problems and what worked. Read before starting; add an entry when a mistake repeats. + +- The sandbox masks `.git/config` (and `.git/config.lock`); git commands that write config + (`git remote add`) must run outside the sandbox. +- `~/.cache/uv` is read-only inside the sandbox: export `UV_CACHE_DIR=$TMPDIR/uv-cache` + before any `uv` command. +- The sandbox mounts char-device placeholders (`.claude/`, `.mcp.json`, dotfiles) in the + working dir; they are gitignored, never `git add` them. +- `renpy lint` passing does not mean the game runs: a main menu once crashed on missing GUI + images. Always run the end-to-end playthrough (`vnpipe renpy --with-test` + `renpy.sh test`, + see docs/running.md). +- Ren'Py SDK commands write to `~/.renpy`: prefix them with `HOME=$TMPDIR/renpy-home` + inside the sandbox. `web_build` leaves `progressive_download.txt` in the project (gitignored). +- Small-model annotators label whole speeches with one emotion and lose stage presence + across chunks; fix with `work.toml` overrides (pinned cast, emotion ranges), not by + hand-editing annotated.json. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a2f1309 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# vnpipe + +A pipeline that turns public-domain classic novels and plays into Ren'Py visual novels: +Project Gutenberg text → parsed JSON → LLM-annotated JSON → Ren'Py project. + +`vnpipe` is work-agnostic. Everything specific to a text (source, scope, cast, staging) +lives in a *work repo* next to this one, in a `work.toml`. Example: `faust-vn`. + +## Quick start + +```bash +uv sync +uv run pytest -q +uv run vnpipe --help +``` + +In a work repo (a directory with `work.toml`), depend on this package and run +`uv run vnpipe parse`, `uv run vnpipe annotate ...`, `uv run vnpipe renpy`. +`--work DIR` selects another work directory (default: the current directory). + +## Docs + +- [Pipeline overview](docs/pipeline.md) +- [Annotation stage](docs/annotation.md) +- [Work configuration (`work.toml`)](docs/work-config.md) +- [Adaptation rules](docs/adaptation-rules.md) +- [Running, linting and building](docs/running.md) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/docs/adaptation-rules.md b/docs/adaptation-rules.md new file mode 100644 index 0000000..cbf9b03 --- /dev/null +++ b/docs/adaptation-rules.md @@ -0,0 +1,67 @@ +# Adaptation rules + +How a play becomes a visual novel. The text is never rewritten, abridged or reordered: +every verse line of the scoped text is shown, in order. What changes is *how* it is +shown. Generic rules are implemented in `src/vnpipe/renpy_gen.py`; work-specific choices +live in the work's `work.toml` (`[staging.*]`, `[[cues]]`, `[cast.*]`; see [work-config.md](work-config.md)). + +## Principle: show less, suggest more + +A VN tempts you to draw everything. Romantic verse drama works better when the image +sets the mood and the words carry the scene. So: + +1. **Draw people only when they converse.** Sprites appear in dialogue scenes. +2. **Never draw the ineffable.** Divine or supernatural presences are a lighting change, + a flash or a shake on the background, never a sprite. Their lines still carry a name + and colour. +3. **Lyric passages are full-screen text (NVL).** Poems and hymns are read over a + background, without a dialogue box or sprites. +4. **Choral or crowd presences belong to the background**, not drawn as several sprites. +5. **Stage directions are narration**, shown in italics by the narrator. Directions that + change the scene also trigger a cue (background, tint, transition). Cast lists under + a scene heading are not shown; they only inform who is on stage. +6. **One background per location**, plus variants only where the text itself changes + the light (a vision, an apparition, a change of mood). + +## Text rhythm + +- Each scene opens with a title card (scene heading, centred, over black). +- Verse is grouped into text boxes of at most **4 lines**, never crossing a stanza or a + speaker change. In NVL, a whole stanza (max 8 lines) is shown before the page clears. +- Split verse lines (a line shared between two speakers, printed deeply indented) are + shown as their own box so the exchange keeps its speed. + +## Sprites and expressions + +- The annotation gives each line one emotion from a fixed vocabulary: `neutral`, + `joyful`, `melancholic`, `solemn`, `ironic`, `angry`, `fearful`, `ecstatic`. +- `work.toml` maps that vocabulary to the 3–4 expressions each character actually has + (`[cast.].expressions`). A text box uses the emotion of its first line. +- Positions (`left`, `center`, `right`) come from the annotation, but the first + position a character gets in a scene is kept for the whole scene, so nobody jumps + around between boxes. +- Characters with `sprite = false` are never drawn, even if annotated as on stage. + +## Human judgment layer + +The annotation is an LLM's first guess; `work.toml` can override it, generically: + +- `[staging.].cast = { = "" }` pins characters (sprite = true) on stage + at fixed positions for the whole scene, overriding the annotation's `on_stage`. +- A cue's `move = { = "" }` slides a visible sprite to another position. +- `[[overrides]] { from, to, emotion }` forces the emotion of an inclusive line range + (same scene) before expression mapping. + +Stage-direction lines never change who is on stage (they keep the previous box's +`on_stage`). Unknown line ids, characters, positions or emotions are errors at generation. + +## Transitions + +- `dissolve` between expressions and on sprite entry/exit, `fade` between scenes, + `slow` (2 s dissolve) for light changes, `flash` for supernatural apparitions. + +## Music + +Every line carries an optional music mood (`contemplative`, `comic`, `sacred`, +`ominous`, `mystical`, `none`). The prototype ships without audio; the generator emits +`play music` only when `game/audio/.ogg` exists, so adding files is enough. diff --git a/docs/annotation.md b/docs/annotation.md new file mode 100644 index 0000000..640a61f --- /dev/null +++ b/docs/annotation.md @@ -0,0 +1,70 @@ +# Annotation stage + +Turns `data/parsed.json` into `data/annotated.json`: every parsed line gets an `ann` block +(emotion, who is on stage and where, music). Judgement calls are made by LLM sub-agents; +`vnpipe annotate` only prepares their input, checks their output and merges it. + +``` +parsed.json ──chunk──▶ annotations/chunks/.json (annotator input) + sub-agent ──────────▶ annotations/cache/.json (annotator output) + ──merge──▶ data/annotated.json +``` + +## Chunks + +- Id `_cNN`. A chunk never crosses a scene and holds at most 60 lines. Splits + prefer speech boundaries, then stanza boundaries, and only then cut mid-stanza. +- `input_sha256` is the SHA-256 of the canonical JSON of the chunk without that field. It + includes `prompt_version` (SHA-256 of `src/vnpipe/prompts/annotate.md`), so editing the + prompt, the text, `work.toml` scenes/cast or the schema enums invalidates the cache. +- Contents: `scene`, `allowed` (speakers, characters, locations, emotions, positions, + music), `context_before` (up to 6 preceding lines, read-only) and `lines`, each with a + `defaults` block that is deterministic and must be copied verbatim: + - verse with a speaker: `dialogue` / that speaker; + - verse without speaker: `narration` / `[work].lyric_voice` from `work.toml`; + - direction and cast list: `stage_direction` / `narrator`; + - `location` and `time_of_day` from the scene config. +- `allowed.characters` are the cast ids except `narrator` and the lyric voice. Cast members + with `sprite = false` are valid on stage; the Ren'Py generator filters them. + +## Cache + +One file per chunk, `annotation.schema.json`: `chunk_id`, `input_sha256` (copied from the +chunk) and `annotations` (one per line, in order). Cache files are never deleted by the +tool; a cache whose hash no longer matches is simply `stale` and gets redone. + +## Commands + +| Command | Effect | +|---|---| +| `vnpipe annotate chunk` | Write chunk files, remove chunk files that no longer exist. | +| `vnpipe annotate status [id ...]` | Per chunk `ok`, `missing`, `stale` or `invalid` (with reason) plus a summary. Always exits 0. | +| `vnpipe annotate prompt ` | Print the full annotator instructions for a chunk (absolute paths filled in). | +| `vnpipe annotate merge [--fallback]` | Validate every cache and write `data/annotated.json`. | + +A cache is `ok` when it validates against the schema, carries the chunk's hash, covers exactly +the chunk's line ids in order, keeps `speaker`/`kind`/`location`/`time_of_day` equal to the +defaults, and uses only allowed characters (each at most once per line). `stale` means the +hash differs; everything else wrong is `invalid`. + +`merge` without `--fallback` prints every problem and exits 1 without writing anything. With +`--fallback`, each non-ok chunk gets deterministic annotations (defaults, emotion `neutral`, +music `null`, on stage: the speakers seen so far in the scene who have sprites, placed +left/right/center in order of appearance), a warning is printed, and the chunk ids are listed +in `fallback_chunks`. Output is byte-identical across runs. + +## Running the annotators + +1. `vnpipe annotate chunk` +2. For each chunk that is not `ok` in `vnpipe annotate status`, start one cheap-model + sub-agent whose whole instruction is the output of `vnpipe annotate prompt `. + Chunks are independent, so run them in parallel. +3. `vnpipe annotate status` until everything is `ok`; relaunch only the failing chunks. +4. `vnpipe annotate merge`. + +## Resumability + +Re-running is safe: only `missing`, `stale` and `invalid` chunks need work. After changing the +prompt every chunk becomes stale; after changing the text only the affected chunks do. Always +run `vnpipe annotate chunk` after changing `parsed.json`, `work.toml` or the prompt, before +starting annotators (`status` warns when chunk files are out of date). diff --git a/docs/pipeline.md b/docs/pipeline.md new file mode 100644 index 0000000..8f1af47 --- /dev/null +++ b/docs/pipeline.md @@ -0,0 +1,49 @@ +# Pipeline overview + +`vnpipe` turns a public-domain text from Project Gutenberg into a Ren'Py visual novel. +A *work* (one text) is a directory with a `work.toml` (see [work-config.md](work-config.md)); +all paths below are relative to the work root. Adding a work needs a new `work.toml` plus art, +no code changes. + +``` +Gutenberg .txt ──fetch──▶ data/raw/ (cached, gitignored) + ──parse──▶ data/play.txt (header/footer stripped, scope cut) + data/parsed.json (scenes, speakers, verse lines, directions) + ──chunk──▶ annotations/chunks/*.json (LLM work units) + LLM sub-agents ─────▶ annotations/cache/*.json (one file per chunk, keyed by hash) + ──merge──▶ data/annotated.json (schema-validated, complete) +art (any generator) ──▶ assets/assets.json + images (manifest, sha256, status) + ──renpy──▶ vn/ (generated Ren'Py project) +``` + +Every stage is a `vnpipe` subcommand, deterministic given its inputs, and idempotent +(re-running produces byte-identical output). The only non-deterministic steps, LLM annotation +and image generation, write to caches keyed by content hash, so they are resumable and never +redone unless their input changes. + +## Stages + +| Stage | Commands | Module | +|---|---|---| +| Text | `fetch`, `parse` | `text.py` | +| Annotation | `annotate chunk/status/prompt/merge` ([details](annotation.md)) | `annotate.py` | +| Assets | `assets prompt/import/process/status/placeholders/sheet` | `assets.py` | +| Ren'Py | `renpy [--from-parsed] [--with-test] [--out DIR]` | `renpy_gen.py` | + +`--work DIR` (before the subcommand) selects the work root; default is the current directory. + +## Source layout + +| Path | Purpose | +|---|---| +| `src/vnpipe/` | Work-agnostic pipeline code | +| `src/vnpipe/schemas/` | JSON Schemas: parsed text, annotation, annotated text, asset manifest | +| `src/vnpipe/prompts/annotate.md` | Annotator instructions (its hash versions the cache) | +| `src/vnpipe/renpy_templates/` | Default Ren'Py GUI, screens and fonts | +| `tests/` | Unit tests on `tests/fixtures/` (a mini work); the Ren'Py SDK tests need `RENPY_SDK` | + +## Asset manifest + +`assets/assets.json` lists backgrounds and sprites with a status (`processed`, `approved`, +`placeholder`, ...). Anything missing or unusable is replaced by a generated placeholder, so +the game always runs. diff --git a/docs/running.md b/docs/running.md new file mode 100644 index 0000000..d09a28b --- /dev/null +++ b/docs/running.md @@ -0,0 +1,101 @@ +# Running, linting and building the game + +The Ren'Py project in `/vn/` is generated; never edit it by hand. Commands below run +from the work root (the directory with `work.toml`); `RENPY_SDK` is the SDK directory +(e.g. `export RENPY_SDK=/path/to/renpy-sdk`). + +## 1. Ren'Py SDK + +The SDK is not committed. Install **Ren'Py 8.5.3** (SDK +archive from , `renpy-8.5.3-sdk.tar.bz2`) so that +`$RENPY_SDK/renpy.sh` exists: + +```sh +tar -xjf renpy-8.5.3-sdk.tar.bz2 && mv renpy-8.5.3-sdk "$RENPY_SDK" +``` + +The SDK already contains the web runtime (`$RENPY_SDK/web`) and the Linux, Windows +and macOS distribution templates. Inside the sandbox set `HOME=$TMPDIR/renpy-home` for +SDK commands, since Ren'Py writes to `~/.renpy`. + +## 2. Regenerate the project + +```sh +uv run vnpipe renpy # from data/annotated.json +uv run vnpipe renpy --from-parsed # trivial annotations built from parsed.json +uv run vnpipe renpy --out some/dir # default output: /vn +``` + +Generation is deterministic: running it twice gives identical files (no timestamps). +It rewrites `game/{options,gui,screens,support,characters,images,script}.rpy`, +`game/gui/`, `game/fonts/` and `game/images/`; anything else (for example `game/audio/`) +is left alone. Music only appears in the script for moods that have a matching +`game/audio/.ogg`, so drop files there and regenerate. + +Images come from `assets/assets.json` (statuses `processed`, `approved`, +`placeholder`); anything missing or unusable is replaced by a generated placeholder so +the game always runs. + +### GUI template and licences + +`src/vnpipe/renpy_templates/` (in this repo) holds the default Ren'Py GUI (`gui.rpy`, `screens.rpy`, +`options.rpy` and `gui/*.png`). It was generated once with the SDK's own command and then +edited minimally (dark palette, ivory text, accent `#c9a25b`, Roboto Slab font, NVL +tweaks, `@@TOKEN@@` placeholders for title/build name/about text/menu background): + +```sh +"$RENPY_SDK"/renpy.sh $RENPY_SDK/launcher generate_gui OUT --width 1920 --height 1080 \ + --accent '#c9a25b' --boring '#14110e' --template "$RENPY_SDK/gui" --start +``` + +These files are part of Ren'Py (MIT licence, Tom Rothamel and contributors). The font +`game/fonts/RobotoSlab-*.ttf` is Roboto Slab (Apache 2.0), taken from the SDK +documentation assets. + +## 3. Lint + +```sh +HOME=$TMPDIR/renpy-home "$RENPY_SDK"/renpy.sh vn lint +``` + +The expected result is a statistics block with no warnings above it. + +## 3b. End-to-end playthrough test + +Lint does not catch runtime errors (missing GUI images, display bugs). `--with-test` also +writes `game/e2e_test.rpy`, a Ren'Py `testcase` that clicks "Start", advances through the +whole game up to the final card (`label the_end`) and back to the main menu, failing on any +exception (`traceback.txt`). Use a throw-away output directory so the test file never ends +up in `vn/` or in a build: + +```sh +uv run vnpipe renpy --with-test --out build/e2e +HOME=$TMPDIR/renpy-home SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy RENPY_RENDERER=sw \ + "$RENPY_SDK"/renpy.sh build/e2e test +``` + +The headless run needs the software renderer (`RENPY_RENDERER=sw`, no GL under the dummy +video driver); matrix tints are therefore not rendered but all game logic is exercised. +`tests/test_renpy_gen.py` runs this for the fixture work when the SDK exists (set +`RENPY_SDK`; slow: about a minute). On a desktop with a display, drop the three variables. + +## 4. Play + +```sh +"$RENPY_SDK"/renpy.sh vn +``` + +## 5. Builds (output under `build/`, gitignored) + +```sh +# Web (HTML5) +"$RENPY_SDK"/renpy.sh $RENPY_SDK/launcher web_build vn --destination build/web +python3 -m http.server -d build/web 8000 # then open http://localhost:8000 + +# Linux desktop +"$RENPY_SDK"/renpy.sh $RENPY_SDK/launcher distribute vn --package linux --destination build/dist +``` + +`--package` also accepts `win` and `mac`; omit it to build every package. The web build +also leaves a `build/web.zip` next to the folder. A web build writes +`vn/progressive_download.txt`; delete it (it is not part of the generated project). diff --git a/docs/work-config.md b/docs/work-config.md new file mode 100644 index 0000000..65d5672 --- /dev/null +++ b/docs/work-config.md @@ -0,0 +1,24 @@ +# Work configuration (`work.toml`) + +A work is a directory containing `work.toml`, plus the folders the pipeline fills: +`data/`, `annotations/`, `assets/` and the generated `vn/`. A complete example is the +`faust-vn` repo. Keys: + +| Table | Keys | +|---|---| +| `[work]` | `id`, `title`, `subtitle`, `author`, `translator`, `language` (`es`/`en`, used for the About text), `lyric_voice` (cast id for verse nobody speaks; default `poet_voice`), `end_text`, `menu_bg` (background asset id for the main menu; default: first staged `bg`). | +| `[source]` | `gutenberg_id`, `url`, `raw_file` (cache path, relative to the work root, gitignored). | +| `[scope]` | `start_marker`, `end_marker` (whole stripped lines), `end_occurrence` (1-based, searched after the start; the end marker itself is excluded). | +| `[speakers]` | Speaker heading as printed (upper case) → cast id. An unknown speaker is a parse error. | +| `[[scenes]]` | `heading` (as printed), `id`, `location`, `time_of_day`. | +| `[cast.]` | `name` (shown in the dialogue box), `color`, `sprite` (default `true`; `false` = never drawn), `expressions` (annotation emotion → sprite expression; needs `neutral`). | +| `[staging.]` | `bg` (background shown after the title card), `mode` (`adv` or `nvl`), `cast = { = "left\|center\|right" }` pins sprite characters for the whole scene. | +| `[[cues]]` | `at` (line id; fires right before it) plus any of `bg`, `transition` (`dissolve`, `fade`, `flash`, `slow`), `tint` (`none`, `dark`, `red`), `mode`, `hide_all`, `shake`, `move = { = "" }`. | +| `[[overrides]]` | `from`, `to` (inclusive line ids in one scene), `emotion`: forces the emotion before expression mapping. | + +Emotions: `neutral`, `joyful`, `melancholic`, `solemn`, `ironic`, `angry`, `fearful`, `ecstatic`. +Unknown line ids, characters, positions or emotions are errors at generation. See +[adaptation-rules.md](adaptation-rules.md) for how these choices are meant to be used. + +Asset ids (`bg_*`, sprite names) are defined in the work's `assets/assets.json`; a missing +image is replaced by a placeholder. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..62f86e2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,37 @@ +[project] +name = "vnpipe" +version = "0.1.0" +description = "Public-domain play text -> annotated JSON -> Ren'Py visual novel pipeline" +readme = "README.md" +requires-python = ">=3.12" +license = "MIT" +dependencies = [ + "jsonschema>=4.23", + "pillow>=11.0", +] + +[project.scripts] +vnpipe = "vnpipe.cli:main" + +[dependency-groups] +dev = [ + "pytest>=8.3", + "ruff>=0.8", +] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["src/vnpipe"] + +[tool.ruff] +line-length = 100 +target-version = "py312" + +[tool.ruff.lint] +select = ["E", "F", "W", "I", "B", "UP", "SIM"] + +[tool.pytest.ini_options] +testpaths = ["tests"] diff --git a/src/vnpipe/__init__.py b/src/vnpipe/__init__.py new file mode 100644 index 0000000..aabafb9 --- /dev/null +++ b/src/vnpipe/__init__.py @@ -0,0 +1,6 @@ +"""vnpipe: public-domain play text -> annotated JSON -> Ren'Py visual novel.""" + +from pathlib import Path + +PACKAGE_DIR = Path(__file__).resolve().parent +SCHEMA_DIR = PACKAGE_DIR / "schemas" diff --git a/src/vnpipe/annotate.py b/src/vnpipe/annotate.py new file mode 100644 index 0000000..1c92c11 --- /dev/null +++ b/src/vnpipe/annotate.py @@ -0,0 +1,497 @@ +"""Annotation stage: chunk parsed.json for LLM annotators, track the cache and merge. + +LLM sub-agents (run by the orchestrator) read ``annotations/chunks/.json`` and write +``annotations/cache/.json``. This module only prepares chunks, checks cache state and +merges; everything here is deterministic and idempotent. +""" + +import argparse +import hashlib +import json +import sys +from dataclasses import dataclass, field +from itertools import groupby +from pathlib import Path +from typing import Any + +from vnpipe import PACKAGE_DIR, SCHEMA_DIR +from vnpipe.config import Work, load_work +from vnpipe.schema import SchemaError, validate + +MAX_CHUNK_LINES = 60 +CONTEXT_LINES = 6 +NARRATOR = "narrator" +PROMPT_PATH = PACKAGE_DIR / "prompts" / "annotate.md" +PRESET_POSITIONS = ("left", "right", "center") # order used by the fallback +DEFAULT_FIELDS = ("speaker", "kind", "location", "time_of_day") +ANN_ORDER = ("speaker", "kind", "emotion", "location", "time_of_day", "on_stage", "music") + +OK, MISSING, STALE, INVALID = "ok", "missing", "stale", "invalid" + + +class AnnotateError(ValueError): + """Inconsistent input (parsed.json against work.toml).""" + + +# --------------------------------------------------------------------------- helpers + + +def dumps(data: Any) -> str: + return json.dumps(data, ensure_ascii=False, indent=2) + "\n" + + +def _write(path: Path, text: str) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text, encoding="utf-8", newline="\n") + + +def canonical_sha256(data: Any) -> str: + blob = json.dumps(data, ensure_ascii=False, sort_keys=True, separators=(",", ":")) + return hashlib.sha256(blob.encode("utf-8")).hexdigest() + + +def prompt_version() -> str: + return hashlib.sha256(PROMPT_PATH.read_bytes()).hexdigest() + + +def chunks_dir(work: Work) -> Path: + return work.path("annotations/chunks") + + +def cache_dir(work: Work) -> Path: + return work.path("annotations/cache") + + +def _schema_enums() -> dict[str, list[str]]: + defs = json.loads((SCHEMA_DIR / "annotation.schema.json").read_text(encoding="utf-8"))["$defs"] + props = defs["annotation"]["properties"] + return { + "emotions": list(props["emotion"]["enum"]), + "positions": list(defs["position"]["enum"]), + "music": [m for m in props["music"]["enum"] if m is not None], + } + + +def lyric_voice(work: Work) -> str: + return work.data["work"].get("lyric_voice", NARRATOR) + + +def allowed_for(work: Work) -> dict[str, list[str]]: + """Vocabularies an annotation may use, derived from work.toml and the schema.""" + cast = list(work.cast) + voice = lyric_voice(work) + if NARRATOR not in cast: + cast.insert(0, NARRATOR) + if voice not in cast: + raise AnnotateError(f"work.lyric_voice {voice!r} is not a cast id") + locations: list[str] = [] + for scene in work.scenes: + if scene["location"] not in locations: + locations.append(scene["location"]) + return { + "speakers": cast, + "characters": [c for c in cast if c not in (NARRATOR, voice)], + "locations": locations, + **_schema_enums(), + } + + +def has_sprite(work: Work, character: str) -> bool: + return bool(work.cast.get(character, {}).get("sprite", True)) + + +# --------------------------------------------------------------------------- chunking + + +def _pack(lines: list[dict], keys: tuple[str, ...], limit: int) -> list[list[dict]]: + """Split ``lines`` into pieces of at most ``limit``, preferring boundaries of ``keys[0]``, + then ``keys[1]`` ..., and finally cutting anywhere.""" + if len(lines) <= limit: + return [lines] + if not keys: + return [lines[i : i + limit] for i in range(0, len(lines), limit)] + pieces: list[list[dict]] = [] + current: list[dict] = [] + for _, group in groupby(lines, key=lambda ln: ln[keys[0]]): + block = list(group) + if len(block) > limit: + if current: + pieces.append(current) + current = [] + pieces.extend(_pack(block, keys[1:], limit)) + elif len(current) + len(block) > limit: + pieces.append(current) + current = block + else: + current += block + if current: + pieces.append(current) + return pieces + + +def _line_defaults(work: Work, scene_cfg: dict, line: dict, voice: str) -> dict[str, str]: + kind, speaker = line["kind"], line["speaker"] + if kind == "verse" and speaker: + ann_kind, ann_speaker = "dialogue", speaker + elif kind == "verse": + ann_kind, ann_speaker = "narration", voice + else: + ann_kind, ann_speaker = "stage_direction", NARRATOR + if ann_speaker not in work.cast and ann_speaker != NARRATOR: + raise AnnotateError(f"line {line['id']}: speaker {ann_speaker!r} is not in work.toml cast") + return { + "speaker": ann_speaker, + "kind": ann_kind, + "location": scene_cfg["location"], + "time_of_day": scene_cfg["time_of_day"], + } + + +def build_chunks(work: Work, parsed: dict[str, Any]) -> list[dict[str, Any]]: + """Deterministically split parsed scenes into annotation chunks (with input hashes).""" + scene_cfgs = {s["id"]: s for s in work.scenes} + allowed = allowed_for(work) + voice = lyric_voice(work) + version = prompt_version() + chunks: list[dict[str, Any]] = [] + for scene in parsed["scenes"]: + cfg = scene_cfgs.get(scene["id"]) + if cfg is None: + raise AnnotateError(f"scene {scene['id']!r} is not configured in work.toml") + lines = scene["lines"] + start = 0 + for number, piece in enumerate(_pack(lines, ("speech", "stanza"), MAX_CHUNK_LINES), 1): + before = [ + { + "id": ln["id"], + "speaker": _line_defaults(work, cfg, ln, voice)["speaker"], + "text": ln["text"], + } + for ln in lines[max(0, start - CONTEXT_LINES) : start] + ] + start += len(piece) + chunk: dict[str, Any] = { + "chunk_id": f"{scene['id']}_c{number:02d}", + "prompt_version": version, + "scene": { + "id": scene["id"], + "heading": scene["heading"], + "location": cfg["location"], + "time_of_day": cfg["time_of_day"], + }, + "allowed": allowed, + "context_before": before, + "lines": [ + { + "id": ln["id"], + "kind": ln["kind"], + "speaker": ln["speaker"], + "speaker_note": ln["speaker_note"], + "text": ln["text"], + "defaults": _line_defaults(work, cfg, ln, voice), + } + for ln in piece + ], + } + chunk["input_sha256"] = canonical_sha256(chunk) + chunks.append(chunk) + return chunks + + +def load_parsed(work: Work) -> tuple[dict[str, Any], bytes]: + path = work.path("data/parsed.json") + if not path.is_file(): + raise SystemExit(f"{path} missing; run `vnpipe parse` first") + raw = path.read_bytes() + parsed = json.loads(raw) + validate(parsed, "parsed") + return parsed, raw + + +def write_chunks(work: Work, chunks: list[dict[str, Any]]) -> list[Path]: + """Write chunk files and remove stale ones; returns the removed paths.""" + out = chunks_dir(work) + out.mkdir(parents=True, exist_ok=True) + keep = {f"{c['chunk_id']}.json" for c in chunks} + for chunk in chunks: + _write(out / f"{chunk['chunk_id']}.json", dumps(chunk)) + removed = sorted(p for p in out.glob("*.json") if p.name not in keep) + for path in removed: + path.unlink() + return removed + + +# --------------------------------------------------------------------------- checking + + +def _schema_reason(exc: SchemaError) -> str: + return "; ".join(s.strip() for s in str(exc).splitlines()[1:4]) + + +def check_cache(work: Work, chunk: dict[str, Any]) -> tuple[str, list[str]]: + """Classify the cache file of ``chunk``; returns (state, problems).""" + path = cache_dir(work) / f"{chunk['chunk_id']}.json" + if not path.is_file(): + return MISSING, ["no cache file"] + try: + data = json.loads(path.read_text(encoding="utf-8")) + except (OSError, ValueError) as exc: + return INVALID, [f"unreadable JSON: {exc}"] + try: + validate(data, "annotation") + except SchemaError as exc: + return INVALID, [f"schema: {_schema_reason(exc)}"] + if data["chunk_id"] != chunk["chunk_id"]: + return INVALID, [f"chunk_id is {data['chunk_id']!r}"] + if data["input_sha256"] != chunk["input_sha256"]: + return STALE, ["input_sha256 does not match the current chunk"] + problems = _semantic_problems(chunk, data["annotations"]) + return (INVALID, problems) if problems else (OK, []) + + +def _semantic_problems(chunk: dict[str, Any], annotations: list[dict]) -> list[str]: + problems: list[str] = [] + expected = [ln["id"] for ln in chunk["lines"]] + got = [a["id"] for a in annotations] + if got != expected: + missing = [i for i in expected if i not in got] + extra = [i for i in got if i not in expected] + dupes = sorted({i for i in got if got.count(i) > 1}) + if missing: + problems.append( + f"missing lines: {', '.join(missing[:5])}{' ...' if len(missing) > 5 else ''}" + ) + if extra: + problems.append(f"unknown line ids: {', '.join(extra[:5])}") + if dupes: + problems.append(f"duplicate line ids: {', '.join(dupes[:5])}") + if not (missing or extra or dupes): + problems.append("lines are not in chunk order") + return problems + characters = set(chunk["allowed"]["characters"]) + for line, ann in zip(chunk["lines"], annotations, strict=True): + for key in DEFAULT_FIELDS: + if ann[key] != line["defaults"][key]: + problems.append( + f"{line['id']}: {key} is {ann[key]!r}, expected {line['defaults'][key]!r}" + ) + seen: set[str] = set() + for slot in ann["on_stage"]: + who = slot["character"] + if who not in characters: + problems.append(f"{line['id']}: unknown character {who!r} on stage") + elif who in seen: + problems.append(f"{line['id']}: {who!r} on stage more than once") + seen.add(who) + return problems + + +# --------------------------------------------------------------------------- fallback + + +def fallback_annotations(work: Work, scene_chunks: list[dict[str, Any]]) -> dict[str, list[dict]]: + """Deterministic annotations for every chunk of one scene, keyed by chunk id.""" + seen: list[str] = [] # speakers with a sprite, in order of appearance in the scene + result: dict[str, list[dict]] = {} + for chunk in scene_chunks: + anns = [] + for line in chunk["lines"]: + who = line["defaults"]["speaker"] + if ( + who in chunk["allowed"]["characters"] + and has_sprite(work, who) + and who not in seen + and len(seen) < len(PRESET_POSITIONS) + ): + seen.append(who) + anns.append( + { + "id": line["id"], + **line["defaults"], + "emotion": "neutral", + "on_stage": [ + {"character": c, "position": PRESET_POSITIONS[i]} + for i, c in enumerate(seen) + ], + "music": None, + } + ) + result[chunk["chunk_id"]] = anns + return result + + +def _normalise(ann: dict[str, Any]) -> dict[str, Any]: + out = {key: ann.get(key) for key in ANN_ORDER} + out["on_stage"] = [ + {"character": s["character"], "position": s["position"]} for s in ann["on_stage"] + ] + return out + + +# --------------------------------------------------------------------------- merge + + +@dataclass +class MergeResult: + document: dict[str, Any] | None = None + problems: list[str] = field(default_factory=list) + warnings: list[str] = field(default_factory=list) + + +def merge(work: Work, fallback: bool = False) -> MergeResult: + parsed, raw = load_parsed(work) + chunks = build_chunks(work, parsed) + result = MergeResult() + states = {c["chunk_id"]: check_cache(work, c) for c in chunks} + bad = [c["chunk_id"] for c in chunks if states[c["chunk_id"]][0] != OK] + if bad and not fallback: + for cid in bad: + state, why = states[cid] + result.problems.append(f"{cid}: {state}: {'; '.join(why)}") + return result + + by_scene: dict[str, list[dict]] = {} + for chunk in chunks: + by_scene.setdefault(chunk["scene"]["id"], []).append(chunk) + anns: dict[str, dict[str, Any]] = {} # line id -> normalised annotation + for scene_chunks in by_scene.values(): + fb = fallback_annotations(work, scene_chunks) if bad else {} + for chunk in scene_chunks: + cid = chunk["chunk_id"] + if states[cid][0] == OK: + data = json.loads((cache_dir(work) / f"{cid}.json").read_text(encoding="utf-8")) + items = data["annotations"] + else: + items = fb[cid] + state, why = states[cid] + result.warnings.append(f"{cid}: {state} ({'; '.join(why)}), using fallback") + for item in items: + anns[item["id"]] = _normalise(item) + + doc = { + "work": parsed["work"], + "parsed_sha256": hashlib.sha256(raw).hexdigest(), + "fallback_chunks": bad, + "scenes": [ + { + "id": scene["id"], + "heading": scene["heading"], + "lines": [{**ln, "ann": anns[ln["id"]]} for ln in scene["lines"]], + } + for scene in parsed["scenes"] + ], + } + validate(doc, "annotated") + result.document = doc + return result + + +# --------------------------------------------------------------------------- commands + + +def cmd_chunk(args: argparse.Namespace) -> int: + work = load_work(args.work) + parsed, _ = load_parsed(work) + chunks = build_chunks(work, parsed) + removed = write_chunks(work, chunks) + for chunk in chunks: + print(f"chunk: {chunk['chunk_id']}: {len(chunk['lines'])} lines") + for path in removed: + print(f"chunk: removed stale {path.name}") + return 0 + + +def cmd_status(args: argparse.Namespace) -> int: + work = load_work(args.work) + parsed, _ = load_parsed(work) + chunks = build_chunks(work, parsed) + wanted = set(args.chunk_ids) + unknown = wanted - {c["chunk_id"] for c in chunks} + if unknown: + print(f"status: unknown chunk id(s): {', '.join(sorted(unknown))}", file=sys.stderr) + return 0 + counts: dict[str, int] = {} + for chunk in chunks: + if wanted and chunk["chunk_id"] not in wanted: + continue + state, why = check_cache(work, chunk) + counts[state] = counts.get(state, 0) + 1 + suffix = f" ({'; '.join(why)})" if why and state != MISSING else "" + print(f"{chunk['chunk_id']}: {state}{suffix}") + stale_files = {p.name for p in chunks_dir(work).glob("*.json")} ^ { + f"{c['chunk_id']}.json" for c in chunks + } + on_disk_differs = bool(stale_files) or any( + _read_json(chunks_dir(work) / f"{c['chunk_id']}.json") != c for c in chunks + ) + if on_disk_differs: + print("note: chunk files are out of date; run `vnpipe annotate chunk`") + summary = ", ".join(f"{counts.get(s, 0)} {s}" for s in (OK, MISSING, STALE, INVALID)) + print(f"summary: {sum(counts.values())} chunks: {summary}") + return 0 + + +def _read_json(path: Path) -> Any: + try: + return json.loads(path.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + + +def cmd_merge(args: argparse.Namespace) -> int: + work = load_work(args.work) + result = merge(work, fallback=args.fallback) + if result.document is None: + print("merge: refusing to merge, problems found:", file=sys.stderr) + for problem in result.problems: + print(f" {problem}", file=sys.stderr) + print("merge: fix them or use --fallback; nothing written", file=sys.stderr) + return 1 + for warning in result.warnings: + print(f"warning: {warning}", file=sys.stderr) + out = work.path("data/annotated.json") + _write(out, dumps(result.document)) + n_lines = sum(len(s["lines"]) for s in result.document["scenes"]) + n_fb = len(result.document["fallback_chunks"]) + print(f"merge: wrote {out} ({n_lines} lines, {n_fb} fallback chunks)") + return 0 + + +def render_prompt(work: Work, chunk_id: str) -> str: + parsed, _ = load_parsed(work) + ids = {c["chunk_id"] for c in build_chunks(work, parsed)} + if chunk_id not in ids: + raise SystemExit(f"prompt: unknown chunk id {chunk_id!r}") + repo = PACKAGE_DIR.parent.parent + values = { + "chunk_id": chunk_id, + "chunk_path": str((chunks_dir(work) / f"{chunk_id}.json").resolve()), + "cache_path": str((cache_dir(work) / f"{chunk_id}.json").resolve()), + "status_cmd": f"{repo / '.venv/bin/vnpipe'} --work {work.root.resolve()} annotate status", + } + text = PROMPT_PATH.read_text(encoding="utf-8") + for key, value in values.items(): + text = text.replace("{{" + key + "}}", value) + return text + + +def cmd_prompt(args: argparse.Namespace) -> int: + sys.stdout.write(render_prompt(load_work(args.work), args.chunk_id)) + return 0 + + +def register(subparsers: argparse._SubParsersAction) -> None: + annotate = subparsers.add_parser("annotate", help="LLM annotation stage tooling") + sub = annotate.add_subparsers(dest="annotate_command", required=True) + sub.add_parser("chunk", help="Write annotation chunks").set_defaults(handler=cmd_chunk) + status = sub.add_parser("status", help="Show cache state per chunk") + status.add_argument("chunk_ids", nargs="*", help="Limit to these chunks") + status.set_defaults(handler=cmd_status) + merge_cmd = sub.add_parser("merge", help="Validate caches and write data/annotated.json") + merge_cmd.add_argument( + "--fallback", action="store_true", help="Fill non-ok chunks with deterministic defaults" + ) + merge_cmd.set_defaults(handler=cmd_merge) + prompt = sub.add_parser("prompt", help="Print the annotator instructions for one chunk") + prompt.add_argument("chunk_id") + prompt.set_defaults(handler=cmd_prompt) diff --git a/src/vnpipe/assets.py b/src/vnpipe/assets.py new file mode 100644 index 0000000..da6d22f --- /dev/null +++ b/src/vnpipe/assets.py @@ -0,0 +1,307 @@ +"""Asset manifest management: import generated images, key out sprite backgrounds, +fall back to placeholders, and build contact sheets for visual review. + +The manifest (``/assets/assets.json``) is the single source of truth for every +image: prompt, origin, hash and review status. Image generation itself happens +outside this module (an MCP tool driven by an agent); ``import`` ingests its result. +""" + +import argparse +import base64 +import hashlib +import json +from pathlib import Path +from typing import Any + +from PIL import Image, ImageDraw, ImageFont, ImageOps + +from vnpipe.config import load_work +from vnpipe.schema import validate + +MANIFEST = "assets/assets.json" +BG_SIZE = (1920, 1080) +SPRITE_HEIGHT = 1000 +USABLE = {"processed", "approved"} + +# Chroma key thresholds on "greenness" = g - max(r, b). +KEY_FULL = 60 # at or above: fully transparent +KEY_NONE = 20 # at or below: fully opaque + + +def sha256_file(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def load_manifest(work_root: Path) -> dict[str, Any]: + data = json.loads((work_root / MANIFEST).read_text(encoding="utf-8")) + validate(data, "manifest") + return data + + +def save_manifest(work_root: Path, data: dict[str, Any]) -> None: + validate(data, "manifest") + text = json.dumps(data, ensure_ascii=False, indent=2) + "\n" + (work_root / MANIFEST).write_text(text, encoding="utf-8") + + +def find_asset(manifest: dict[str, Any], asset_id: str) -> dict[str, Any]: + for asset in manifest["assets"]: + if asset["id"] == asset_id: + return asset + raise KeyError(f"unknown asset id: {asset_id}") + + +def full_prompt(manifest: dict[str, Any], asset: dict[str, Any]) -> str: + """Prompt actually sent to the generator: base + kind template + asset prompt.""" + kind = "variant" if asset.get("reference") and asset["kind"] == "sprite" else asset["kind"] + template = manifest["templates"][kind] + return "\n\n".join(p for p in (manifest["base_prompt"], template, asset["prompt"]) if p) + + +# --- import ----------------------------------------------------------------- + + +def load_tool_result(path: Path) -> dict[str, Any]: + """Read a stored query_tasks result (raw object or [{"type": "text", "text": ...}]).""" + data = json.loads(path.read_text(encoding="utf-8")) + if isinstance(data, list) and data and isinstance(data[0], dict) and "text" in data[0]: + data = json.loads(data[0]["text"]) + if isinstance(data, str): + data = json.loads(data) + return data + + +def decode_output(result: dict[str, Any], index: int = 0) -> bytes: + if result.get("status") != "COMPLETED": + raise ValueError(f"generation not completed: status={result.get('status')}") + outputs = [o for o in result.get("outputs", []) if o.get("base64")] + if len(outputs) <= index: + raise ValueError("no base64 output; query again with include_base64=true") + out = outputs[index] + raw = base64.b64decode(out["base64"]) + expected = out.get("sha256") + if expected and hashlib.sha256(raw).hexdigest() != expected: + raise ValueError("sha256 mismatch between decoded image and the MCP report") + return raw + + +def import_image(work_root: Path, asset_id: str, raw: bytes, generation_id: str | None) -> Path: + manifest = load_manifest(work_root) + asset = find_asset(manifest, asset_id) + raw_rel = f"raw/{asset_id}.png" + raw_path = work_root / "assets" / raw_rel + raw_path.parent.mkdir(parents=True, exist_ok=True) + with Image.open(_bytes_io(raw)) as img: + img.convert("RGB").save(raw_path, "PNG") + asset.update(raw_file=raw_rel, generation_id=generation_id, status="generated") + asset.setdefault("source", "chatgpt-web") + save_manifest(work_root, manifest) + return raw_path + + +def _bytes_io(raw: bytes): + import io + + return io.BytesIO(raw) + + +# --- processing ------------------------------------------------------------- + + +def chroma_key(img: Image.Image) -> Image.Image: + """Make the flat green field transparent with a soft edge and green despill.""" + rgb = img.convert("RGB") + pixels = [] + for r, g, b in rgb.getdata(): + greenness = g - max(r, b) + if greenness >= KEY_FULL: + pixels.append((0, 0, 0, 0)) + continue + if greenness <= KEY_NONE: + alpha = 255 + else: + alpha = round(255 * (KEY_FULL - greenness) / (KEY_FULL - KEY_NONE)) + if greenness > 0: + g = max(r, b) # despill: clamp green to the other channels + pixels.append((r, g, b, alpha)) + out = Image.new("RGBA", rgb.size) + out.putdata(pixels) + return out + + +def trim_and_scale_sprite(img: Image.Image, height: int = SPRITE_HEIGHT) -> Image.Image: + bbox = img.getchannel("A").point(lambda a: 255 if a > 16 else 0).getbbox() + if bbox: + img = img.crop(bbox) + scale = height / img.height + return img.resize((max(1, round(img.width * scale)), height), Image.Resampling.LANCZOS) + + +def process_asset(work_root: Path, asset: dict[str, Any]) -> None: + raw_path = work_root / "assets" / asset["raw_file"] + final = work_root / "assets" / asset["file"] + final.parent.mkdir(parents=True, exist_ok=True) + with Image.open(raw_path) as img: + if asset["kind"] == "sprite": + out = trim_and_scale_sprite(chroma_key(img)) + else: + out = ImageOps.fit(img.convert("RGB"), BG_SIZE, Image.Resampling.LANCZOS) + out.save(final, "WEBP", quality=90, method=6) + asset["sha256"] = sha256_file(final) + asset["status"] = "processed" + + +def placeholder(asset: dict[str, Any], label_color: str = "#d8cfc0") -> Image.Image: + """Deterministic stand-in image so the game always runs.""" + if asset["kind"] == "background": + img = Image.new("RGB", BG_SIZE, "#1d1a17") + draw = ImageDraw.Draw(img) + for y in range(BG_SIZE[1]): + shade = 23 + round(30 * y / BG_SIZE[1]) + draw.line([(0, y), (BG_SIZE[0], y)], fill=(shade, shade - 4, shade - 8)) + else: + img = Image.new("RGBA", (500, SPRITE_HEIGHT), (0, 0, 0, 0)) + draw = ImageDraw.Draw(img) + draw.ellipse([170, 40, 330, 220], fill=(60, 52, 46, 230)) + draw.rounded_rectangle([110, 230, 390, SPRITE_HEIGHT], 60, fill=(60, 52, 46, 230)) + draw = ImageDraw.Draw(img) + font = ImageFont.load_default(size=40) + draw.text((30, 30), asset["id"], fill=label_color, font=font) + return img + + +def ensure_placeholder(work_root: Path, asset: dict[str, Any]) -> None: + final = work_root / "assets" / asset["file"] + final.parent.mkdir(parents=True, exist_ok=True) + placeholder(asset).save(final, "WEBP", quality=90) + asset.update(source="placeholder", status="placeholder", sha256=sha256_file(final)) + + +def contact_sheet(work_root: Path, ids: list[str], out: Path, thumb: int = 360) -> Path: + """Tile raw or processed images (sprites over a checkerboard) for visual review.""" + manifest = load_manifest(work_root) + tiles = [] + for asset_id in ids: + asset = find_asset(manifest, asset_id) + rel = asset["file"] if asset["status"] in USABLE else asset.get("raw_file") + if not rel: + continue + with Image.open(work_root / "assets" / rel) as img: + img = img.convert("RGBA") + img.thumbnail((thumb, thumb)) + tile = _checker((thumb, thumb)) + tile.alpha_composite(img, ((thumb - img.width) // 2, (thumb - img.height) // 2)) + ImageDraw.Draw(tile).text((6, 6), asset_id, fill="white") + tiles.append(tile) + cols = min(4, max(1, len(tiles))) + rows = (len(tiles) + cols - 1) // cols + sheet = Image.new("RGBA", (cols * thumb, max(1, rows) * thumb), "black") + for i, tile in enumerate(tiles): + sheet.paste(tile, ((i % cols) * thumb, (i // cols) * thumb)) + out.parent.mkdir(parents=True, exist_ok=True) + sheet.convert("RGB").save(out) + return out + + +def _checker(size: tuple[int, int], cell: int = 20) -> Image.Image: + img = Image.new("RGBA", size, (90, 90, 90, 255)) + draw = ImageDraw.Draw(img) + for y in range(0, size[1], cell): + for x in range((y // cell % 2) * cell, size[0], cell * 2): + draw.rectangle([x, y, x + cell - 1, y + cell - 1], fill=(130, 130, 130, 255)) + return img + + +# --- CLI -------------------------------------------------------------------- + + +def _cmd_import(args: argparse.Namespace) -> int: + work = load_work(args.work) + result = load_tool_result(args.tool_result) + raw = decode_output(result, args.index) + path = import_image(work.root, args.asset_id, raw, result.get("generationId")) + print(f"{args.asset_id}: imported {path} ({len(raw)} bytes, sha256 verified)") + return 0 + + +def _cmd_process(args: argparse.Namespace) -> int: + work = load_work(args.work) + manifest = load_manifest(work.root) + for asset in manifest["assets"]: + if args.ids and asset["id"] not in args.ids: + continue + if asset["status"] == "generated" or (args.force and asset.get("raw_file")): + process_asset(work.root, asset) + print(f"{asset['id']}: processed") + save_manifest(work.root, manifest) + return 0 + + +def _cmd_status(args: argparse.Namespace) -> int: + work = load_work(args.work) + manifest = load_manifest(work.root) + if args.set: + asset = find_asset(manifest, args.set[0]) + asset["status"] = args.set[1] + if len(args.set) > 2: + asset["notes"] = args.set[2] + save_manifest(work.root, manifest) + for asset in manifest["assets"]: + print(f"{asset['status']:<11} {asset['id']}") + return 0 + + +def _cmd_placeholders(args: argparse.Namespace) -> int: + work = load_work(args.work) + manifest = load_manifest(work.root) + for asset in manifest["assets"]: + if asset["status"] not in USABLE: + ensure_placeholder(work.root, asset) + print(f"{asset['id']}: placeholder") + save_manifest(work.root, manifest) + return 0 + + +def _cmd_prompt(args: argparse.Namespace) -> int: + work = load_work(args.work) + manifest = load_manifest(work.root) + print(full_prompt(manifest, find_asset(manifest, args.asset_id))) + return 0 + + +def _cmd_sheet(args: argparse.Namespace) -> int: + work = load_work(args.work) + print(contact_sheet(work.root, args.ids, args.out)) + return 0 + + +def register(sub: argparse._SubParsersAction) -> None: + parser = sub.add_parser("assets", help="Manage the asset manifest and images") + cmds = parser.add_subparsers(dest="assets_command", required=True) + + p = cmds.add_parser("prompt", help="Print the full generation prompt for an asset") + p.add_argument("asset_id") + p.set_defaults(handler=_cmd_prompt) + + p = cmds.add_parser("import", help="Decode a stored query_tasks result into an asset") + p.add_argument("asset_id") + p.add_argument("tool_result", type=Path) + p.add_argument("--index", type=int, default=0) + p.set_defaults(handler=_cmd_import) + + p = cmds.add_parser("process", help="Cut out sprites / fit backgrounds") + p.add_argument("ids", nargs="*") + p.add_argument("--force", action="store_true", help="Reprocess already processed assets") + p.set_defaults(handler=_cmd_process) + + p = cmds.add_parser("status", help="List statuses, or --set ID STATUS [NOTE]") + p.add_argument("--set", nargs="+", metavar="ARG") + p.set_defaults(handler=_cmd_status) + + p = cmds.add_parser("placeholders", help="Create placeholders for unusable assets") + p.set_defaults(handler=_cmd_placeholders) + + p = cmds.add_parser("sheet", help="Build a contact sheet PNG for review") + p.add_argument("out", type=Path) + p.add_argument("ids", nargs="+") + p.set_defaults(handler=_cmd_sheet) diff --git a/src/vnpipe/cli.py b/src/vnpipe/cli.py new file mode 100644 index 0000000..1f21eaa --- /dev/null +++ b/src/vnpipe/cli.py @@ -0,0 +1,36 @@ +"""Command-line entry point. + +Each pipeline stage lives in its own module exposing ``register(subparsers)``, +which adds a subcommand whose handler takes the parsed ``argparse.Namespace``. +""" + +import argparse +import importlib +from pathlib import Path + +STAGE_MODULES = ["text", "annotate", "assets", "renpy_gen"] + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(prog="vnpipe", description=__doc__) + parser.add_argument( + "--work", + type=Path, + default=Path("."), + help="Work directory containing work.toml (default: current directory)", + ) + sub = parser.add_subparsers(dest="command", required=True) + for name in STAGE_MODULES: + try: + module = importlib.import_module(f"vnpipe.{name}") + except ModuleNotFoundError as exc: + if exc.name != f"vnpipe.{name}": + raise + continue + module.register(sub) + args = parser.parse_args(argv) + return args.handler(args) or 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/src/vnpipe/config.py b/src/vnpipe/config.py new file mode 100644 index 0000000..edc46a7 --- /dev/null +++ b/src/vnpipe/config.py @@ -0,0 +1,37 @@ +"""Load a work's configuration (/work.toml).""" + +import tomllib +from dataclasses import dataclass +from pathlib import Path +from typing import Any + + +@dataclass(frozen=True) +class Work: + root: Path + data: dict[str, Any] + + @property + def id(self) -> str: + return self.data["work"]["id"] + + @property + def cast(self) -> dict[str, dict[str, Any]]: + return self.data["cast"] + + @property + def speakers(self) -> dict[str, str]: + return self.data["speakers"] + + @property + def scenes(self) -> list[dict[str, Any]]: + return self.data["scenes"] + + def path(self, relative: str) -> Path: + return self.root / relative + + +def load_work(root: Path) -> Work: + root = Path(root) + with (root / "work.toml").open("rb") as fh: + return Work(root=root, data=tomllib.load(fh)) diff --git a/src/vnpipe/prompts/annotate.md b/src/vnpipe/prompts/annotate.md new file mode 100644 index 0000000..e900741 --- /dev/null +++ b/src/vnpipe/prompts/annotate.md @@ -0,0 +1,88 @@ +# Task: annotate one chunk of a verse play for a visual novel + +You annotate chunk `{{chunk_id}}`. Do not read or write any other file than the two below. + +- Input (read it): `{{chunk_path}}` +- Output (write it, nothing else): `{{cache_path}}` + +## Input + +The chunk JSON has `scene`, `allowed`, `context_before` (earlier lines, read-only context, +do not annotate them) and `lines`. Each line has `id`, `kind`, `speaker`, `speaker_note`, +`text` and `defaults`. + +## Output + +One JSON file, exactly this shape: + +```json +{ + "chunk_id": "", + "input_sha256": "", + "annotations": [ + { + "id": "", + "speaker": "", + "kind": "", + "emotion": "neutral", + "location": "", + "time_of_day": "", + "on_stage": [{"character": "faust", "position": "left"}], + "music": null + } + ] +} +``` + +Rules: + +1. Exactly one annotation per input line, in the same order, same `id`s. No extras, no omissions. +2. Copy `speaker`, `kind`, `location`, `time_of_day` verbatim from the line's `defaults`. +3. `emotion`: one of `allowed.emotions`, chosen from the meaning of the verse in its context + (read `context_before` and the neighbouring lines). +4. `on_stage`: the characters present in the scene at that moment, not only the speaker. + Only ids from `allowed.characters`, each at most once per line, `position` one of + `left`, `center`, `right`. Include present characters even if + they are never drawn (the Lord, the Spirit): the renderer filters them. Use `[]` for + lyric text with nobody in the scene (the Dedicatoria). +5. `music`: a mood from `allowed.music` only at a real mood shift (a new scene, a hymn + starting, the Spirit appearing); `null` on every other line. Never repeat the same mood. +6. Output only valid JSON, no comments, no extra keys, no markdown fences in the file. + +## Emotions + +- `neutral`: plain statement, exposition, stage business, questions of fact. +- `joyful`: warmth, laughter, praise, light banter. Comic exchanges between the Clown and + the Director: joyful or ironic. +- `melancholic`: lyric longing, memory, loss, weariness. The Dedicatoria is melancholic + ("Tornáis de nuevo, hermosas imágenes flotantes..."). +- `solemn`: sacred, ceremonial, grave. The archangels' hymn and the Lord's words are solemn. +- `ironic`: sarcasm, wit, mockery, cynicism. Mephistopheles' sly remarks are ironic, even + when they sound polite. +- `angry`: rage, scorn, disgust, bitter rebuke. +- `fearful`: terror, dread, shrinking back. Faust before the Earth Spirit ("aterrado") is fearful. +- `ecstatic`: rapture, exaltation, overwhelming vision. Faust at the sign of the Macrocosm. + Faust's despair is melancholic or angry; his ecstasy is ecstatic. + +Check `speaker_note` too (for example "aterrado" means fearful). Do not default everything +to `neutral`; do not swing wildly between lines of one continuous thought. + +## Staging + +- Work out who is in the scene from the cast list (a `cast` line is only a list of who is + there), the stage directions and who has spoken so far (use `context_before`). +- A character who has not yet entered or who has left must not appear in `on_stage`. +- Positions must stay stable within the scene: once a character is `left`, keep them `left` + in every later line. With two characters use `left` and `right`; a third takes `center`. +- Stage directions say who enters, leaves or appears; apply them from the line after. + +## Before finishing + +Run this and make sure the line for `{{chunk_id}}` says `ok`: + +``` +{{status_cmd}} {{chunk_id}} +``` + +If it reports `invalid` or `stale`, fix the file (never edit the input) and run it again. +Finish with one short line saying the chunk is ok. diff --git a/src/vnpipe/renpy_gen.py b/src/vnpipe/renpy_gen.py new file mode 100644 index 0000000..4d76028 --- /dev/null +++ b/src/vnpipe/renpy_gen.py @@ -0,0 +1,766 @@ +"""Ren'Py generator: annotated play + asset manifest -> a complete Ren'Py 8 project. + +The output is deterministic (no timestamps, sorted iteration, copied bytes), so +re-running the command yields identical files. Staging rules are documented in +``docs/adaptation-rules.md``; work-specific choices come from ``work.toml``. + +The GUI files in ``renpy_templates/`` were produced once with the Ren'Py SDK's +``generate_gui`` command and are MIT-licensed Ren'Py files (see ``docs/running.md``). +""" + +import argparse +import hashlib +import json +import shutil +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any + +from PIL import Image, ImageDraw + +from vnpipe import PACKAGE_DIR +from vnpipe.assets import USABLE, load_manifest, placeholder +from vnpipe.config import Work, load_work +from vnpipe.schema import validate + +TEMPLATE_DIR = PACKAGE_DIR / "renpy_templates" +USABLE_STATUS = USABLE | {"placeholder"} + +ADV_MAX_LINES = 4 +NVL_MAX_LINES = 8 +SPLIT_INDENT = 6 # parsed `indent` at or above this marks a split verse line +TITLE_PAUSE = 2.0 +END_PAUSE = 3.0 + +VALID_POSITIONS = ("left", "center", "right") +EMOTIONS = ( + "neutral", + "joyful", + "melancholic", + "solemn", + "ironic", + "angry", + "fearful", + "ecstatic", +) +POSITIONS = ("left", "right", "center") # order in which --from-parsed assigns positions +TRANSITIONS = { + "dissolve": "dissolve", + "fade": "fade", + "slow": "vn_slow", + "flash": "vn_flash", +} +TINTS = ("none", "dark", "red") +DEFAULT_LYRIC_VOICE = "poet_voice" +DEFAULT_END_TEXT = "Continuará…" +MENU_BG_FALLBACK = "gui/main_menu.png" + +ABOUT_LABELS = { + "es": ("Texto", "Traducción", "Adaptación a novela visual generada con vnpipe."), + "en": ("Text", "Translation", "Visual novel adaptation generated with vnpipe."), +} + + +# --- text helpers ------------------------------------------------------------- + + +def escape_text(text: str) -> str: + """Escape a text for use inside a double-quoted Ren'Py say/define string.""" + return ( + text.replace("\\", "\\\\") + .replace('"', '\\"') + .replace("[", "[[") + .replace("{", "{{") + .replace("\n", "\\n") + ) + + +def quote(text: str) -> str: + return f'"{escape_text(text)}"' + + +def _plain_quote(text: str) -> str: + """Quote a path or identifier-like string (no Ren'Py text markup).""" + return '"' + text.replace("\\", "\\\\").replace('"', '\\"') + '"' + + +def char_var(cast_id: str, nvl: bool = False) -> str: + """Ren'Py variable of a cast member's Character (prefixed: `director` etc. are built-ins).""" + return f"c_{cast_id}" + ("_nvl" if nvl else "") + + +def bg_image_name(asset_id: str) -> str: + """``bg_heaven_lord`` -> ``bg heaven_lord`` (tag ``bg``, attribute ``heaven_lord``).""" + return "bg " + asset_id.removeprefix("bg_") + + +# --- annotations ---------------------------------------------------------------- + + +def lyric_voice(work: Work) -> str: + return work.data["work"].get("lyric_voice", DEFAULT_LYRIC_VOICE) + + +def annotations_from_parsed(work: Work, parsed: dict[str, Any]) -> dict[str, Any]: + """Trivial in-memory annotations (used before the LLM annotations exist).""" + voice = lyric_voice(work) + scene_cfg = {s["id"]: s for s in work.scenes} + digest = hashlib.sha256( + json.dumps(parsed, sort_keys=True, ensure_ascii=False).encode("utf-8") + ).hexdigest() + scenes = [] + for scene in parsed["scenes"]: + cfg = scene_cfg.get(scene["id"], {}) + spoken: list[str] = [] + positions: dict[str, str] = {} + lines = [] + for line in scene["lines"]: + speaker = line["speaker"] + if line["kind"] == "direction": + ann_speaker, kind = "narrator", "stage_direction" + elif speaker: + ann_speaker, kind = speaker, "dialogue" + else: + ann_speaker, kind = voice, "narration" + if line["kind"] == "verse" and speaker and work.cast.get(speaker, {}).get("sprite"): + if speaker not in positions: + positions[speaker] = POSITIONS[len(positions) % len(POSITIONS)] + if speaker not in spoken: + spoken.append(speaker) + lines.append( + { + **line, + "ann": { + "speaker": ann_speaker, + "kind": kind, + "emotion": "neutral", + "location": cfg.get("location", "unknown"), + "time_of_day": cfg.get("time_of_day", "timeless"), + "on_stage": [{"character": c, "position": positions[c]} for c in spoken], + }, + } + ) + scenes.append({"id": scene["id"], "heading": scene["heading"], "lines": lines}) + return { + "work": parsed["work"], + "parsed_sha256": digest, + "fallback_chunks": [], + "scenes": scenes, + } + + +# --- assets ----------------------------------------------------------------------- + + +@dataclass +class ImageEntry: + name: str # Ren'Py image name, e.g. "bg heaven" or "hero neutral" + rel: str # path below game/images/ + asset: dict[str, Any] + source: Path | None # file to copy, or None to generate a placeholder + + +def _sprite_asset(character: str, expression: str) -> dict[str, Any]: + return { + "id": f"sprite_{character}_{expression}", + "kind": "sprite", + "character": character, + "expression": expression, + "file": f"sprites/{character}_{expression}.webp", + } + + +def _bg_asset(asset_id: str) -> dict[str, Any]: + return { + "id": asset_id, + "kind": "background", + "file": f"bg/{asset_id.removeprefix('bg_')}.webp", + } + + +def _needed_bg_ids(work: Work) -> list[str]: + ids = [cfg["bg"] for cfg in work.data.get("staging", {}).values() if cfg.get("bg")] + ids += [cue["bg"] for cue in work.data.get("cues", []) if cue.get("bg")] + return ids + + +def collect_images(work: Work, manifest: dict[str, Any] | None) -> list[ImageEntry]: + """Every image the project declares: manifest assets plus anything the staging needs.""" + assets: dict[str, dict[str, Any]] = {} + for asset in (manifest or {}).get("assets", []): + assets[asset["id"]] = asset + for asset_id in _needed_bg_ids(work): + assets.setdefault(asset_id, _bg_asset(asset_id)) + for cid, info in work.cast.items(): + if not info.get("sprite"): + continue + for expression in sorted(set(info.get("expressions", {}).values())): + sprite = _sprite_asset(cid, expression) + assets.setdefault(sprite["id"], sprite) + entries = [] + for asset_id in sorted(assets): + asset = assets[asset_id] + if asset["kind"] == "background": + name = bg_image_name(asset_id) + else: + name = f"{asset['character']} {asset['expression']}" + source = None + if asset.get("status") in USABLE_STATUS and asset.get("file"): + candidate = work.path("assets") / asset["file"] + if candidate.is_file(): + source = candidate + entries.append(ImageEntry(name, asset["file"], asset, source)) + return entries + + +# --- script generation ---------------------------------------------------------------- + + +@dataclass +class Box: + lines: list[dict[str, Any]] = field(default_factory=list) + key: tuple | None = None + speaker: str = "" + is_direction: bool = False + + +def _is_direction(line: dict[str, Any]) -> bool: + return line["kind"] == "direction" or line["ann"]["kind"] == "stage_direction" + + +class SceneWriter: + """Turns one scene's lines into Ren'Py statements, tracking staging state.""" + + def __init__( + self, work: Work, scene: dict[str, Any], moods: set[str], music_state: dict[str, str | None] + ): + self.work = work + self.scene = scene + self.moods = moods + self.voice = lyric_voice(work) + self.cues = {c["at"]: c for c in work.data.get("cues", [])} + staging = work.data.get("staging", {}).get(scene["id"], {}) + self.mode: str = staging.get("mode", "adv") + self.bg: str | None = staging.get("bg") + self.tint = "none" + self.music_state = music_state # {'playing': mood}, shared across scenes + self.shown: dict[str, str] = {} # character -> expression currently shown + self.pinned: dict[str, str] = dict(staging.get("cast", {})) # always on stage in ADV + self.positions: dict[str, str] = dict(self.pinned) # character -> position in this scene + self.last_on_stage: list[dict[str, str]] = [] # on_stage of the last non-direction box + self.out: list[str] = [] + self.box: Box | None = None + + def emit(self, text: str = "") -> None: + self.out.append((" " + text) if text else "") + + # -- speakers --------------------------------------------------------------- + + def speaker_of(self, line: dict[str, Any]) -> str: + if _is_direction(line): + return "narrator" + speaker = line["ann"]["speaker"] or self.voice + if speaker != "narrator" and speaker not in self.work.cast: + raise ValueError(f"{line['id']}: speaker {speaker!r} is not in [cast]") + return speaker + + # -- cues ---------------------------------------------------------------------- + + def apply_cue(self, cue: dict[str, Any]) -> None: + changes = False + new_mode = cue.get("mode", self.mode) + if self.mode == "nvl" and new_mode != "nvl": + self.emit("nvl hide dissolve") + if new_mode == "nvl" or cue.get("hide_all"): + changes |= self.hide_sprites(list(self.shown)) + self.mode = new_mode + if cue.get("tint") is not None: + if cue["tint"] not in TINTS: + raise ValueError(f"cue at {cue['at']}: unknown tint {cue['tint']!r}") + self.tint = cue["tint"] + if cue.get("bg") or cue.get("tint") is not None: + self.bg = cue.get("bg") or self.bg + self.emit(f"show {bg_image_name(self.bg)} at tint_{self.tint}") + changes = True + if changes: + transition = cue.get("transition", "dissolve") + if transition not in TRANSITIONS: + raise ValueError(f"cue at {cue['at']}: unknown transition {transition!r}") + self.emit(f"with {TRANSITIONS[transition]}") + if cue.get("shake"): + self.emit("show layer master at vn_shake") + moved = False + for cid, position in cue.get("move", {}).items(): + self.positions[cid] = position + if cid in self.shown: + self.emit(f"show {cid} {self.shown[cid]} at vn_{position}") + moved = True + if moved: + self.emit("with vn_move") + + def hide_sprites(self, characters: list[str]) -> bool: + for cid in characters: + self.emit(f"hide {cid}") + del self.shown[cid] + return bool(characters) + + # -- boxes ---------------------------------------------------------------------- + + def limit(self) -> int: + return NVL_MAX_LINES if self.mode == "nvl" else ADV_MAX_LINES + + def feed(self, line: dict[str, Any]) -> None: + if line["kind"] == "cast": + return + cue = self.cues.get(line["id"]) + if cue: + self.flush() + self.apply_cue(cue) + direction = _is_direction(line) + key = (self.speaker_of(line), line["speech"], line["stanza"]) + split = self.mode == "adv" and not direction and line["indent"] >= SPLIT_INDENT + box = self.box + if box and ( + direction + or box.is_direction + or key != box.key + or len(box.lines) >= self.limit() + or split + or (self.mode == "adv" and box.lines[-1]["indent"] >= SPLIT_INDENT) + ): + self.flush() + if self.box is None: + self.box = Box(key=key, speaker=key[0], is_direction=direction) + self.box.lines.append(line) + + def flush(self) -> None: + box = self.box + if not box: + return + self.box = None + first, last = box.lines[0], box.lines[-1] + ids = first["id"] if first is last else f"{first['id']} .. {last['id']}" + self.emit(f"# {ids}") + self.music(first["ann"].get("music")) + if self.mode == "adv": + self.stage(box) + text = "\\n".join(escape_text(line["text"]) for line in box.lines) + variable = char_var(box.speaker, nvl=self.mode == "nvl") + self.emit(f'{variable} "{text}"') + if self.mode == "nvl": + self.emit("nvl clear") + + def music(self, mood: str | None) -> None: + if mood is None: + return + if mood == "none": + if self.music_state["playing"]: + self.emit("stop music fadeout 1.0") + self.music_state["playing"] = None + elif mood in self.moods and self.music_state["playing"] != mood: + self.emit(f'play music "audio/{mood}.ogg" fadeout 1.0 fadein 1.0') + self.music_state["playing"] = mood + + # -- sprites --------------------------------------------------------------------- + + def stage(self, box: Box) -> None: + first = box.lines[0] + ann = first["ann"] + desired: list[str] = [] + # stage directions never change who is on stage + on_stage = self.last_on_stage if box.is_direction else ann["on_stage"] + if not box.is_direction: + self.last_on_stage = on_stage + for cid in self.pinned: + if self.work.cast[cid].get("sprite"): + desired.append(cid) + for entry in on_stage: + cid = entry["character"] + if cid not in self.work.cast: + raise ValueError(f"{first['id']}: on_stage character {cid!r} is not in [cast]") + if not self.work.cast[cid].get("sprite"): + continue + self.positions.setdefault(cid, entry["position"]) + if cid not in desired: + desired.append(cid) + changed = self.hide_sprites([c for c in list(self.shown) if c not in desired]) + for cid in desired: + expressions = self.work.cast[cid].get("expressions", {}) + neutral = expressions.get("neutral", "neutral") + if cid == box.speaker: + expression = expressions.get(ann["emotion"], neutral) + else: + expression = self.shown.get(cid, neutral) + if self.shown.get(cid) != expression: + self.emit(f"show {cid} {expression} at vn_{self.positions[cid]}") + self.shown[cid] = expression + changed = True + if changed: + self.emit("with dissolve") + + # -- scene --------------------------------------------------------------------------- + + def render(self) -> list[str]: + scene = self.scene + self.out.append(f"label scene_{scene['id']}:") + self.emit("scene black") + self.emit(f"show card_{scene['id']} at truecenter") + self.emit("with fade") + self.emit(f"pause {TITLE_PAUSE}") + self.emit(f"hide card_{scene['id']}") + if self.bg: + self.emit(f"scene {bg_image_name(self.bg)} at tint_{self.tint}") + self.emit("with fade") + for line in scene["lines"]: + self.feed(line) + self.flush() + if self.mode == "nvl": + self.emit("nvl hide dissolve") + self.out.append("") + return self.out + + +def validate_staging(work: Work, annotated: dict[str, Any]) -> None: + """Check the human-judgment layer (staging.cast, cue move, overrides) against the data.""" + cast = work.cast + scene_ids = [sc["id"] for sc in annotated["scenes"]] + for sid, cfg in work.data.get("staging", {}).items(): + if sid not in scene_ids: + raise ValueError(f"[staging.{sid}]: unknown scene") + for cid, pos in cfg.get("cast", {}).items(): + if cid not in cast: + raise ValueError(f"[staging.{sid}].cast: unknown character {cid!r}") + if pos not in VALID_POSITIONS: + raise ValueError(f"[staging.{sid}].cast: unknown position {pos!r}") + for cue in work.data.get("cues", []): + for cid, pos in cue.get("move", {}).items(): + if cid not in cast: + raise ValueError(f"cue at {cue['at']}: move of unknown character {cid!r}") + if pos not in VALID_POSITIONS: + raise ValueError(f"cue at {cue['at']}: unknown position {pos!r}") + + +def apply_overrides(work: Work, annotated: dict[str, Any]) -> dict[str, Any]: + """Return a copy of ``annotated`` with ``[[overrides]]`` emotions applied (inclusive ranges).""" + result = json.loads(json.dumps(annotated)) + where = {ln["id"]: (sc, i) for sc in result["scenes"] for i, ln in enumerate(sc["lines"])} + for ov in work.data.get("overrides", []): + if ov["emotion"] not in EMOTIONS: + raise ValueError( + f"override {ov['from']}..{ov['to']}: unknown emotion {ov['emotion']!r}" + ) + for key in ("from", "to"): + if ov[key] not in where: + raise ValueError(f"override: unknown line id {ov[key]!r}") + (scene, start), (scene_to, end) = where[ov["from"]], where[ov["to"]] + if scene is not scene_to or end < start: + raise ValueError(f"override {ov['from']}..{ov['to']}: not a range within one scene") + for line in scene["lines"][start : end + 1]: + line["ann"]["emotion"] = ov["emotion"] + return result + + +def render_script(work: Work, annotated: dict[str, Any], moods: set[str]) -> str: + validate_staging(work, annotated) + annotated = apply_overrides(work, annotated) + out = [ + "## Generated by `vnpipe renpy`. Do not edit: regenerate instead.", + "", + "label start:", + " window auto", + "", + ] + known = {c["at"] for c in work.data.get("cues", [])} + seen: set[str] = set() + music_state: dict[str, str | None] = {"playing": None} + for scene in annotated["scenes"]: + out.extend(SceneWriter(work, scene, moods, music_state).render()) + seen |= {line["id"] for line in scene["lines"]} + missing = known - seen + if missing: + raise ValueError(f"cues refer to unknown line ids: {sorted(missing)}") + out += [ + "label the_end:", + " scene black", + " with fade", + " show card_end at truecenter", + " with dissolve", + f" pause {END_PAUSE}", + " return", + "", + ] + return "\n".join(out) + + +# --- GUI images the SDK template leaves out -------------------------------------------------- +# `generate_gui` only makes a few GUI images; button, bar, scrollbar, slider, check and radio +# images are expected to exist (Ren'Py's prefix search falls back to the un-prefixed name). + +ACCENT = (201, 162, 91) +IVORY = (239, 230, 210) +DARK = (20, 17, 14) + + +def _solid(size: tuple[int, int], color: tuple[int, ...]) -> Image.Image: + return Image.new("RGBA", size, color) + + +def _check_image(selected: bool, round_: bool) -> Image.Image: + img = Image.new("RGBA", (38, 38), (0, 0, 0, 0)) + draw = ImageDraw.Draw(img) + box = [4, 4, 33, 33] + shape = draw.ellipse if round_ else draw.rectangle + shape(box, outline=IVORY + (255,), width=3) + if selected: + shape([12, 12, 25, 25], fill=ACCENT + (255,)) + return img + + +def gui_extra_images() -> dict[str, Image.Image]: + """Deterministic simple GUI images, keyed by path relative to ``game/``.""" + base: dict[str, Image.Image] = { + "button/background.png": _solid((24, 24), (0, 0, 0, 0)), + "button/hover_background.png": _solid((24, 24), ACCENT + (60,)), + "button/selected_background.png": _solid((24, 24), ACCENT + (35,)), + "button/check_foreground.png": _check_image(False, False), + "button/check_selected_foreground.png": _check_image(True, False), + "button/radio_foreground.png": _check_image(False, True), + "button/radio_selected_foreground.png": _check_image(True, True), + "bar/left.png": _solid((48, 48), ACCENT + (255,)), + "bar/right.png": _solid((48, 48), IVORY + (60,)), + "bar/top.png": _solid((48, 48), IVORY + (60,)), + "bar/bottom.png": _solid((48, 48), ACCENT + (255,)), + "slider/horizontal_bar.png": _solid((48, 48), IVORY + (60,)), + "slider/horizontal_thumb.png": _solid((20, 38), ACCENT + (255,)), + "slider/vertical_bar.png": _solid((48, 48), IVORY + (60,)), + "slider/vertical_thumb.png": _solid((38, 20), ACCENT + (255,)), + "scrollbar/horizontal_bar.png": _solid((48, 48), IVORY + (40,)), + "scrollbar/horizontal_thumb.png": _solid((48, 48), ACCENT + (255,)), + "scrollbar/vertical_bar.png": _solid((48, 48), IVORY + (40,)), + "scrollbar/vertical_thumb.png": _solid((48, 48), ACCENT + (255,)), + } + result = dict(base) + for path, img in base.items(): + result[f"phone/{path}"] = img + return {f"gui/{path}": img for path, img in sorted(result.items())} + + +E2E_FILE = "e2e_test.rpy" +E2E_TESTCASE = """## Generated by `vnpipe renpy --with-test`: end-to-end playthrough (testing only). +## Run with `renpy.sh test` (see docs/running.md). + +# The test runner only advances when frames are drawn; an always-running transform keeps +# the software renderer (used headless) drawing, including on the main menu. +transform e2e_tick: + xpos 0 + linear 0.05 xpos 1 + repeat + +screen e2e_ticker(): + zorder 1000 + add Null(1, 1) at e2e_tick + +init 999 python: + config.always_shown_screens.append("e2e_ticker") + e2e_state = {"end": False} + + def e2e_label(name, abnormal): + if name == "the_end": + e2e_state["end"] = True + + config.label_callbacks.append(e2e_label) + +testsuite global: + teardown: + exit + +testcase default: + $ _test.transition_timeout = 0.05 + $ _test.timeout = 30.0 + pause 1.0 + click "Start" + advance until eval (e2e_state["end"]) timeout 900 + advance until screen "main_menu" timeout 60 + assert eval (e2e_state["end"]) +""" + + +# --- static project files ----------------------------------------------------------------- + + +def render_characters(work: Work) -> str: + cast = dict(work.cast) + cast.setdefault("narrator", {"name": "", "color": "#d8cfc0"}) + out = ["## Generated by `vnpipe renpy`. Do not edit: regenerate instead.", ""] + for cid, info in cast.items(): + name = info.get("name") or "" + color = info.get("color") + who = quote(name) if name else "None" + props: list[str] = [] + if name and color: + props.append(f"who_color={_plain_quote(color)}") + if not name and color: + props.append(f"what_color={_plain_quote(color)}") + if cid == "narrator": + props.append("what_italic=True") + adv = ", ".join([who, *props]) + nvl_props = ["kind=nvl", *props] + if not name: + nvl_props.append('what_style="nvl_thought"') + out.append(f"define {char_var(cid)} = Character({adv})") + out.append(f"define {char_var(cid, nvl=True)} = Character({', '.join([who, *nvl_props])})") + out.append("") + return "\n".join(out) + + +def title_cards(work: Work, annotated: dict[str, Any]) -> dict[str, str]: + cards = {f"card_{sc['id']}": sc["heading"] for sc in annotated["scenes"]} + cards["card_end"] = work.data["work"].get("end_text", DEFAULT_END_TEXT) + return cards + + +def render_images(entries: list[ImageEntry], cards: dict[str, str]) -> str: + out = ["## Generated by `vnpipe renpy`. Do not edit: regenerate instead.", ""] + for name, text in cards.items(): # title cards: plain images, not `show text` + out.append(f'image {name} = Text("{escape_text(text)}", size=60, text_align=0.5)') + for e in entries: + out.append(f"image {e.name} = {_plain_quote('images/' + e.rel)}") + out.append("") + return "\n".join(out) + + +def _about(work: Work) -> str: + info = work.data["work"] + text_l, trans_l, tail = ABOUT_LABELS.get(info.get("language", "es"), ABOUT_LABELS["en"]) + parts = [info.get("subtitle", "")] + if info.get("author"): + parts.append(f"{text_l}: {info['author']}") + if info.get("translator"): + parts.append(f"{trans_l}: {info['translator']}") + parts.append(tail) + return "\\n\\n".join(escape_text(p) for p in parts if p) + + +def _substitute(text: str, values: dict[str, str]) -> str: + for key, value in values.items(): + text = text.replace(f"@@{key}@@", value) + if "@@" in text: + raise ValueError("unreplaced template token") + return text + + +def write_text(path: Path, text: str) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text, encoding="utf-8", newline="\n") + + +def _audio_moods(out: Path) -> set[str]: + audio = out / "game" / "audio" + return {p.stem for p in audio.glob("*.ogg")} if audio.is_dir() else set() + + +def generate( + work: Work, annotated: dict[str, Any], out: Path, with_test: bool = False +) -> list[Path]: + """Write the Ren'Py project into ``out``; returns every generated file (sorted).""" + info = work.data["work"] + manifest_path = work.path("assets/assets.json") + manifest = load_manifest(work.root) if manifest_path.is_file() else None + entries = collect_images(work, manifest) + game = out / "game" + for sub in ("images", "gui", "fonts"): + shutil.rmtree(game / sub, ignore_errors=True) + game.mkdir(parents=True, exist_ok=True) + + # GUI template: copy binaries, substitute tokens in .rpy files. + menu_bg = MENU_BG_FALLBACK + staging = work.data.get("staging", {}) + first_bg = info.get("menu_bg") or next((c["bg"] for c in staging.values() if c.get("bg")), None) + if first_bg: + menu_bg = bg_image_name(first_bg) + values = { + "TITLE": escape_text(info["title"]), + "VERSION": "0.1", + "ABOUT": _about(work), + "BUILD_NAME": f"{info['id']}-vn", + "SAVE_DIR": f"{info['id']}-vn", + "MENU_BG": menu_bg, + } + written: list[Path] = [] + for src in sorted((TEMPLATE_DIR / "game").rglob("*")): + if not src.is_file(): + continue + dest = game / src.relative_to(TEMPLATE_DIR / "game") + dest.parent.mkdir(parents=True, exist_ok=True) + written.append(dest) + if src.suffix == ".rpy": + write_text(dest, _substitute(src.read_text(encoding="utf-8"), values)) + else: + shutil.copyfile(src, dest) + + for rel, img in gui_extra_images().items(): + dest = game / rel + dest.parent.mkdir(parents=True, exist_ok=True) + if not dest.exists(): # never override an image shipped by the template + img.save(dest, "PNG") + written.append(dest) + test_file = game / E2E_FILE + test_file.unlink(missing_ok=True) + if with_test: + write_text(test_file, E2E_TESTCASE) + written.append(test_file) + for name, text in ( + ("characters.rpy", render_characters(work)), + ("images.rpy", render_images(entries, title_cards(work, annotated))), + ("script.rpy", render_script(work, annotated, _audio_moods(out))), + ): + write_text(game / name, text) + written.append(game / name) + + for e in entries: + dest = game / "images" / e.rel + dest.parent.mkdir(parents=True, exist_ok=True) + written.append(dest) + if e.source: + shutil.copyfile(e.source, dest) + else: + placeholder(e.asset).save(dest, "WEBP", quality=90) + + return sorted(written) + + +# --- CLI ---------------------------------------------------------------------------------- + + +def cmd_renpy(args: argparse.Namespace) -> int: + work = load_work(args.work) + if args.from_parsed: + parsed = json.loads(work.path("data/parsed.json").read_text(encoding="utf-8")) + validate(parsed, "parsed") + annotated = annotations_from_parsed(work, parsed) + else: + path = work.path("data/annotated.json") + if not path.is_file(): + raise SystemExit(f"renpy: {path} missing; run annotation or pass --from-parsed") + annotated = json.loads(path.read_text(encoding="utf-8")) + validate(annotated, "annotated") + out = args.out or work.path("vn") + files = generate(work, annotated, out, with_test=args.with_test) + print(f"renpy: wrote {len(files)} files under {out}") + return 0 + + +def register(subparsers: argparse._SubParsersAction) -> None: + parser = subparsers.add_parser("renpy", help="Generate the Ren'Py project") + parser.add_argument( + "--from-parsed", + action="store_true", + help="Build trivial annotations from parsed.json instead of reading annotated.json", + ) + parser.add_argument( + "--with-test", + action="store_true", + help=f"Also write game/{E2E_FILE}: an end-to-end playthrough for `renpy.sh test`", + ) + parser.add_argument("--out", type=Path, help="Output directory (default: /vn)") + parser.set_defaults(handler=cmd_renpy) diff --git a/src/vnpipe/renpy_templates/game/fonts/RobotoSlab-Bold.ttf b/src/vnpipe/renpy_templates/game/fonts/RobotoSlab-Bold.ttf new file mode 100644 index 0000000..df5d1df Binary files /dev/null and b/src/vnpipe/renpy_templates/game/fonts/RobotoSlab-Bold.ttf differ diff --git a/src/vnpipe/renpy_templates/game/fonts/RobotoSlab-Regular.ttf b/src/vnpipe/renpy_templates/game/fonts/RobotoSlab-Regular.ttf new file mode 100644 index 0000000..eb52a79 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/fonts/RobotoSlab-Regular.ttf differ diff --git a/src/vnpipe/renpy_templates/game/gui.rpy b/src/vnpipe/renpy_templates/game/gui.rpy new file mode 100644 index 0000000..95e08eb --- /dev/null +++ b/src/vnpipe/renpy_templates/game/gui.rpy @@ -0,0 +1,480 @@ +################################################################################ +## Initialization +################################################################################ + +## The init offset statement causes the initialization statements in this file +## to run before init statements in any other file. +init offset = -2 + +## Calling gui.init resets the styles to sensible default values, and sets the +## width and height of the game. +init python: + gui.init(1920, 1080) + +## Enable checks for invalid or unstable properties in screens or transforms +define config.check_conflicting_properties = True + + +################################################################################ +## GUI Configuration Variables +################################################################################ + + +## Colors ###################################################################### +## +## The colors of text in the interface. + +## An accent color used throughout the interface to label and highlight text. +define gui.accent_color = '#c9a25b' + +## The color used for a text button when it is neither selected nor hovered. +define gui.idle_color = '#888888' + +## The small color is used for small text, which needs to be brighter/darker to +## achieve the same effect. +define gui.idle_small_color = '#aaaaaa' + +## The color that is used for buttons and bars that are hovered. +define gui.hover_color = '#dec79c' + +## The color used for a text button when it is selected but not focused. A +## button is selected if it is the current screen or preference value. +define gui.selected_color = '#ffffff' + +## The color used for a text button when it cannot be selected. +define gui.insensitive_color = '#8888887f' + +## Colors used for the portions of bars that are not filled in. These are not +## used directly, but are used when re-generating bar image files. +define gui.muted_color = '#504024' +define gui.hover_muted_color = '#786136' + +## The colors used for dialogue and menu choice text. +define gui.text_color = '#efe6d2' +define gui.interface_text_color = '#efe6d2' + + +## Fonts and Font Sizes ######################################################## + +## The font used for in-game text. +define gui.text_font = "fonts/RobotoSlab-Regular.ttf" + +## The font used for character names. +define gui.name_text_font = "fonts/RobotoSlab-Regular.ttf" + +## The font used for out-of-game text. +define gui.interface_text_font = "fonts/RobotoSlab-Regular.ttf" + +## The size of normal dialogue text. +define gui.text_size = 33 + +## The size of character names. +define gui.name_text_size = 45 + +## The size of text in the game's user interface. +define gui.interface_text_size = 33 + +## The size of labels in the game's user interface. +define gui.label_text_size = 36 + +## The size of text on the notify screen. +define gui.notify_text_size = 24 + +## The size of the game's title. +define gui.title_text_size = 75 + + +## Main and Game Menus ######################################################### + +## The images used for the main and game menus. +define gui.main_menu_background = "@@MENU_BG@@" +define gui.game_menu_background = "@@MENU_BG@@" + + +## Dialogue #################################################################### +## +## These variables control how dialogue is displayed on the screen one line at a +## time. + +## The height of the textbox containing dialogue. +define gui.textbox_height = 278 + +## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is +## center, and 1.0 is the bottom. +define gui.textbox_yalign = 1.0 + + +## The placement of the speaking character's name, relative to the textbox. +## These can be a whole number of pixels from the left or top, or 0.5 to center. +define gui.name_xpos = 360 +define gui.name_ypos = 0 + +## The horizontal alignment of the character's name. This can be 0.0 for left- +## aligned, 0.5 for centered, and 1.0 for right-aligned. +define gui.name_xalign = 0.0 + +## The width, height, and borders of the box containing the character's name, or +## None to automatically size it. +define gui.namebox_width = None +define gui.namebox_height = None + +## The borders of the box containing the character's name, in left, top, right, +## bottom order. +define gui.namebox_borders = Borders(5, 5, 5, 5) + +## If True, the background of the namebox will be tiled, if False, the +## background of the namebox will be scaled. +define gui.namebox_tile = False + + +## The placement of dialogue relative to the textbox. These can be a whole +## number of pixels relative to the left or top side of the textbox, or 0.5 to +## center. +define gui.dialogue_xpos = 402 +define gui.dialogue_ypos = 75 + +## The maximum width of dialogue text, in pixels. +define gui.dialogue_width = 1116 + +## The horizontal alignment of the dialogue text. This can be 0.0 for left- +## aligned, 0.5 for centered, and 1.0 for right-aligned. +define gui.dialogue_text_xalign = 0.0 + + +## Buttons ##################################################################### +## +## These variables, along with the image files in gui/button, control aspects of +## how buttons are displayed. + +## The width and height of a button, in pixels. If None, Ren'Py computes a size. +define gui.button_width = None +define gui.button_height = None + +## The borders on each side of the button, in left, top, right, bottom order. +define gui.button_borders = Borders(6, 6, 6, 6) + +## If True, the background image will be tiled. If False, the background image +## will be linearly scaled. +define gui.button_tile = False + +## The font used by the button. +define gui.button_text_font = gui.interface_text_font + +## The size of the text used by the button. +define gui.button_text_size = gui.interface_text_size + +## The color of button text in various states. +define gui.button_text_idle_color = gui.idle_color +define gui.button_text_hover_color = gui.hover_color +define gui.button_text_selected_color = gui.selected_color +define gui.button_text_insensitive_color = gui.insensitive_color + +## The horizontal alignment of the button text. (0.0 is left, 0.5 is center, 1.0 +## is right). +define gui.button_text_xalign = 0.0 + + +## These variables override settings for different kinds of buttons. Please see +## the gui documentation for the kinds of buttons available, and what each is +## used for. +## +## These customizations are used by the default interface: + +define gui.radio_button_borders = Borders(27, 6, 6, 6) + +define gui.check_button_borders = Borders(27, 6, 6, 6) + +define gui.confirm_button_text_xalign = 0.5 + +define gui.page_button_borders = Borders(15, 6, 15, 6) + +define gui.quick_button_borders = Borders(15, 6, 15, 0) +define gui.quick_button_text_size = 21 +define gui.quick_button_text_idle_color = gui.idle_small_color +define gui.quick_button_text_selected_color = gui.accent_color + +## You can also add your own customizations, by adding properly-named variables. +## For example, you can uncomment the following line to set the width of a +## navigation button. + +# define gui.navigation_button_width = 250 + + +## Choice Buttons ############################################################## +## +## Choice buttons are used in the in-game menus. + +define gui.choice_button_width = 1185 +define gui.choice_button_height = None +define gui.choice_button_tile = False +define gui.choice_button_borders = Borders(150, 8, 150, 8) +define gui.choice_button_text_font = gui.text_font +define gui.choice_button_text_size = gui.text_size +define gui.choice_button_text_xalign = 0.5 +define gui.choice_button_text_idle_color = '#888888' +define gui.choice_button_text_hover_color = "#ffffff" +define gui.choice_button_text_insensitive_color = '#8888887f' + + +## File Slot Buttons ########################################################### +## +## A file slot button is a special kind of button. It contains a thumbnail +## image, and text describing the contents of the save slot. A save slot uses +## image files in gui/button, like the other kinds of buttons. + +## The save slot button. +define gui.slot_button_width = 414 +define gui.slot_button_height = 309 +define gui.slot_button_borders = Borders(15, 15, 15, 15) +define gui.slot_button_text_size = 21 +define gui.slot_button_text_xalign = 0.5 +define gui.slot_button_text_idle_color = gui.idle_small_color +define gui.slot_button_text_selected_idle_color = gui.selected_color +define gui.slot_button_text_selected_hover_color = gui.hover_color + +## The width and height of thumbnails used by the save slots. +define config.thumbnail_width = 384 +define config.thumbnail_height = 216 + +## The number of columns and rows in the grid of save slots. +define gui.file_slot_cols = 3 +define gui.file_slot_rows = 2 + + +## Positioning and Spacing ##################################################### +## +## These variables control the positioning and spacing of various user interface +## elements. + +## The position of the left side of the navigation buttons, relative to the left +## side of the screen. +define gui.navigation_xpos = 60 + +## The vertical position of the skip indicator. +define gui.skip_ypos = 15 + +## The vertical position of the notify screen. +define gui.notify_ypos = 68 + +## The spacing between menu choices. +define gui.choice_spacing = 33 + +## Buttons in the navigation section of the main and game menus. +define gui.navigation_spacing = 6 + +## Controls the amount of spacing between preferences. +define gui.pref_spacing = 15 + +## Controls the amount of spacing between preference buttons. +define gui.pref_button_spacing = 0 + +## The spacing between file page buttons. +define gui.page_spacing = 0 + +## The spacing between file slots. +define gui.slot_spacing = 15 + +## The position of the main menu text. +define gui.main_menu_text_xalign = 1.0 + + +## Frames ###################################################################### +## +## These variables control the look of frames that can contain user interface +## components when an overlay or window is not present. + +## Generic frames. +define gui.frame_borders = Borders(6, 6, 6, 6) + +## The frame that is used as part of the confirm screen. +define gui.confirm_frame_borders = Borders(60, 60, 60, 60) + +## The frame that is used as part of the skip screen. +define gui.skip_frame_borders = Borders(24, 8, 75, 8) + +## The frame that is used as part of the notify screen. +define gui.notify_frame_borders = Borders(24, 8, 60, 8) + +## Should frame backgrounds be tiled? +define gui.frame_tile = False + + +## Bars, Scrollbars, and Sliders ############################################### +## +## These control the look and size of bars, scrollbars, and sliders. +## +## The default GUI only uses sliders and vertical scrollbars. All of the other +## bars are only used in creator-written screens. + +## The height of horizontal bars, scrollbars, and sliders. The width of vertical +## bars, scrollbars, and sliders. +define gui.bar_size = 38 +define gui.scrollbar_size = 18 +define gui.slider_size = 38 + +## True if bar images should be tiled. False if they should be linearly scaled. +define gui.bar_tile = False +define gui.scrollbar_tile = False +define gui.slider_tile = False + +## Horizontal borders. +define gui.bar_borders = Borders(6, 6, 6, 6) +define gui.scrollbar_borders = Borders(6, 6, 6, 6) +define gui.slider_borders = Borders(6, 6, 6, 6) + +## Vertical borders. +define gui.vbar_borders = Borders(6, 6, 6, 6) +define gui.vscrollbar_borders = Borders(6, 6, 6, 6) +define gui.vslider_borders = Borders(6, 6, 6, 6) + +## What to do with unscrollable scrollbars in the game menu. "hide" hides them, +## while None shows them. +define gui.unscrollable = "hide" + + +## History ##################################################################### +## +## The history screen displays dialogue that the player has already dismissed. + +## The number of blocks of dialogue history Ren'Py will keep. +define config.history_length = 250 + +## The height of a history screen entry, or None to make the height variable at +## the cost of performance. +define gui.history_height = 210 + +## Additional space to add between history screen entries. +define gui.history_spacing = 0 + +## The position, width, and alignment of the label giving the name of the +## speaking character. +define gui.history_name_xpos = 233 +define gui.history_name_ypos = 0 +define gui.history_name_width = 233 +define gui.history_name_xalign = 1.0 + +## The position, width, and alignment of the dialogue text. +define gui.history_text_xpos = 255 +define gui.history_text_ypos = 3 +define gui.history_text_width = 1110 +define gui.history_text_xalign = 0.0 + + +## NVL-Mode #################################################################### +## +## The NVL-mode screen displays the dialogue spoken by NVL-mode characters. + +## The borders of the background of the NVL-mode background window. +define gui.nvl_borders = Borders(0, 15, 0, 30) + +## The maximum number of NVL-mode entries Ren'Py will display. When more entries +## than this are to be show, the oldest entry will be removed. +define gui.nvl_list_length = 12 + +## The height of an NVL-mode entry. Set this to None to have the entries +## dynamically adjust height. +define gui.nvl_height = None + +## The spacing between NVL-mode entries when gui.nvl_height is None, and between +## NVL-mode entries and an NVL-mode menu. +define gui.nvl_spacing = 15 + +## The position, width, and alignment of the label giving the name of the +## speaking character. +define gui.nvl_name_xpos = 645 +define gui.nvl_name_ypos = 0 +define gui.nvl_name_width = 225 +define gui.nvl_name_xalign = 1.0 + +## The position, width, and alignment of the dialogue text. +define gui.nvl_text_xpos = 675 +define gui.nvl_text_ypos = 12 +define gui.nvl_text_width = 885 +define gui.nvl_text_xalign = 0.0 + +## The position, width, and alignment of nvl_thought text (the text said by the +## nvl_narrator character.) +define gui.nvl_thought_xpos = 360 +define gui.nvl_thought_ypos = 0 +define gui.nvl_thought_width = 1170 +define gui.nvl_thought_xalign = 0.0 + +## The position of nvl menu_buttons. +define gui.nvl_button_xpos = 675 +define gui.nvl_button_xalign = 0.0 + + +## Localization ################################################################ + +## This controls where a line break is permitted. The default is suitable +## for most languages. A list of available values can be found at https:// +## www.renpy.org/doc/html/style_properties.html#style-property-language + +define gui.language = "unicode" + + +################################################################################ +## Mobile devices +################################################################################ + +init python: + + ## This increases the size of the quick buttons to make them easier to touch + ## on tablets and phones. + @gui.variant + def touch(): + + gui.quick_button_borders = Borders(60, 21, 60, 0) + + ## This changes the size and spacing of various GUI elements to ensure they + ## are easily visible on phones. + @gui.variant + def small(): + + ## Font sizes. + gui.text_size = 45 + gui.name_text_size = 54 + gui.notify_text_size = 38 + gui.interface_text_size = 45 + gui.button_text_size = 45 + gui.label_text_size = 51 + + ## Adjust the location of the textbox. + gui.textbox_height = 360 + gui.name_xpos = 120 + gui.dialogue_xpos = 135 + gui.dialogue_width = 1650 + + ## Change the size and spacing of various things. + gui.slider_size = 54 + + gui.choice_button_width = 1860 + gui.choice_button_text_size = 45 + + gui.navigation_spacing = 30 + gui.pref_button_spacing = 15 + + gui.history_height = 285 + gui.history_text_width = 1035 + + gui.quick_button_text_size = 30 + + ## File button layout. + gui.file_slot_cols = 2 + gui.file_slot_rows = 2 + + ## NVL-mode. + gui.nvl_height = None + + gui.nvl_name_width = 458 + gui.nvl_name_xpos = 488 + + gui.nvl_text_width = 1373 + gui.nvl_text_xpos = 518 + gui.nvl_text_ypos = 8 + + gui.nvl_thought_width = 1860 + gui.nvl_thought_xpos = 30 + + gui.nvl_button_width = 1860 + gui.nvl_button_xpos = 30 diff --git a/src/vnpipe/renpy_templates/game/gui/bubble.png b/src/vnpipe/renpy_templates/game/gui/bubble.png new file mode 100644 index 0000000..3b23ff3 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/bubble.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/button/choice_hover_background.png b/src/vnpipe/renpy_templates/game/gui/button/choice_hover_background.png new file mode 100644 index 0000000..d2cdd41 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/button/choice_hover_background.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/button/choice_idle_background.png b/src/vnpipe/renpy_templates/game/gui/button/choice_idle_background.png new file mode 100644 index 0000000..1570796 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/button/choice_idle_background.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/button/quick_hover_background.png b/src/vnpipe/renpy_templates/game/gui/button/quick_hover_background.png new file mode 100644 index 0000000..0ecc7c9 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/button/quick_hover_background.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/button/quick_idle_background.png b/src/vnpipe/renpy_templates/game/gui/button/quick_idle_background.png new file mode 100644 index 0000000..0ecc7c9 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/button/quick_idle_background.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/frame.png b/src/vnpipe/renpy_templates/game/gui/frame.png new file mode 100644 index 0000000..4a8851d Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/frame.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/game_menu.png b/src/vnpipe/renpy_templates/game/gui/game_menu.png new file mode 100644 index 0000000..ffbba15 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/game_menu.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/main_menu.png b/src/vnpipe/renpy_templates/game/gui/main_menu.png new file mode 100644 index 0000000..ffbba15 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/main_menu.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/namebox.png b/src/vnpipe/renpy_templates/game/gui/namebox.png new file mode 100644 index 0000000..c24135c Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/namebox.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/notify.png b/src/vnpipe/renpy_templates/game/gui/notify.png new file mode 100644 index 0000000..c27b714 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/notify.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/nvl.png b/src/vnpipe/renpy_templates/game/gui/nvl.png new file mode 100644 index 0000000..5e55ec8 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/nvl.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/overlay/confirm.png b/src/vnpipe/renpy_templates/game/gui/overlay/confirm.png new file mode 100644 index 0000000..b95c47c Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/overlay/confirm.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/overlay/game_menu.png b/src/vnpipe/renpy_templates/game/gui/overlay/game_menu.png new file mode 100644 index 0000000..5c588b7 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/overlay/game_menu.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/overlay/main_menu.png b/src/vnpipe/renpy_templates/game/gui/overlay/main_menu.png new file mode 100644 index 0000000..e56f58e Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/overlay/main_menu.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/phone/button/choice_hover_background.png b/src/vnpipe/renpy_templates/game/gui/phone/button/choice_hover_background.png new file mode 100644 index 0000000..d2cdd41 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/phone/button/choice_hover_background.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/phone/button/choice_idle_background.png b/src/vnpipe/renpy_templates/game/gui/phone/button/choice_idle_background.png new file mode 100644 index 0000000..1570796 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/phone/button/choice_idle_background.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/phone/nvl.png b/src/vnpipe/renpy_templates/game/gui/phone/nvl.png new file mode 100644 index 0000000..51d2c7b Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/phone/nvl.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/phone/overlay/game_menu.png b/src/vnpipe/renpy_templates/game/gui/phone/overlay/game_menu.png new file mode 100644 index 0000000..564cff0 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/phone/overlay/game_menu.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/phone/overlay/main_menu.png b/src/vnpipe/renpy_templates/game/gui/phone/overlay/main_menu.png new file mode 100644 index 0000000..a599090 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/phone/overlay/main_menu.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/phone/textbox.png b/src/vnpipe/renpy_templates/game/gui/phone/textbox.png new file mode 100644 index 0000000..2321b23 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/phone/textbox.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/skip.png b/src/vnpipe/renpy_templates/game/gui/skip.png new file mode 100644 index 0000000..2f529ac Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/skip.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/textbox.png b/src/vnpipe/renpy_templates/game/gui/textbox.png new file mode 100644 index 0000000..9374b64 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/textbox.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/thoughtbubble.png b/src/vnpipe/renpy_templates/game/gui/thoughtbubble.png new file mode 100644 index 0000000..8d5d44b Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/thoughtbubble.png differ diff --git a/src/vnpipe/renpy_templates/game/gui/window_icon.png b/src/vnpipe/renpy_templates/game/gui/window_icon.png new file mode 100644 index 0000000..64b4326 Binary files /dev/null and b/src/vnpipe/renpy_templates/game/gui/window_icon.png differ diff --git a/src/vnpipe/renpy_templates/game/options.rpy b/src/vnpipe/renpy_templates/game/options.rpy new file mode 100644 index 0000000..8d12ee3 --- /dev/null +++ b/src/vnpipe/renpy_templates/game/options.rpy @@ -0,0 +1,208 @@ +## This file contains options that can be changed to customize your game. +## +## Lines beginning with two '#' marks are comments, and you shouldn't uncomment +## them. Lines beginning with a single '#' mark are commented-out code, and you +## may want to uncomment them when appropriate. + + +## Basics ###################################################################### + +## A human-readable name of the game. This is used to set the default window +## title, and shows up in the interface and error reports. +## +## The _() surrounding the string marks it as eligible for translation. + +define config.name = _("@@TITLE@@") + + +## Determines if the title given above is shown on the main menu screen. Set +## this to False to hide the title. + +define gui.show_name = True + + +## The version of the game. + +define config.version = "@@VERSION@@" + + +## Text that is placed on the game's about screen. Place the text between the +## triple-quotes, and leave a blank line between paragraphs. + +define gui.about = _p("""@@ABOUT@@""") + + +## A short name for the game used for executables and directories in the built +## distribution. This must be ASCII-only, and must not contain spaces, colons, +## or semicolons. + +define build.name = "@@BUILD_NAME@@" + + +## Sounds and music ############################################################ + +## These three variables control, among other things, which mixers are shown +## to the player by default. Setting one of these to False will hide the +## appropriate mixer. + +define config.has_sound = False +define config.has_music = False +define config.has_voice = True + + +## To allow the user to play a test sound on the sound or voice channel, +## uncomment a line below and use it to set a sample sound to play. + +# define config.sample_sound = "sample-sound.ogg" +# define config.sample_voice = "sample-voice.ogg" + + +## Uncomment the following line to set an audio file that will be played while +## the player is at the main menu. This file will continue playing into the +## game, until it is stopped or another file is played. + +# define config.main_menu_music = "main-menu-theme.ogg" + + +## Transitions ################################################################# +## +## These variables set transitions that are used when certain events occur. +## Each variable should be set to a transition, or None to indicate that no +## transition should be used. + +## Entering or exiting the game menu. + +define config.enter_transition = dissolve +define config.exit_transition = dissolve + + +## Between screens of the game menu. + +define config.intra_transition = dissolve + + +## A transition that is used after a game has been loaded. + +define config.after_load_transition = None + + +## Used when entering the main menu after the game has ended. + +define config.end_game_transition = None + + +## A variable to set the transition used when the game starts does not exist. +## Instead, use a with statement after showing the initial scene. + + +## Window management ########################################################### +## +## This controls when the dialogue window is displayed. If "show", it is always +## displayed. If "hide", it is only displayed when dialogue is present. If +## "auto", the window is hidden before scene statements and shown again once +## dialogue is displayed. +## +## After the game has started, this can be changed with the "window show", +## "window hide", and "window auto" statements. + +define config.window = "auto" + + +## Transitions used to show and hide the dialogue window + +define config.window_show_transition = Dissolve(.2) +define config.window_hide_transition = Dissolve(.2) + + +## Preference defaults ######################################################### + +## Controls the default text speed. The default, 0, is infinite, while any other +## number is the number of characters per second to type out. + +default preferences.text_cps = 0 + + +## The default auto-forward delay. Larger numbers lead to longer waits, with 0 +## to 30 being the valid range. + +default preferences.afm_time = 15 + + +## Save directory ############################################################## +## +## Controls the platform-specific place Ren'Py will place the save files for +## this game. The save files will be placed in: +## +## Windows: %APPDATA\RenPy\ +## +## Macintosh: $HOME/Library/RenPy/ +## +## Linux: $HOME/.renpy/ +## +## This generally should not be changed, and if it is, should always be a +## literal string, not an expression. + +define config.save_directory = "@@SAVE_DIR@@" + + +## Icon ######################################################################## +## +## The icon displayed on the taskbar or dock. + +define config.window_icon = "gui/window_icon.png" + + +## Build configuration ######################################################### +## +## This section controls how Ren'Py turns your project into distribution files. + +init python: + + ## The following functions take file patterns. File patterns are case- + ## insensitive, and matched against the path relative to the base directory, + ## with and without a leading /. If multiple patterns match, the first is + ## used. + ## + ## In a pattern: + ## + ## / is the directory separator. + ## + ## * matches all characters, except the directory separator. + ## + ## ** matches all characters, including the directory separator. + ## + ## For example, "*.txt" matches txt files in the base directory, "game/ + ## **.ogg" matches ogg files in the game directory or any of its + ## subdirectories, and "**.psd" matches psd files anywhere in the project. + + ## Classify files as None to exclude them from the built distributions. + + build.classify('**~', None) + build.classify('**.bak', None) + build.classify('**/.**', None) + build.classify('**/#**', None) + build.classify('**/thumbs.db', None) + + ## To archive files, classify them as 'archive'. + + # build.classify('game/**.png', 'archive') + # build.classify('game/**.jpg', 'archive') + + ## Files matching documentation patterns are duplicated in a mac app build, + ## so they appear in both the app and the zip file. + + build.documentation('*.html') + build.documentation('*.txt') + + +## A Google Play license key is required to perform in-app purchases. It can be +## found in the Google Play developer console, under "Monetize" > "Monetization +## Setup" > "Licensing". + +# define build.google_play_key = "..." + + +## The username and project name associated with an itch.io project, separated +## by a slash. + +# define build.itch_project = "renpytom/test-project" diff --git a/src/vnpipe/renpy_templates/game/screens.rpy b/src/vnpipe/renpy_templates/game/screens.rpy new file mode 100644 index 0000000..d601f80 --- /dev/null +++ b/src/vnpipe/renpy_templates/game/screens.rpy @@ -0,0 +1,1621 @@ +################################################################################ +## Initialization +################################################################################ + +init offset = -1 + + +################################################################################ +## Styles +################################################################################ + +style default: + properties gui.text_properties() + language gui.language + +style input: + properties gui.text_properties("input", accent=True) + adjust_spacing False + +style hyperlink_text: + properties gui.text_properties("hyperlink", accent=True) + hover_underline True + +style gui_text: + properties gui.text_properties("interface") + + +style button: + properties gui.button_properties("button") + +style button_text is gui_text: + properties gui.text_properties("button") + yalign 0.5 + + +style label_text is gui_text: + properties gui.text_properties("label", accent=True) + +style prompt_text is gui_text: + properties gui.text_properties("prompt") + + +style bar: + ysize gui.bar_size + left_bar Frame("gui/bar/left.png", gui.bar_borders, tile=gui.bar_tile) + right_bar Frame("gui/bar/right.png", gui.bar_borders, tile=gui.bar_tile) + +style vbar: + xsize gui.bar_size + top_bar Frame("gui/bar/top.png", gui.vbar_borders, tile=gui.bar_tile) + bottom_bar Frame("gui/bar/bottom.png", gui.vbar_borders, tile=gui.bar_tile) + +style scrollbar: + ysize gui.scrollbar_size + base_bar Frame("gui/scrollbar/horizontal_[prefix_]bar.png", gui.scrollbar_borders, tile=gui.scrollbar_tile) + thumb Frame("gui/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=gui.scrollbar_tile) + +style vscrollbar: + xsize gui.scrollbar_size + base_bar Frame("gui/scrollbar/vertical_[prefix_]bar.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile) + thumb Frame("gui/scrollbar/vertical_[prefix_]thumb.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile) + +style slider: + ysize gui.slider_size + base_bar Frame("gui/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile) + thumb "gui/slider/horizontal_[prefix_]thumb.png" + +style vslider: + xsize gui.slider_size + base_bar Frame("gui/slider/vertical_[prefix_]bar.png", gui.vslider_borders, tile=gui.slider_tile) + thumb "gui/slider/vertical_[prefix_]thumb.png" + + +style frame: + padding gui.frame_borders.padding + background Frame("gui/frame.png", gui.frame_borders, tile=gui.frame_tile) + + + +################################################################################ +## In-game screens +################################################################################ + + +## Say screen ################################################################## +## +## The say screen is used to display dialogue to the player. It takes two +## parameters, who and what, which are the name of the speaking character and +## the text to be displayed, respectively. (The who parameter can be None if no +## name is given.) +## +## This screen must create a text displayable with id "what", as Ren'Py uses +## this to manage text display. It can also create displayables with id "who" +## and id "window" to apply style properties. +## +## https://www.renpy.org/doc/html/screen_special.html#say + +screen say(who, what): + + window: + id "window" + + if who is not None: + + window: + id "namebox" + style "namebox" + text who id "who" + + text what id "what" + + + ## If there's a side image, display it above the text. Do not display on the + ## phone variant - there's no room. + if not renpy.variant("small"): + add SideImage() xalign 0.0 yalign 1.0 + + +## Make the namebox available for styling through the Character object. +init python: + config.character_id_prefixes.append('namebox') + +style window is default +style say_label is default +style say_dialogue is default +style say_thought is say_dialogue + +style namebox is default +style namebox_label is say_label + + +style window: + xalign 0.5 + xfill True + yalign gui.textbox_yalign + ysize gui.textbox_height + + background Image("gui/textbox.png", xalign=0.5, yalign=1.0) + +style namebox: + xpos gui.name_xpos + xanchor gui.name_xalign + xsize gui.namebox_width + ypos gui.name_ypos + ysize gui.namebox_height + + background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign) + padding gui.namebox_borders.padding + +style say_label: + properties gui.text_properties("name", accent=True) + xalign gui.name_xalign + yalign 0.5 + +style say_dialogue: + properties gui.text_properties("dialogue") + + xpos gui.dialogue_xpos + xsize gui.dialogue_width + ypos gui.dialogue_ypos + + adjust_spacing False + +## Input screen ################################################################ +## +## This screen is used to display renpy.input. The prompt parameter is used to +## pass a text prompt in. +## +## This screen must create an input displayable with id "input" to accept the +## various input parameters. +## +## https://www.renpy.org/doc/html/screen_special.html#input + +screen input(prompt): + style_prefix "input" + + window: + + vbox: + xanchor gui.dialogue_text_xalign + xpos gui.dialogue_xpos + xsize gui.dialogue_width + ypos gui.dialogue_ypos + + text prompt style "input_prompt" + input id "input" + +style input_prompt is default + +style input_prompt: + xalign gui.dialogue_text_xalign + properties gui.text_properties("input_prompt") + +style input: + xalign gui.dialogue_text_xalign + xmaximum gui.dialogue_width + + +## Choice screen ############################################################### +## +## This screen is used to display the in-game choices presented by the menu +## statement. The one parameter, items, is a list of objects, each with caption +## and action fields. +## +## https://www.renpy.org/doc/html/screen_special.html#choice + +screen choice(items): + style_prefix "choice" + + vbox: + for i in items: + textbutton i.caption action i.action + + +style choice_vbox is vbox +style choice_button is button +style choice_button_text is button_text + +style choice_vbox: + xalign 0.5 + ypos 405 + yanchor 0.5 + + spacing gui.choice_spacing + +style choice_button is default: + properties gui.button_properties("choice_button") + +style choice_button_text is default: + properties gui.text_properties("choice_button") + + +## Quick Menu screen ########################################################### +## +## The quick menu is displayed in-game to provide easy access to the out-of-game +## menus. + +screen quick_menu(): + + ## Ensure this appears on top of other screens. + zorder 100 + + if quick_menu: + + hbox: + style_prefix "quick" + style "quick_menu" + + textbutton _("Back") action Rollback() + textbutton _("History") action ShowMenu('history') + textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True) + textbutton _("Auto") action Preference("auto-forward", "toggle") + textbutton _("Save") action ShowMenu('save') + textbutton _("Q.Save") action QuickSave() + textbutton _("Q.Load") action QuickLoad() + textbutton _("Prefs") action ShowMenu('preferences') + + +## This code ensures that the quick_menu screen is displayed in-game, whenever +## the player has not explicitly hidden the interface. +init python: + config.overlay_screens.append("quick_menu") + +default quick_menu = True + +style quick_menu is hbox +style quick_button is default +style quick_button_text is button_text + +style quick_menu: + xalign 0.5 + yalign 1.0 + +style quick_button: + properties gui.button_properties("quick_button") + +style quick_button_text: + properties gui.text_properties("quick_button") + + +################################################################################ +## Main and Game Menu Screens +################################################################################ + +## Navigation screen ########################################################### +## +## This screen is included in the main and game menus, and provides navigation +## to other menus, and to start the game. + +screen navigation(): + + vbox: + style_prefix "navigation" + + xpos gui.navigation_xpos + yalign 0.5 + + spacing gui.navigation_spacing + + if main_menu: + + textbutton _("Start") action Start() + + else: + + textbutton _("History") action ShowMenu("history") + + textbutton _("Save") action ShowMenu("save") + + textbutton _("Load") action ShowMenu("load") + + textbutton _("Preferences") action ShowMenu("preferences") + + if _in_replay: + + textbutton _("End Replay") action EndReplay(confirm=True) + + elif not main_menu: + + textbutton _("Main Menu") action MainMenu() + + textbutton _("About") action ShowMenu("about") + + if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")): + + ## Help isn't necessary or relevant to mobile devices. + textbutton _("Help") action ShowMenu("help") + + if renpy.variant("pc"): + + ## The quit button is banned on iOS and unnecessary on Android and + ## Web. + textbutton _("Quit") action Quit(confirm=not main_menu) + + +style navigation_button is gui_button +style navigation_button_text is gui_button_text + +style navigation_button: + size_group "navigation" + properties gui.button_properties("navigation_button") + +style navigation_button_text: + properties gui.text_properties("navigation_button") + + +## Main Menu screen ############################################################ +## +## Used to display the main menu when Ren'Py starts. +## +## https://www.renpy.org/doc/html/screen_special.html#main-menu + +screen main_menu(): + + ## This ensures that any other menu screen is replaced. + tag menu + + add gui.main_menu_background + + ## This empty frame darkens the main menu. + frame: + style "main_menu_frame" + + ## The use statement includes another screen inside this one. The actual + ## contents of the main menu are in the navigation screen. + use navigation + + if gui.show_name: + + vbox: + style "main_menu_vbox" + + text "[config.name!t]": + style "main_menu_title" + + text "[config.version]": + style "main_menu_version" + + +style main_menu_frame is empty +style main_menu_vbox is vbox +style main_menu_text is gui_text +style main_menu_title is main_menu_text +style main_menu_version is main_menu_text + +style main_menu_frame: + xsize 420 + yfill True + + background "gui/overlay/main_menu.png" + +style main_menu_vbox: + xalign 1.0 + xoffset -30 + xmaximum 1200 + yalign 1.0 + yoffset -30 + +style main_menu_text: + properties gui.text_properties("main_menu", accent=True) + +style main_menu_title: + properties gui.text_properties("title") + +style main_menu_version: + properties gui.text_properties("version") + + +## Game Menu screen ############################################################ +## +## This lays out the basic common structure of a game menu screen. It's called +## with the screen title, and displays the background, title, and navigation. +## +## The scroll parameter can be None, or one of "viewport" or "vpgrid". +## This screen is intended to be used with one or more children, which are +## transcluded (placed) inside it. + +screen game_menu(title, scroll=None, yinitial=0.0, spacing=0): + + style_prefix "game_menu" + + if main_menu: + add gui.main_menu_background + else: + add gui.game_menu_background + + frame: + style "game_menu_outer_frame" + + hbox: + + ## Reserve space for the navigation section. + frame: + style "game_menu_navigation_frame" + + frame: + style "game_menu_content_frame" + + if scroll == "viewport": + + viewport: + yinitial yinitial + scrollbars "vertical" + mousewheel True + draggable True + pagekeys True + + side_yfill True + + vbox: + spacing spacing + + transclude + + elif scroll == "vpgrid": + + vpgrid: + cols 1 + yinitial yinitial + + scrollbars "vertical" + mousewheel True + draggable True + pagekeys True + + side_yfill True + + spacing spacing + + transclude + + else: + + transclude + + use navigation + + textbutton _("Return"): + style "return_button" + + action Return() + + label title + + if main_menu: + key "game_menu" action ShowMenu("main_menu") + + +style game_menu_outer_frame is empty +style game_menu_navigation_frame is empty +style game_menu_content_frame is empty +style game_menu_viewport is gui_viewport +style game_menu_side is gui_side +style game_menu_scrollbar is gui_vscrollbar + +style game_menu_label is gui_label +style game_menu_label_text is gui_label_text + +style return_button is navigation_button +style return_button_text is navigation_button_text + +style game_menu_outer_frame: + bottom_padding 45 + top_padding 180 + + background "gui/overlay/game_menu.png" + +style game_menu_navigation_frame: + xsize 420 + yfill True + +style game_menu_content_frame: + left_margin 60 + right_margin 30 + top_margin 15 + +style game_menu_viewport: + xsize 1380 + +style game_menu_vscrollbar: + unscrollable gui.unscrollable + +style game_menu_side: + spacing 15 + +style game_menu_label: + xpos 75 + ysize 180 + +style game_menu_label_text: + size 75 + color gui.accent_color + yalign 0.5 + +style return_button: + xpos gui.navigation_xpos + yalign 1.0 + yoffset -45 + + +## About screen ################################################################ +## +## This screen gives credit and copyright information about the game and Ren'Py. +## +## There's nothing special about this screen, and hence it also serves as an +## example of how to make a custom screen. + +screen about(): + + tag menu + + ## This use statement includes the game_menu screen inside this one. The + ## vbox child is then included inside the viewport inside the game_menu + ## screen. + use game_menu(_("About"), scroll="viewport"): + + style_prefix "about" + + vbox: + + label "[config.name!t]" + text _("Version [config.version!t]\n") + + ## gui.about is usually set in options.rpy. + if gui.about: + text "[gui.about!t]\n" + + text _("Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]") + + +style about_label is gui_label +style about_label_text is gui_label_text +style about_text is gui_text + +style about_label_text: + size gui.label_text_size + + +## Load and Save screens ####################################################### +## +## These screens are responsible for letting the player save the game and load +## it again. Since they share nearly everything in common, both are implemented +## in terms of a third screen, file_slots. +## +## https://www.renpy.org/doc/html/screen_special.html#save https:// +## www.renpy.org/doc/html/screen_special.html#load + +screen save(): + + tag menu + + use file_slots(_("Save")) + + +screen load(): + + tag menu + + use file_slots(_("Load")) + + +screen file_slots(title): + + default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves")) + + use game_menu(title): + + fixed: + + ## This ensures the input will get the enter event before any of the + ## buttons do. + order_reverse True + + ## The page name, which can be edited by clicking on a button. + button: + style "page_label" + + key_events True + xalign 0.5 + action page_name_value.Toggle() + + input: + style "page_label_text" + value page_name_value + + ## The grid of file slots. + grid gui.file_slot_cols gui.file_slot_rows: + style_prefix "slot" + + xalign 0.5 + yalign 0.5 + + spacing gui.slot_spacing + + for i in range(gui.file_slot_cols * gui.file_slot_rows): + + $ slot = i + 1 + + button: + action FileAction(slot) + + has vbox + + add FileScreenshot(slot) xalign 0.5 + + text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")): + style "slot_time_text" + + text FileSaveName(slot): + style "slot_name_text" + + key "save_delete" action FileDelete(slot) + + ## Buttons to access other pages. + vbox: + style_prefix "page" + + xalign 0.5 + yalign 1.0 + + hbox: + xalign 0.5 + + spacing gui.page_spacing + + textbutton _("<") action FilePagePrevious() + key "save_page_prev" action FilePagePrevious() + + if config.has_autosave: + textbutton _("{#auto_page}A") action FilePage("auto") + + if config.has_quicksave: + textbutton _("{#quick_page}Q") action FilePage("quick") + + ## range(1, 10) gives the numbers from 1 to 9. + for page in range(1, 10): + textbutton "[page]" action FilePage(page) + + textbutton _(">") action FilePageNext() + key "save_page_next" action FilePageNext() + + if config.has_sync: + if CurrentScreenName() == "save": + textbutton _("Upload Sync"): + action UploadSync() + xalign 0.5 + else: + textbutton _("Download Sync"): + action DownloadSync() + xalign 0.5 + + +style page_label is gui_label +style page_label_text is gui_label_text +style page_button is gui_button +style page_button_text is gui_button_text + +style slot_button is gui_button +style slot_button_text is gui_button_text +style slot_time_text is slot_button_text +style slot_name_text is slot_button_text + +style page_label: + xpadding 75 + ypadding 5 + xalign 0.5 + +style page_label_text: + textalign 0.5 + layout "subtitle" + hover_color gui.hover_color + +style page_button: + properties gui.button_properties("page_button") + +style page_button_text: + properties gui.text_properties("page_button") + +style slot_button: + properties gui.button_properties("slot_button") + +style slot_button_text: + properties gui.text_properties("slot_button") + + +## Preferences screen ########################################################## +## +## The preferences screen allows the player to configure the game to better suit +## themselves. +## +## https://www.renpy.org/doc/html/screen_special.html#preferences + +screen preferences(): + + tag menu + + use game_menu(_("Preferences"), scroll="viewport"): + + vbox: + + hbox: + box_wrap True + + if renpy.variant("pc") or renpy.variant("web"): + + vbox: + style_prefix "radio" + label _("Display") + textbutton _("Window") action Preference("display", "window") + textbutton _("Fullscreen") action Preference("display", "fullscreen") + + vbox: + style_prefix "check" + label _("Skip") + textbutton _("Unseen Text") action Preference("skip", "toggle") + textbutton _("After Choices") action Preference("after choices", "toggle") + textbutton _("Transitions") action InvertSelected(Preference("transitions", "toggle")) + + ## Additional vboxes of type "radio_pref" or "check_pref" can be + ## added here, to add additional creator-defined preferences. + + null height (4 * gui.pref_spacing) + + hbox: + style_prefix "slider" + box_wrap True + + vbox: + + label _("Text Speed") + + bar value Preference("text speed") + + label _("Auto-Forward Time") + + bar value Preference("auto-forward time") + + vbox: + + if config.has_music: + label _("Music Volume") + + hbox: + bar value Preference("music volume") + + if config.has_sound: + + label _("Sound Volume") + + hbox: + bar value Preference("sound volume") + + if config.sample_sound: + textbutton _("Test") action Play("sound", config.sample_sound) + + + if config.has_voice: + label _("Voice Volume") + + hbox: + bar value Preference("voice volume") + + if config.sample_voice: + textbutton _("Test") action Play("voice", config.sample_voice) + + if config.has_music or config.has_sound or config.has_voice: + null height gui.pref_spacing + + textbutton _("Mute All"): + action Preference("all mute", "toggle") + style "mute_all_button" + + +style pref_label is gui_label +style pref_label_text is gui_label_text +style pref_vbox is vbox + +style radio_label is pref_label +style radio_label_text is pref_label_text +style radio_button is gui_button +style radio_button_text is gui_button_text +style radio_vbox is pref_vbox + +style check_label is pref_label +style check_label_text is pref_label_text +style check_button is gui_button +style check_button_text is gui_button_text +style check_vbox is pref_vbox + +style slider_label is pref_label +style slider_label_text is pref_label_text +style slider_slider is gui_slider +style slider_button is gui_button +style slider_button_text is gui_button_text +style slider_pref_vbox is pref_vbox + +style mute_all_button is check_button +style mute_all_button_text is check_button_text + +style pref_label: + top_margin gui.pref_spacing + bottom_margin 3 + +style pref_label_text: + yalign 1.0 + +style pref_vbox: + xsize 338 + +style radio_vbox: + spacing gui.pref_button_spacing + +style radio_button: + properties gui.button_properties("radio_button") + foreground "gui/button/radio_[prefix_]foreground.png" + +style radio_button_text: + properties gui.text_properties("radio_button") + +style check_vbox: + spacing gui.pref_button_spacing + +style check_button: + properties gui.button_properties("check_button") + foreground "gui/button/check_[prefix_]foreground.png" + +style check_button_text: + properties gui.text_properties("check_button") + +style slider_slider: + xsize 525 + +style slider_button: + properties gui.button_properties("slider_button") + yalign 0.5 + left_margin 15 + +style slider_button_text: + properties gui.text_properties("slider_button") + +style slider_vbox: + xsize 675 + + +## History screen ############################################################## +## +## This is a screen that displays the dialogue history to the player. While +## there isn't anything special about this screen, it does have to access the +## dialogue history stored in _history_list. +## +## https://www.renpy.org/doc/html/history.html + +screen history(): + + tag menu + + ## Avoid predicting this screen, as it can be very large. + predict False + + use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0, spacing=gui.history_spacing): + + style_prefix "history" + + for h in _history_list: + + window: + + ## This lays things out properly if history_height is None. + has fixed: + yfit True + + if h.who: + + label h.who: + style "history_name" + substitute False + + ## Take the color of the who text from the Character, if + ## set. + if "color" in h.who_args: + text_color h.who_args["color"] + + $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags) + text what: + substitute False + + if not _history_list: + label _("The dialogue history is empty.") + + +## This determines what tags are allowed to be displayed on the history screen. + +define gui.history_allow_tags = { "alt", "noalt", "rt", "rb", "art" } + + +style history_window is empty + +style history_name is gui_label +style history_name_text is gui_label_text +style history_text is gui_text + +style history_label is gui_label +style history_label_text is gui_label_text + +style history_window: + xfill True + ysize gui.history_height + +style history_name: + xpos gui.history_name_xpos + xanchor gui.history_name_xalign + ypos gui.history_name_ypos + xsize gui.history_name_width + +style history_name_text: + min_width gui.history_name_width + textalign gui.history_name_xalign + +style history_text: + xpos gui.history_text_xpos + ypos gui.history_text_ypos + xanchor gui.history_text_xalign + xsize gui.history_text_width + min_width gui.history_text_width + textalign gui.history_text_xalign + layout ("subtitle" if gui.history_text_xalign else "tex") + +style history_label: + xfill True + +style history_label_text: + xalign 0.5 + + +## Help screen ################################################################# +## +## A screen that gives information about key and mouse bindings. It uses other +## screens (keyboard_help, mouse_help, and gamepad_help) to display the actual +## help. + +screen help(): + + tag menu + + default device = "keyboard" + + use game_menu(_("Help"), scroll="viewport"): + + style_prefix "help" + + vbox: + spacing 23 + + hbox: + + textbutton _("Keyboard") action SetScreenVariable("device", "keyboard") + textbutton _("Mouse") action SetScreenVariable("device", "mouse") + + if GamepadExists(): + textbutton _("Gamepad") action SetScreenVariable("device", "gamepad") + + if device == "keyboard": + use keyboard_help + elif device == "mouse": + use mouse_help + elif device == "gamepad": + use gamepad_help + + +screen keyboard_help(): + + hbox: + label _("Enter") + text _("Advances dialogue and activates the interface.") + + hbox: + label _("Space") + text _("Advances dialogue without selecting choices.") + + hbox: + label _("Arrow Keys") + text _("Navigate the interface.") + + hbox: + label _("Escape") + text _("Accesses the game menu.") + + hbox: + label _("Ctrl") + text _("Skips dialogue while held down.") + + hbox: + label _("Tab") + text _("Toggles dialogue skipping.") + + hbox: + label _("Page Up") + text _("Rolls back to earlier dialogue.") + + hbox: + label _("Page Down") + text _("Rolls forward to later dialogue.") + + hbox: + label "H" + text _("Hides the user interface.") + + hbox: + label "S" + text _("Takes a screenshot.") + + hbox: + label "V" + text _("Toggles assistive {a=https://www.renpy.org/l/voicing}self-voicing{/a}.") + + hbox: + label "Shift+A" + text _("Opens the accessibility menu.") + + +screen mouse_help(): + + hbox: + label _("Left Click") + text _("Advances dialogue and activates the interface.") + + hbox: + label _("Middle Click") + text _("Hides the user interface.") + + hbox: + label _("Right Click") + text _("Accesses the game menu.") + + hbox: + label _("Mouse Wheel Up") + text _("Rolls back to earlier dialogue.") + + hbox: + label _("Mouse Wheel Down") + text _("Rolls forward to later dialogue.") + + +screen gamepad_help(): + + hbox: + label _("Right Trigger\nA/Bottom Button") + text _("Advances dialogue and activates the interface.") + + hbox: + label _("Left Trigger\nLeft Shoulder") + text _("Rolls back to earlier dialogue.") + + hbox: + label _("Right Shoulder") + text _("Rolls forward to later dialogue.") + + hbox: + label _("D-Pad, Sticks") + text _("Navigate the interface.") + + hbox: + label _("Start, Guide, B/Right Button") + text _("Accesses the game menu.") + + hbox: + label _("Y/Top Button") + text _("Hides the user interface.") + + textbutton _("Calibrate") action GamepadCalibrate() + + +style help_button is gui_button +style help_button_text is gui_button_text +style help_label is gui_label +style help_label_text is gui_label_text +style help_text is gui_text + +style help_button: + properties gui.button_properties("help_button") + xmargin 12 + +style help_button_text: + properties gui.text_properties("help_button") + +style help_label: + xsize 375 + right_padding 30 + +style help_label_text: + size gui.text_size + xalign 1.0 + textalign 1.0 + + + +################################################################################ +## Additional screens +################################################################################ + + +## Confirm screen ############################################################## +## +## The confirm screen is called when Ren'Py wants to ask the player a yes or no +## question. +## +## https://www.renpy.org/doc/html/screen_special.html#confirm + +screen confirm(message, yes_action, no_action): + + ## Ensure other screens do not get input while this screen is displayed. + modal True + + zorder 200 + + style_prefix "confirm" + + add "gui/overlay/confirm.png" + + frame: + + vbox: + xalign .5 + yalign .5 + spacing 45 + + label _(message): + style "confirm_prompt" + xalign 0.5 + + hbox: + xalign 0.5 + spacing 150 + + textbutton _("Yes") action yes_action + textbutton _("No") action no_action + + ## Right-click and escape answer "no". + key "game_menu" action no_action + + +style confirm_frame is gui_frame +style confirm_prompt is gui_prompt +style confirm_prompt_text is gui_prompt_text +style confirm_button is gui_medium_button +style confirm_button_text is gui_medium_button_text + +style confirm_frame: + background Frame([ "gui/confirm_frame.png", "gui/frame.png"], gui.confirm_frame_borders, tile=gui.frame_tile) + padding gui.confirm_frame_borders.padding + xalign .5 + yalign .5 + +style confirm_prompt_text: + textalign 0.5 + layout "subtitle" + +style confirm_button: + properties gui.button_properties("confirm_button") + +style confirm_button_text: + properties gui.text_properties("confirm_button") + + +## Skip indicator screen ####################################################### +## +## The skip_indicator screen is displayed to indicate that skipping is in +## progress. +## +## https://www.renpy.org/doc/html/screen_special.html#skip-indicator + +screen skip_indicator(): + + zorder 100 + style_prefix "skip" + + frame: + + hbox: + spacing 9 + + text _("Skipping") + + text "▸" at delayed_blink(0.0, 1.0) style "skip_triangle" + text "▸" at delayed_blink(0.2, 1.0) style "skip_triangle" + text "▸" at delayed_blink(0.4, 1.0) style "skip_triangle" + + +## This transform is used to blink the arrows one after another. +transform delayed_blink(delay, cycle): + alpha .5 + + pause delay + + block: + linear .2 alpha 1.0 + pause .2 + linear .2 alpha 0.5 + pause (cycle - .4) + repeat + + +style skip_frame is empty +style skip_text is gui_text +style skip_triangle is skip_text + +style skip_frame: + ypos gui.skip_ypos + background Frame("gui/skip.png", gui.skip_frame_borders, tile=gui.frame_tile) + padding gui.skip_frame_borders.padding + +style skip_text: + size gui.notify_text_size + +style skip_triangle: + ## We have to use a font that has the BLACK RIGHT-POINTING SMALL TRIANGLE + ## glyph in it. + font "DejaVuSans.ttf" + + +## Notify screen ############################################################### +## +## The notify screen is used to show the player a message. (For example, when +## the game is quicksaved or a screenshot has been taken.) +## +## https://www.renpy.org/doc/html/screen_special.html#notify-screen + +screen notify(message): + + zorder 100 + style_prefix "notify" + + frame at notify_appear: + text "[message!tq]" + + timer 3.25 action Hide('notify') + + +transform notify_appear: + on show: + alpha 0 + linear .25 alpha 1.0 + on hide: + linear .5 alpha 0.0 + + +style notify_frame is empty +style notify_text is gui_text + +style notify_frame: + ypos gui.notify_ypos + + background Frame("gui/notify.png", gui.notify_frame_borders, tile=gui.frame_tile) + padding gui.notify_frame_borders.padding + +style notify_text: + properties gui.text_properties("notify") + + +## NVL screen ################################################################## +## +## This screen is used for NVL-mode dialogue and menus. +## +## https://www.renpy.org/doc/html/screen_special.html#nvl + + +screen nvl(dialogue, items=None): + + window: + style "nvl_window" + + has vbox: + spacing gui.nvl_spacing + + ## Displays dialogue in either a vpgrid or the vbox. + if gui.nvl_height: + + vpgrid: + cols 1 + yinitial 1.0 + + use nvl_dialogue(dialogue) + + else: + + use nvl_dialogue(dialogue) + + ## Displays the menu, if given. The menu may be displayed incorrectly if + ## config.narrator_menu is set to True. + for i in items: + + textbutton i.caption: + action i.action + style "nvl_button" + + add SideImage() xalign 0.0 yalign 1.0 + + +screen nvl_dialogue(dialogue): + + for d in dialogue: + + window: + id d.window_id + + fixed: + yfit gui.nvl_height is None + + if d.who is not None: + + text d.who: + id d.who_id + + text d.what: + id d.what_id + + +## This controls the maximum number of NVL-mode entries that can be displayed at +## once. +define config.nvl_list_length = gui.nvl_list_length + +style nvl_window is default +style nvl_entry is default + +style nvl_label is say_label +style nvl_dialogue is say_dialogue + +style nvl_button is button +style nvl_button_text is button_text + +style nvl_window: + xfill True + yfill True + + background "gui/nvl.png" + padding gui.nvl_borders.padding + +style nvl_entry: + xfill True + ysize gui.nvl_height + +style nvl_label: + xpos gui.nvl_name_xpos + xanchor gui.nvl_name_xalign + ypos gui.nvl_name_ypos + yanchor 0.0 + xsize gui.nvl_name_width + min_width gui.nvl_name_width + textalign gui.nvl_name_xalign + +style nvl_dialogue: + xpos gui.nvl_text_xpos + xanchor gui.nvl_text_xalign + ypos gui.nvl_text_ypos + xsize gui.nvl_text_width + min_width gui.nvl_text_width + textalign gui.nvl_text_xalign + layout ("subtitle" if gui.nvl_text_xalign else "tex") + +style nvl_thought is say_dialogue: + xpos gui.nvl_thought_xpos + xanchor gui.nvl_thought_xalign + ypos gui.nvl_thought_ypos + xsize gui.nvl_thought_width + min_width gui.nvl_thought_width + textalign gui.nvl_thought_xalign + layout ("subtitle" if gui.nvl_text_xalign else "tex") + +style nvl_button: + properties gui.button_properties("nvl_button") + xpos gui.nvl_button_xpos + xanchor gui.nvl_button_xalign + +style nvl_button_text: + properties gui.text_properties("nvl_button") + + +## Bubble screen ############################################################### +## +## The bubble screen is used to display dialogue to the player when using speech +## bubbles. The bubble screen takes the same parameters as the say screen, must +## create a displayable with the id of "what", and can create displayables with +## the "namebox", "who", and "window" ids. +## +## https://www.renpy.org/doc/html/bubble.html#bubble-screen + +screen bubble(who, what): + style_prefix "bubble" + + window: + id "window" + + if who is not None: + + window: + id "namebox" + style "bubble_namebox" + + text who: + id "who" + + text what: + id "what" + + default ctc = None + showif ctc: + add ctc + +style bubble_window is empty +style bubble_namebox is empty +style bubble_who is default +style bubble_what is default + +style bubble_window: + xpadding 30 + top_padding 5 + bottom_padding 5 + +style bubble_namebox: + xalign 0.5 + +style bubble_who: + xalign 0.5 + textalign 0.5 + color "#000" + +style bubble_what: + align (0.5, 0.5) + text_align 0.5 + layout "subtitle" + color "#000" + +define bubble.frame = Frame("gui/bubble.png", 55, 55, 55, 95) +define bubble.thoughtframe = Frame("gui/thoughtbubble.png", 55, 55, 55, 55) + +define bubble.properties = { + "bottom_left" : { + "window_background" : Transform(bubble.frame, xzoom=1, yzoom=1), + "window_bottom_padding" : 27, + }, + + "bottom_right" : { + "window_background" : Transform(bubble.frame, xzoom=-1, yzoom=1), + "window_bottom_padding" : 27, + }, + + "top_left" : { + "window_background" : Transform(bubble.frame, xzoom=1, yzoom=-1), + "window_top_padding" : 27, + }, + + "top_right" : { + "window_background" : Transform(bubble.frame, xzoom=-1, yzoom=-1), + "window_top_padding" : 27, + }, + + "thought" : { + "window_background" : bubble.thoughtframe, + } +} + +define bubble.expand_area = { + "bottom_left" : (0, 0, 0, 22), + "bottom_right" : (0, 0, 0, 22), + "top_left" : (0, 22, 0, 0), + "top_right" : (0, 22, 0, 0), + "thought" : (0, 0, 0, 0), +} + + + +################################################################################ +## Mobile Variants +################################################################################ + +style pref_vbox: + variant "medium" + xsize 675 + +## Since a mouse may not be present, we replace the quick menu with a version +## that uses fewer and bigger buttons that are easier to touch. +screen quick_menu(): + variant "touch" + + zorder 100 + + if quick_menu: + + hbox: + style "quick_menu" + style_prefix "quick" + + textbutton _("Back") action Rollback() + textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True) + textbutton _("Auto") action Preference("auto-forward", "toggle") + textbutton _("Menu") action ShowMenu() + + +style window: + variant "small" + background "gui/phone/textbox.png" + +style radio_button: + variant "small" + foreground "gui/phone/button/radio_[prefix_]foreground.png" + +style check_button: + variant "small" + foreground "gui/phone/button/check_[prefix_]foreground.png" + +style nvl_window: + variant "small" + background "gui/phone/nvl.png" + +style main_menu_frame: + variant "small" + background "gui/phone/overlay/main_menu.png" + +style game_menu_outer_frame: + variant "small" + background "gui/phone/overlay/game_menu.png" + +style game_menu_navigation_frame: + variant "small" + xsize 510 + +style game_menu_content_frame: + variant "small" + top_margin 0 + +style game_menu_viewport: + variant "small" + xsize 1305 + +style pref_vbox: + variant "small" + xsize 600 + +style bar: + variant "small" + ysize gui.bar_size + left_bar Frame("gui/phone/bar/left.png", gui.bar_borders, tile=gui.bar_tile) + right_bar Frame("gui/phone/bar/right.png", gui.bar_borders, tile=gui.bar_tile) + +style vbar: + variant "small" + xsize gui.bar_size + top_bar Frame("gui/phone/bar/top.png", gui.vbar_borders, tile=gui.bar_tile) + bottom_bar Frame("gui/phone/bar/bottom.png", gui.vbar_borders, tile=gui.bar_tile) + +style scrollbar: + variant "small" + ysize gui.scrollbar_size + base_bar Frame("gui/phone/scrollbar/horizontal_[prefix_]bar.png", gui.scrollbar_borders, tile=gui.scrollbar_tile) + thumb Frame("gui/phone/scrollbar/horizontal_[prefix_]thumb.png", gui.scrollbar_borders, tile=gui.scrollbar_tile) + +style vscrollbar: + variant "small" + xsize gui.scrollbar_size + base_bar Frame("gui/phone/scrollbar/vertical_[prefix_]bar.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile) + thumb Frame("gui/phone/scrollbar/vertical_[prefix_]thumb.png", gui.vscrollbar_borders, tile=gui.scrollbar_tile) + +style slider: + variant "small" + ysize gui.slider_size + base_bar Frame("gui/phone/slider/horizontal_[prefix_]bar.png", gui.slider_borders, tile=gui.slider_tile) + thumb "gui/phone/slider/horizontal_[prefix_]thumb.png" + +style vslider: + variant "small" + xsize gui.slider_size + base_bar Frame("gui/phone/slider/vertical_[prefix_]bar.png", gui.vslider_borders, tile=gui.slider_tile) + thumb "gui/phone/slider/vertical_[prefix_]thumb.png" + +style slider_vbox: + variant "small" + xsize None + +style slider_slider: + variant "small" + xsize 900 diff --git a/src/vnpipe/renpy_templates/game/support.rpy b/src/vnpipe/renpy_templates/game/support.rpy new file mode 100644 index 0000000..c5b21f9 --- /dev/null +++ b/src/vnpipe/renpy_templates/game/support.rpy @@ -0,0 +1,38 @@ +## Support code for the generated script: transitions, stage positions, colour +## treatments and the screen shake. Static; copied verbatim by `vnpipe renpy`. + +define vn_slow = Dissolve(2.0) +define vn_flash = Fade(0.1, 0.0, 0.6, color="#ffffff") + +transform vn_left: + xalign 0.15 yalign 1.0 + +transform vn_center: + xalign 0.5 yalign 1.0 + +transform vn_right: + xalign 0.85 yalign 1.0 + +transform tint_none: + matrixcolor IdentityMatrix() + +transform tint_dark: + matrixcolor TintMatrix("#8a8498") * BrightnessMatrix(-0.2) + +transform tint_red: + matrixcolor TintMatrix("#f0968a") * BrightnessMatrix(-0.05) + +transform vn_shake: + xoffset 0 yoffset 0 + linear 0.05 xoffset 18 yoffset -8 + linear 0.05 xoffset -18 yoffset 8 + linear 0.05 xoffset 14 yoffset -6 + linear 0.05 xoffset -14 yoffset 6 + linear 0.05 xoffset 8 yoffset -3 + linear 0.05 xoffset 0 yoffset 0 + +init python: + config.font_replacement_map["fonts/RobotoSlab-Regular.ttf", True, False] = ( + "fonts/RobotoSlab-Bold.ttf", False, False) + +define vn_move = MoveTransition(0.8) diff --git a/src/vnpipe/schema.py b/src/vnpipe/schema.py new file mode 100644 index 0000000..75d84f8 --- /dev/null +++ b/src/vnpipe/schema.py @@ -0,0 +1,37 @@ +"""JSON Schema validation helper shared by all pipeline stages.""" + +import json +from functools import cache +from typing import Any + +from jsonschema import Draft202012Validator + +from vnpipe import SCHEMA_DIR + + +class SchemaError(ValueError): + """Raised when an instance does not conform to its schema.""" + + +@cache +def _validator(schema_name: str) -> Draft202012Validator: + path = SCHEMA_DIR / f"{schema_name}.schema.json" + if not path.is_file(): + raise FileNotFoundError(f"unknown schema {schema_name!r}: {path} does not exist") + schema = json.loads(path.read_text(encoding="utf-8")) + Draft202012Validator.check_schema(schema) + return Draft202012Validator(schema) + + +def validate(instance: Any, schema_name: str) -> None: + """Validate ``instance`` against ``SCHEMA_DIR/.schema.json``. + + Raises ``SchemaError`` listing every problem found (path and message). + """ + errors = sorted(_validator(schema_name).iter_errors(instance), key=lambda e: list(e.path)) + if not errors: + return + problems = [f" at /{'/'.join(str(p) for p in e.absolute_path)}: {e.message}" for e in errors] + raise SchemaError( + f"{len(errors)} problem(s) validating against {schema_name!r}:\n" + "\n".join(problems) + ) diff --git a/src/vnpipe/schemas/annotated.schema.json b/src/vnpipe/schemas/annotated.schema.json new file mode 100644 index 0000000..5c69181 --- /dev/null +++ b/src/vnpipe/schemas/annotated.schema.json @@ -0,0 +1,224 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "vnpipe/annotated.schema.json", + "title": "Annotated play", + "description": "Output of `vnpipe annotate merge`: parsed lines plus one annotation each. The `ann` and line definitions duplicate annotation.schema.json and parsed.schema.json (schema.py has no cross-file registry); tests/test_annotation_schema.py guards against drift.", + "type": "object", + "required": [ + "work", + "parsed_sha256", + "fallback_chunks", + "scenes" + ], + "additionalProperties": false, + "properties": { + "work": { + "type": "string" + }, + "parsed_sha256": { + "type": "string", + "pattern": "^[0-9a-f]{64}$" + }, + "fallback_chunks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Chunks filled with deterministic fallback annotations instead of LLM output" + }, + "scenes": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "id", + "heading", + "lines" + ], + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "pattern": "^[a-z0-9_]+$" + }, + "heading": { + "type": "string" + }, + "lines": { + "type": "array", + "items": { + "$ref": "#/$defs/line" + } + } + } + } + } + }, + "$defs": { + "ann": { + "type": "object", + "required": [ + "speaker", + "kind", + "emotion", + "location", + "time_of_day", + "on_stage" + ], + "additionalProperties": false, + "properties": { + "speaker": { + "type": [ + "string", + "null" + ], + "description": "Cast id; 'narrator' for stage directions, the work's lyric voice id for unattributed verse" + }, + "kind": { + "enum": [ + "dialogue", + "narration", + "stage_direction" + ] + }, + "emotion": { + "enum": [ + "neutral", + "joyful", + "melancholic", + "solemn", + "ironic", + "angry", + "fearful", + "ecstatic" + ] + }, + "location": { + "type": "string" + }, + "time_of_day": { + "enum": [ + "dawn", + "day", + "dusk", + "night", + "timeless" + ] + }, + "on_stage": { + "type": "array", + "description": "Characters visible (or present) while this line is shown, with stage position", + "items": { + "type": "object", + "required": [ + "character", + "position" + ], + "additionalProperties": false, + "properties": { + "character": { + "type": "string" + }, + "position": { + "$ref": "#/$defs/position" + } + } + } + }, + "music": { + "enum": [ + "contemplative", + "comic", + "sacred", + "ominous", + "mystical", + "none", + null + ], + "description": "Optional music mood; null = keep current" + } + } + }, + "line": { + "type": "object", + "required": [ + "id", + "kind", + "speaker", + "speaker_note", + "speech", + "stanza", + "indent", + "text", + "src_line", + "ann" + ], + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "pattern": "^[a-z0-9_]+_[0-9]{4}$", + "description": "_<4-digit index within scene>" + }, + "kind": { + "enum": [ + "verse", + "direction", + "cast" + ], + "description": "verse = spoken/recited text line; direction = stage direction (parenthesised or italic setting text); cast = list of characters under a scene heading" + }, + "speaker": { + "type": [ + "string", + "null" + ], + "description": "Cast id from work.toml [speakers], null when nobody speaks (e.g. Dedicatoria, directions)" + }, + "speaker_note": { + "type": [ + "string", + "null" + ], + "description": "Inline note in the speaker heading, e.g. 'solo', 'aterrado'" + }, + "speech": { + "type": "integer", + "minimum": 0, + "description": "Index of the speech (speaker turn) within the scene; directions get the index of the speech they occur in or precede" + }, + "stanza": { + "type": "integer", + "minimum": 0, + "description": "Stanza index within the speech (blank line = new stanza)" + }, + "indent": { + "type": "integer", + "minimum": 0, + "description": "Leading spaces beyond the base verse indent (split verse lines are deeply indented)" + }, + "text": { + "type": "string", + "minLength": 1, + "description": "Text with markup removed (_italics_ underscores stripped)" + }, + "src_line": { + "type": "integer", + "minimum": 1, + "description": "1-based line number in the raw Gutenberg file" + }, + "ann": { + "$ref": "#/$defs/ann" + } + } + }, + "position": { + "enum": [ + "left", + "center", + "right" + ] + } + } +} diff --git a/src/vnpipe/schemas/annotation.schema.json b/src/vnpipe/schemas/annotation.schema.json new file mode 100644 index 0000000..d9ee5fc --- /dev/null +++ b/src/vnpipe/schemas/annotation.schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "vnpipe/annotation.schema.json", + "title": "Line annotations", + "description": "One annotation per parsed line. Produced by LLM sub-agents per chunk, merged and validated by `vnpipe annotate merge`. Enumerations of cast ids and locations are checked against work.toml at merge time.", + "type": "object", + "required": ["chunk_id", "input_sha256", "annotations"], + "additionalProperties": false, + "properties": { + "chunk_id": {"type": "string"}, + "input_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, + "annotations": { + "type": "array", + "items": {"$ref": "#/$defs/annotation"} + } + }, + "$defs": { + "position": {"enum": ["left", "center", "right"]}, + "annotation": { + "type": "object", + "required": ["id", "speaker", "kind", "emotion", "location", "time_of_day", "on_stage"], + "additionalProperties": false, + "properties": { + "id": {"type": "string"}, + "speaker": {"type": ["string", "null"], "description": "Cast id; 'narrator' for stage directions, the work's lyric voice id for unattributed verse"}, + "kind": {"enum": ["dialogue", "narration", "stage_direction"]}, + "emotion": {"enum": ["neutral", "joyful", "melancholic", "solemn", "ironic", "angry", "fearful", "ecstatic"]}, + "location": {"type": "string"}, + "time_of_day": {"enum": ["dawn", "day", "dusk", "night", "timeless"]}, + "on_stage": { + "type": "array", + "description": "Characters visible (or present) while this line is shown, with stage position", + "items": { + "type": "object", + "required": ["character", "position"], + "additionalProperties": false, + "properties": { + "character": {"type": "string"}, + "position": {"$ref": "#/$defs/position"} + } + } + }, + "music": {"enum": ["contemplative", "comic", "sacred", "ominous", "mystical", "none", null], "description": "Optional music mood; null = keep current"} + } + } + } +} diff --git a/src/vnpipe/schemas/manifest.schema.json b/src/vnpipe/schemas/manifest.schema.json new file mode 100644 index 0000000..57fff83 --- /dev/null +++ b/src/vnpipe/schemas/manifest.schema.json @@ -0,0 +1,120 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "vnpipe/manifest.schema.json", + "title": "Asset manifest", + "type": "object", + "required": [ + "base_prompt", + "templates", + "assets" + ], + "additionalProperties": false, + "properties": { + "base_prompt": { + "type": "string" + }, + "assets": { + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "kind", + "prompt", + "source", + "file", + "sha256", + "status" + ], + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "pattern": "^(bg|sprite)_[a-z0-9_]+$", + "description": "bg_[_] or sprite__" + }, + "kind": { + "enum": [ + "background", + "sprite" + ] + }, + "character": { + "type": "string" + }, + "expression": { + "type": "string" + }, + "prompt": { + "type": "string", + "description": "Asset-specific prompt; the full prompt sent is base_prompt + kind prompt + this" + }, + "source": { + "enum": [ + "chatgpt-web", + "zenvairo-media", + "placeholder", + "manual" + ] + }, + "generation_id": { + "type": [ + "string", + "null" + ] + }, + "reference": { + "type": [ + "string", + "null" + ], + "description": "Asset id used as reference image (identity consistency)" + }, + "raw_file": { + "type": [ + "string", + "null" + ], + "description": "Original generated image, relative to the work's assets dir" + }, + "file": { + "type": "string", + "description": "Final processed image used by the game, relative to the work's assets dir" + }, + "sha256": { + "type": [ + "string", + "null" + ], + "pattern": "^[0-9a-f]{64}$" + }, + "status": { + "enum": [ + "planned", + "generated", + "processed", + "approved", + "rejected", + "placeholder" + ] + }, + "notes": { + "type": "string" + } + } + } + }, + "templates": { + "type": "object", + "required": [ + "background", + "sprite", + "variant" + ], + "additionalProperties": { + "type": "string" + }, + "description": "Kind-specific prompt templates appended after base_prompt" + } + } +} diff --git a/src/vnpipe/schemas/parsed.schema.json b/src/vnpipe/schemas/parsed.schema.json new file mode 100644 index 0000000..90d4336 --- /dev/null +++ b/src/vnpipe/schemas/parsed.schema.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "vnpipe/parsed.schema.json", + "title": "Parsed play", + "description": "Deterministic parser output: scenes made of ordered lines.", + "type": "object", + "required": ["work", "source_sha256", "scenes"], + "additionalProperties": false, + "properties": { + "work": {"type": "string"}, + "source_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, + "scenes": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["id", "heading", "lines"], + "additionalProperties": false, + "properties": { + "id": {"type": "string", "pattern": "^[a-z0-9_]+$"}, + "heading": {"type": "string"}, + "lines": { + "type": "array", + "items": { + "type": "object", + "required": ["id", "kind", "speaker", "speaker_note", "speech", "stanza", "indent", "text", "src_line"], + "additionalProperties": false, + "properties": { + "id": {"type": "string", "pattern": "^[a-z0-9_]+_[0-9]{4}$", "description": "_<4-digit index within scene>"}, + "kind": {"enum": ["verse", "direction", "cast"], "description": "verse = spoken/recited text line; direction = stage direction (parenthesised or italic setting text); cast = list of characters under a scene heading"}, + "speaker": {"type": ["string", "null"], "description": "Cast id from work.toml [speakers], null when nobody speaks (e.g. Dedicatoria, directions)"}, + "speaker_note": {"type": ["string", "null"], "description": "Inline note in the speaker heading, e.g. 'solo', 'aterrado'"}, + "speech": {"type": "integer", "minimum": 0, "description": "Index of the speech (speaker turn) within the scene; directions get the index of the speech they occur in or precede"}, + "stanza": {"type": "integer", "minimum": 0, "description": "Stanza index within the speech (blank line = new stanza)"}, + "indent": {"type": "integer", "minimum": 0, "description": "Leading spaces beyond the base verse indent (split verse lines are deeply indented)"}, + "text": {"type": "string", "minLength": 1, "description": "Text with markup removed (_italics_ underscores stripped)"}, + "src_line": {"type": "integer", "minimum": 1, "description": "1-based line number in the raw Gutenberg file"} + } + } + } + } + } + } + } +} diff --git a/src/vnpipe/text.py b/src/vnpipe/text.py new file mode 100644 index 0000000..62a5346 --- /dev/null +++ b/src/vnpipe/text.py @@ -0,0 +1,258 @@ +"""Text stage: fetch the Gutenberg source, clean/scope it and parse it into parsed.json.""" + +import argparse +import hashlib +import json +import re +import urllib.request +from pathlib import Path +from typing import Any + +from vnpipe.config import Work, load_work +from vnpipe.schema import validate + +BASE_INDENT = 4 +UPPER = "A-ZÁÉÍÓÚÜÑ" +ILLUSTRATION_RE = re.compile(r"^\[Ilustración[^\]]*\]$") +HEADING_RE = re.compile( + rf"^(?P[{UPPER}][{UPPER} ]*?)" + r"(?:,\s*_(?P[^_]+)_|\s*\(_(?P[^_]+)_\))?$" +) + +Line = tuple[int, str] # (1-based raw line number, text without line ending) + + +class ParseError(ValueError): + """The source text has a structure the parser does not know.""" + + +def _split(raw_text: str) -> list[str]: + text = raw_text.removeprefix("").replace("\r\n", "\n").replace("\r", "\n") + return text.split("\n") + + +def clean(raw_text: str, scope_cfg: dict[str, Any]) -> list[Line]: + """Cut the raw text to the configured scope and drop noise. + + The start marker is the first line whose stripped text equals ``start_marker``; the end + marker is the ``end_occurrence``-th such line after it (exclusive). Illustration markers + are removed, trailing whitespace stripped and blank runs collapsed to a single blank line. + Returned line numbers refer to the raw file. + """ + lines = _split(raw_text) + start_marker, end_marker = scope_cfg["start_marker"], scope_cfg["end_marker"] + occurrence = scope_cfg.get("end_occurrence", 1) + start = next((i for i, ln in enumerate(lines) if ln.strip() == start_marker), None) + if start is None: + raise ParseError(f"scope start marker {start_marker!r} not found") + matches = [i for i in range(start + 1, len(lines)) if lines[i].strip() == end_marker] + if len(matches) < occurrence: + raise ParseError(f"scope end marker {end_marker!r} occurrence {occurrence} not found") + end = matches[occurrence - 1] + + out: list[Line] = [] + for i in range(start, end): + text = lines[i].rstrip() + if ILLUSTRATION_RE.match(text.strip()): + continue + if not text and out and not out[-1][1]: + continue + out.append((i + 1, text)) + while out and not out[-1][1]: + out.pop() + return out + + +def clean_text(lines: list[Line]) -> str: + """Render cleaned lines as the contents of play.txt.""" + return "\n".join(text for _, text in lines) + "\n" + + +def _strip_markup(text: str) -> str: + return re.sub(r"\s+", " ", text.replace("_", "")).strip() + + +def _indent(text: str) -> int: + return len(text) - len(text.lstrip(" ")) + + +def _match_heading(text: str) -> re.Match[str] | None: + return HEADING_RE.match(text) if text and not text[0].isspace() else None + + +class _SceneBuilder: + def __init__(self, scene_cfg: dict[str, Any]): + self.id: str = scene_cfg["id"] + self.heading: str = scene_cfg["heading"] + self.lines: list[dict[str, Any]] = [] + self.speaker: str | None = None + self.note: str | None = None + self.speech = -1 + self.stanza = 0 + self.has_verse = False + self.pending_blank = False + + def add(self, kind: str, text: str, src: int, indent: int = 0, speaker: Any = False) -> None: + self.lines.append( + { + "id": f"{self.id}_{len(self.lines) + 1:04d}", + "kind": kind, + "speaker": self.speaker if speaker is False else speaker, + "speaker_note": self.note if speaker is False else None, + "speech": max(self.speech, 0), + "stanza": self.stanza, + "indent": indent, + "text": text, + "src_line": src, + } + ) + + def start_speech(self, speaker: str, note: str | None) -> None: + self.speech += 1 + self.speaker, self.note = speaker, note + self.stanza, self.has_verse, self.pending_blank = 0, False, False + + def verse(self, text: str, src: int) -> None: + if self.pending_blank and self.has_verse: + self.stanza += 1 + self.pending_blank, self.has_verse = False, True + self.add("verse", _strip_markup(text), src, max(_indent(text) - BASE_INDENT, 0)) + + def to_dict(self) -> dict[str, Any]: + return {"id": self.id, "heading": self.heading, "lines": self.lines} + + +def parse(lines: list[Line], work_cfg: dict[str, Any], source_sha256: str) -> dict[str, Any]: + """Parse cleaned lines into the structure described by parsed.schema.json.""" + scenes_by_heading = {s["heading"]: s for s in work_cfg["scenes"]} + speakers: dict[str, str] = work_cfg["speakers"] + scenes: list[_SceneBuilder] = [] + cur: _SceneBuilder | None = None + expect_block = False + i = 0 + + def fail(src: int, msg: str) -> ParseError: + return ParseError(f"raw line {src}: {msg}") + + while i < len(lines): + src, text = lines[i] + stripped = text.strip() + i += 1 + if not stripped: + if cur: + cur.pending_blank = True + continue + + if not text[0].isspace() and stripped in scenes_by_heading: + cur = _SceneBuilder(scenes_by_heading[stripped]) + scenes.append(cur) + expect_block = True + continue + if cur is None: + raise fail(src, f"text before any scene heading: {stripped!r}") + + indent = _indent(text) + match = _match_heading(text) + is_heading = match is not None + if indent and indent < BASE_INDENT: + # Indented heading (a typesetting quirk): only accepted for known speakers. + m = HEADING_RE.match(stripped) + nxt = lines[i][1].strip() if i < len(lines) else "" + if m and m["name"] in speakers and not nxt: + match, is_heading = m, True + + if expect_block: + expect_block = False + if indent < BASE_INDENT and (stripped.startswith("_") or not is_heading or indent): + block = [stripped] + while i < len(lines) and lines[i][1].strip(): + block.append(lines[i][1].strip()) + i += 1 + kind = "direction" if stripped.startswith("_") else "cast" + cur.add(kind, _strip_markup(" ".join(block)), src, speaker=None) + continue + + if stripped.startswith("(_"): + block = [stripped] + while not block[-1].endswith("_)"): + if i >= len(lines) or not lines[i][1].strip(): + raise fail(src, "unterminated stage direction") + block.append(lines[i][1].strip()) + i += 1 + joined = " ".join(block) + cur.add("direction", _strip_markup(joined[2:-2]), src, speaker=None) + continue + + if is_heading and match is not None: + name = match["name"].strip() + if name not in speakers: + raise fail(src, f"unknown speaker or scene heading {stripped!r}") + note = match["note1"] or match["note2"] + cur.start_speech(speakers[name], note.strip() if note else None) + continue + + if indent == 0: + raise fail(src, f"unrecognised line {stripped!r}") + cur.verse(text, src) + + return { + "work": work_cfg["work"]["id"], + "source_sha256": source_sha256, + "scenes": [s.to_dict() for s in scenes], + } + + +def build(raw_bytes: bytes, work_cfg: dict[str, Any]) -> tuple[list[Line], dict[str, Any]]: + """Clean and parse raw file bytes; returns (clean lines, validated parsed dict).""" + lines = clean(raw_bytes.decode("utf-8"), work_cfg["scope"]) + parsed = parse(lines, work_cfg, hashlib.sha256(raw_bytes).hexdigest()) + validate(parsed, "parsed") + return lines, parsed + + +def _raw_path(work: Work) -> Path: + return work.path(work.data["source"]["raw_file"]) + + +def cmd_fetch(args: argparse.Namespace) -> int: + work = load_work(args.work) + dest = _raw_path(work) + if dest.exists(): + print(f"fetch: {dest} already present, nothing to do") + return 0 + url = work.data["source"]["url"] + dest.parent.mkdir(parents=True, exist_ok=True) + request = urllib.request.Request(url, headers={"User-Agent": "vnpipe/0.1"}) + with urllib.request.urlopen(request, timeout=60) as response: # noqa: S310 + payload = response.read() + tmp = dest.with_suffix(dest.suffix + ".part") + tmp.write_bytes(payload) + tmp.replace(dest) + print(f"fetch: wrote {dest} ({len(payload)} bytes)") + return 0 + + +def cmd_parse(args: argparse.Namespace) -> int: + work = load_work(args.work) + raw = _raw_path(work) + if not raw.is_file(): + raise SystemExit(f"parse: {raw} missing; run `vnpipe fetch` first") + lines, parsed = build(raw.read_bytes(), work.data) + out_dir = work.path("data") + out_dir.mkdir(parents=True, exist_ok=True) + (out_dir / "play.txt").write_text(clean_text(lines), encoding="utf-8", newline="\n") + payload = json.dumps(parsed, ensure_ascii=False, indent=2) + "\n" + (out_dir / "parsed.json").write_text(payload, encoding="utf-8", newline="\n") + for scene in parsed["scenes"]: + kinds: dict[str, int] = {} + for ln in scene["lines"]: + kinds[ln["kind"]] = kinds.get(ln["kind"], 0) + 1 + print(f"parse: {scene['id']}: {kinds}") + return 0 + + +def register(subparsers: argparse._SubParsersAction) -> None: + fetch = subparsers.add_parser("fetch", help="Download the Gutenberg source if missing") + fetch.set_defaults(handler=cmd_fetch) + parse_cmd = subparsers.add_parser("parse", help="Clean, scope and parse the source text") + parse_cmd.set_defaults(handler=cmd_parse) diff --git a/tests/fixtures/annotated_mini.json b/tests/fixtures/annotated_mini.json new file mode 100644 index 0000000..06ebda6 --- /dev/null +++ b/tests/fixtures/annotated_mini.json @@ -0,0 +1,699 @@ +{ + "work": "mini", + "parsed_sha256": "0000000000000000000000000000000000000000000000000000000000000000", + "fallback_chunks": [], + "scenes": [ + { + "id": "lyric", + "heading": "LÍRICA", + "lines": [ + { + "id": "lyric_0001", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "Tornáis de nuevo, imágenes flotantes,", + "src_line": 100, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [], + "music": "sacred" + } + }, + { + "id": "lyric_0002", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "que un día contemplé,", + "src_line": 101, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0003", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "¿Asiros podré feliz?", + "src_line": 102, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0004", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "Venid, y envueltas en el velo,", + "src_line": 103, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0005", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "girad en derredor;", + "src_line": 104, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0006", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "el corazón aún late,", + "src_line": 105, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0007", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "si aspira vuestro aliento.", + "src_line": 106, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0008", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "Hoy vuelven de otro tiempo", + "src_line": 107, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0009", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "la alegre historia,", + "src_line": 108, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0010", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 1, + "indent": 0, + "text": "Y los queridos seres", + "src_line": 120, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + }, + { + "id": "lyric_0011", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 1, + "indent": 0, + "text": "que la dicha nos robó.", + "src_line": 121, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "melancholic", + "location": "dedication", + "time_of_day": "timeless", + "on_stage": [] + } + } + ] + }, + { + "id": "talk", + "heading": "CONVERSACIÓN", + "lines": [ + { + "id": "talk_0001", + "kind": "cast", + "speaker": null, + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "EL DIRECTOR, EL POETA", + "src_line": 200, + "ann": { + "speaker": null, + "kind": "narration", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [] + } + }, + { + "id": "talk_0002", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 2, + "text": "Decid, buenos amigos,", + "src_line": 201, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "joyful", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + } + ] + } + }, + { + "id": "talk_0003", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "de mi afán camaradas,", + "src_line": 202, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + } + ] + } + }, + { + "id": "talk_0004", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "¿qué pensáis [ahora]?", + "src_line": 203, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + } + ] + } + }, + { + "id": "talk_0005", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "Es mi {anhelo} preferente", + "src_line": 204, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + } + ] + } + }, + { + "id": "talk_0006", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "al público dar gusto:", + "src_line": 205, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + } + ] + } + }, + { + "id": "talk_0007", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "lo \"mejor\" que pueda.", + "src_line": 206, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + } + ] + } + }, + { + "id": "talk_0008", + "kind": "verse", + "speaker": "poet", + "speaker_note": null, + "speech": 1, + "stanza": 0, + "indent": 26, + "text": "¡Vete, profano!", + "src_line": 207, + "ann": { + "speaker": "poet", + "kind": "dialogue", + "emotion": "angry", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + }, + { + "character": "poet", + "position": "right" + } + ] + } + }, + { + "id": "talk_0009", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 2, + "stanza": 0, + "indent": 20, + "text": "Calla, que oye.", + "src_line": 208, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + }, + { + "character": "poet", + "position": "right" + } + ] + } + }, + { + "id": "talk_0010", + "kind": "direction", + "speaker": null, + "speaker_note": null, + "speech": 2, + "stanza": 0, + "indent": 0, + "text": "Se aleja.", + "src_line": 209, + "ann": { + "speaker": "narrator", + "kind": "stage_direction", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + }, + { + "character": "poet", + "position": "right" + } + ] + } + }, + { + "id": "talk_0011", + "kind": "verse", + "speaker": "poet", + "speaker_note": null, + "speech": 3, + "stanza": 0, + "indent": 0, + "text": "Mi pecho se oprime", + "src_line": 210, + "ann": { + "speaker": "poet", + "kind": "dialogue", + "emotion": "melancholic", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "poet", + "position": "center" + } + ] + } + }, + { + "id": "talk_0012", + "kind": "verse", + "speaker": "poet", + "speaker_note": null, + "speech": 3, + "stanza": 0, + "indent": 0, + "text": "bajo tanto peso,", + "src_line": 211, + "ann": { + "speaker": "poet", + "kind": "dialogue", + "emotion": "melancholic", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "poet", + "position": "center" + } + ] + } + }, + { + "id": "talk_0013", + "kind": "verse", + "speaker": "poet", + "speaker_note": null, + "speech": 3, + "stanza": 0, + "indent": 0, + "text": "y el ocaso llega.", + "src_line": 212, + "ann": { + "speaker": "poet", + "kind": "dialogue", + "emotion": "melancholic", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "poet", + "position": "center" + } + ] + } + }, + { + "id": "talk_0014", + "kind": "verse", + "speaker": "lord", + "speaker_note": null, + "speech": 4, + "stanza": 0, + "indent": 0, + "text": "¡Mi siervo!", + "src_line": 213, + "ann": { + "speaker": "lord", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "poet", + "position": "right" + }, + { + "character": "lord", + "position": "center" + } + ], + "music": "none" + } + }, + { + "id": "talk_0015", + "kind": "verse", + "speaker": "lord", + "speaker_note": null, + "speech": 4, + "stanza": 0, + "indent": 0, + "text": "Tentarlo puedes.", + "src_line": 214, + "ann": { + "speaker": "lord", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "poet", + "position": "right" + }, + { + "character": "lord", + "position": "center" + } + ] + } + }, + { + "id": "talk_0016", + "kind": "verse", + "speaker": "director", + "speaker_note": null, + "speech": 5, + "stanza": 0, + "indent": 0, + "text": "Basta ya de charla.", + "src_line": 215, + "ann": { + "speaker": "director", + "kind": "dialogue", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + }, + { + "character": "poet", + "position": "right" + } + ] + } + }, + { + "id": "talk_0017", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 6, + "stanza": 0, + "indent": 0, + "text": "Callan los pájaros;", + "src_line": 216, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [] + } + }, + { + "id": "talk_0018", + "kind": "verse", + "speaker": null, + "speaker_note": null, + "speech": 6, + "stanza": 0, + "indent": 0, + "text": "la noche cae.", + "src_line": 217, + "ann": { + "speaker": "poet_voice", + "kind": "narration", + "emotion": "neutral", + "location": "stage", + "time_of_day": "day", + "on_stage": [] + } + }, + { + "id": "talk_0019", + "kind": "verse", + "speaker": "poet", + "speaker_note": null, + "speech": 7, + "stanza": 0, + "indent": 0, + "text": "Despierto.", + "src_line": 218, + "ann": { + "speaker": "poet", + "kind": "dialogue", + "emotion": "angry", + "location": "stage", + "time_of_day": "day", + "on_stage": [ + { + "character": "director", + "position": "left" + }, + { + "character": "poet", + "position": "right" + } + ] + } + } + ] + } + ] +} diff --git a/tests/fixtures/mini_raw.txt b/tests/fixtures/mini_raw.txt new file mode 100644 index 0000000..b64fe26 --- /dev/null +++ b/tests/fixtures/mini_raw.txt @@ -0,0 +1,103 @@ +The Project Gutenberg eBook of Fausto + +*** START OF THE PROJECT GUTENBERG EBOOK FAUSTO *** + + DEDICATORIA ................................................ 17 + TEODORO LLORENTE. + +DEDICATORIA + + + Tornáis de nuevo, hermosas imágenes flotantes, + que dulce y melancólico un día contemplé. + ¿Asiros y teneros podré feliz como antes? + ¡Aún vuela hacia vosotras el alma cuando os ve! + + Hoy vuelven de otro tiempo mejor la alegre historia, + y las risueñas sombras de la feliz edad, + +[Ilustración] + + + + +[Ilustración] + +PRÓLOGO EN EL TEATRO + + +EL DIRECTOR, EL POETA DRAMÁTICO, EL GRACIOSO + +EL DIRECTOR + + Decid, buenos amigos, + de mi afán camaradas y testigos, + ¿qué pensáis? Es mi anhelo preferente + + En complacer al público soy ducho; + mas tranquilo no estoy, no estoy sereno: + +EL POETA + + ¡Vete, profano! + ¡Vete! Romper mi servidumbre quiero. + +[Ilustración] + +PRÓLOGO EN EL CIELO + + + EL SEÑOR, + _los_ EJÉRCITOS CELESTIALES. _Después_ MEFISTÓFELES. + _Los tres_ ARCÁNGELES _se adelantan_ + +EL SEÑOR + + ¿Conoces a Fausto? + + MEFISTÓFELES + + ¿A Fausto + el Doctor? + +EL SEÑOR + + ¡Mi siervo! + +(_El cielo se cierra y los Arcángeles se dispersan._) + +MEFISTÓFELES, _solo_ + + De vez en cuando olvido mis rencillas, + y busco al Viejo, y pláticas entablo. + +DE NOCHE + + +_En un aposento gótico, estrecho, con elevada bóveda_, FAUSTO +_intranquilo sentado a su pupitre._ + +FAUSTO + + Filosofía, ¡ay, Dios!, Jurisprudencia, + Medicina además, y Teología, + la _Razón_ lo nombra + +(_Toma el libro y pronuncia misteriosamente el nombre del Espíritu. +Enciéndese una luz rojiza y trémula. El Espíritu aparece en ella._) + +EL ESPÍRITU + + ¿Quién me llama? + +FAUSTO (_aterrado_) + + ¿No a ti? Pues dime: ¿a quién? ¿Imagen + soy de Dios, y ni a ti llegar podría? + +(_Llaman._) + +WAGNER + + Not in scope. +*** END OF THE PROJECT GUTENBERG EBOOK FAUSTO *** diff --git a/tests/fixtures/mini_work/work.toml b/tests/fixtures/mini_work/work.toml new file mode 100644 index 0000000..e4190a1 --- /dev/null +++ b/tests/fixtures/mini_work/work.toml @@ -0,0 +1,61 @@ +# Minimal work used by tests/test_renpy_gen.py (no assets: the generator falls back to placeholders). +[work] +id = "mini" +title = "Mini" +subtitle = "Fixture work" +author = "A. Author" +translator = "T. Translator" +language = "es" + +[cast.narrator] +name = "" +color = "#d8cfc0" + +[cast.poet_voice] +name = "" +color = "#e8dcc2" +sprite = false + +[cast.director] +name = "El Director" +color = "#c9a25b" +sprite = true +expressions = { neutral = "neutral", joyful = "pleased", angry = "worried" } + +[cast.poet] +name = "El Poeta" +color = "#8fa8c8" +sprite = true +expressions = { neutral = "neutral", melancholic = "neutral", angry = "indignant" } + +[cast.lord] +name = "El Señor" +color = "#fff4c8" +sprite = false + +[staging.lyric] +bg = "bg_dedication" +mode = "nvl" + +[staging.talk] +bg = "bg_theatre" +mode = "adv" + +[[cues]] +at = "talk_0014" +bg = "bg_heaven" +transition = "slow" +tint = "dark" +hide_all = true + +[[cues]] +at = "talk_0016" +mode = "nvl" + +[[cues]] +at = "talk_0019" +bg = "bg_theatre" +transition = "flash" +tint = "none" +mode = "adv" +shake = true diff --git a/tests/test_annotate.py b/tests/test_annotate.py new file mode 100644 index 0000000..bb4d03b --- /dev/null +++ b/tests/test_annotate.py @@ -0,0 +1,376 @@ +import json +from pathlib import Path + +import pytest + +from vnpipe import annotate +from vnpipe.cli import main +from vnpipe.config import Work, load_work + +WORK_TOML = """ +[work] +id = "t" +lyric_voice = "voice" + +[[scenes]] +heading = "ONE" +id = "one" +location = "hall" +time_of_day = "day" + +[[scenes]] +heading = "TWO" +id = "two" +location = "yard" +time_of_day = "night" + +[cast.narrator] +name = "" +[cast.voice] +name = "" +sprite = false +[cast.alice] +name = "Alice" +sprite = true +[cast.bob] +name = "Bob" +sprite = true +[cast.god] +name = "God" +sprite = false +""" + + +def _line(scene, n, speech, stanza=0, kind="verse", speaker="alice", note=None): + return { + "id": f"{scene}_{n:04d}", + "kind": kind, + "speaker": speaker if kind == "verse" else None, + "speaker_note": note, + "speech": speech, + "stanza": stanza, + "indent": 0, + "text": f"text {scene} {n}", + "src_line": n + 1, + } + + +def _scene_lines(scene, speeches): + """speeches: list of (speaker, line count).""" + lines = [] + for si, (speaker, count) in enumerate(speeches): + for _ in range(count): + lines.append(_line(scene, len(lines) + 1, si, speaker=speaker)) + return lines + + +def make_work(tmp_path: Path, parsed_scenes) -> Work: + root = tmp_path / "work" + (root / "data").mkdir(parents=True, exist_ok=True) + (root / "work.toml").write_text(WORK_TOML, encoding="utf-8") + parsed = {"work": "t", "source_sha256": "b" * 64, "scenes": parsed_scenes} + (root / "data/parsed.json").write_text(json.dumps(parsed), encoding="utf-8") + return load_work(root) + + +@pytest.fixture +def work(tmp_path): + one = _scene_lines("one", [("alice", 3), ("bob", 2)]) + one.insert(0, _line("one", 0, 0, kind="cast")) + one.insert(2, _line("one", 99, 0, kind="direction")) + two = [_line("two", i + 1, 0, speaker=None) for i in range(2)] + scenes = [ + {"id": "one", "heading": "ONE", "lines": one}, + {"id": "two", "heading": "TWO", "lines": two}, + ] + return make_work(tmp_path, scenes) + + +def chunks_of(work): + parsed, _ = annotate.load_parsed(work) + return annotate.build_chunks(work, parsed) + + +def good_cache(work, chunk, **line_over): + anns = [] + for line in chunk["lines"]: + anns.append( + { + "id": line["id"], + **line["defaults"], + "emotion": "joyful", + "on_stage": [{"character": "alice", "position": "left"}], + "music": None, + } + ) + doc = { + "chunk_id": chunk["chunk_id"], + "input_sha256": chunk["input_sha256"], + "annotations": anns, + } + return doc + + +def put_cache(work, doc): + path = annotate.cache_dir(work) / f"{doc['chunk_id']}.json" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(doc), encoding="utf-8") + + +def fill_all(work): + for chunk in chunks_of(work): + put_cache(work, good_cache(work, chunk)) + + +# ---------------------------------------------------------------- chunking + + +def test_defaults_and_content(work): + one, two = chunks_of(work) + assert [c["chunk_id"] for c in (one, two)] == ["one_c01", "two_c01"] + by_id = {ln["id"]: ln for ln in one["lines"]} + assert by_id["one_0000"]["defaults"] == { + "speaker": "narrator", + "kind": "stage_direction", + "location": "hall", + "time_of_day": "day", + } + assert by_id["one_0099"]["defaults"]["kind"] == "stage_direction" + assert by_id["one_0001"]["defaults"]["speaker"] == "alice" + assert by_id["one_0001"]["defaults"]["kind"] == "dialogue" + # Unattributed verse -> narration spoken by the lyric voice + assert two["lines"][0]["defaults"] == { + "speaker": "voice", + "kind": "narration", + "location": "yard", + "time_of_day": "night", + } + allowed = one["allowed"] + assert allowed["characters"] == ["alice", "bob", "god"] + assert "narrator" in allowed["speakers"] and "voice" in allowed["speakers"] + assert allowed["locations"] == ["hall", "yard"] + assert "neutral" in allowed["emotions"] and "left" in allowed["positions"] + assert one["context_before"] == [] + assert one["prompt_version"] == annotate.prompt_version() + + +def test_never_crosses_scenes_and_respects_limit(tmp_path): + scenes = [ + {"id": "one", "heading": "ONE", "lines": _scene_lines("one", [("alice", 30)] * 5)}, + {"id": "two", "heading": "TWO", "lines": _scene_lines("two", [("bob", 7)])}, + ] + work = make_work(tmp_path, scenes) + chunks = chunks_of(work) + assert [c["chunk_id"] for c in chunks] == ["one_c01", "one_c02", "one_c03", "two_c01"] + for chunk in chunks: + assert len(chunk["lines"]) <= 60 + assert {ln["id"].rsplit("_", 1)[0] for ln in chunk["lines"]} == {chunk["scene"]["id"]} + assert [len(c["lines"]) for c in chunks] == [60, 60, 30, 7] + + +def test_splits_at_speech_boundaries(tmp_path): + speeches = [("alice", 25), ("bob", 25), ("alice", 25), ("bob", 10)] + work = make_work( + tmp_path, [{"id": "one", "heading": "O", "lines": _scene_lines("one", speeches)}] + ) + chunks = chunks_of(work) + assert [len(c["lines"]) for c in chunks] == [50, 35] + assert chunks[1]["lines"][0]["id"] == "one_0051" + assert len(chunks[1]["context_before"]) == 6 + assert chunks[1]["context_before"][-1]["id"] == "one_0050" + + +def test_oversized_speech_splits_at_stanza_then_hard(tmp_path): + lines = [_line("one", i + 1, 0, stanza=i // 50) for i in range(100)] # two stanzas of 50 + work = make_work(tmp_path, [{"id": "one", "heading": "O", "lines": lines}]) + assert [len(c["lines"]) for c in chunks_of(work)] == [50, 50] + lines = [_line("one", i + 1, 0, stanza=0) for i in range(130)] + work = make_work(tmp_path, [{"id": "one", "heading": "O", "lines": lines}]) + assert [len(c["lines"]) for c in chunks_of(work)] == [60, 60, 10] + + +def test_hash_deterministic_and_content_sensitive(work, tmp_path): + first = [c["input_sha256"] for c in chunks_of(work)] + assert first == [c["input_sha256"] for c in chunks_of(work)] + parsed, _ = annotate.load_parsed(work) + parsed["scenes"][0]["lines"][1]["text"] = "changed" + changed = annotate.build_chunks(work, parsed) + assert changed[0]["input_sha256"] != first[0] + assert changed[1]["input_sha256"] == first[1] + + +def test_prompt_change_invalidates_hash(work, monkeypatch, tmp_path): + before = chunks_of(work)[0]["input_sha256"] + fake = tmp_path / "prompt.md" + fake.write_text("different prompt", encoding="utf-8") + monkeypatch.setattr(annotate, "PROMPT_PATH", fake) + assert chunks_of(work)[0]["input_sha256"] != before + + +def test_chunk_command_writes_and_removes_stale(work, capsys): + assert main(["--work", str(work.root), "annotate", "chunk"]) == 0 + out = annotate.chunks_dir(work) + assert sorted(p.name for p in out.glob("*.json")) == ["one_c01.json", "two_c01.json"] + (out / "gone_c09.json").write_text("{}", encoding="utf-8") + snapshot = (out / "one_c01.json").read_bytes() + main(["--work", str(work.root), "annotate", "chunk"]) + assert not (out / "gone_c09.json").exists() + assert (out / "one_c01.json").read_bytes() == snapshot + assert json.loads(snapshot)["chunk_id"] == "one_c01" + assert "removed stale gone_c09.json" in capsys.readouterr().out + + +def test_unconfigured_scene_or_speaker_fails(tmp_path): + scenes = [{"id": "zzz", "heading": "Z", "lines": [_line("zzz", 1, 0)]}] + with pytest.raises(annotate.AnnotateError): + chunks_of(make_work(tmp_path, scenes)) + scenes = [{"id": "one", "heading": "O", "lines": [_line("one", 1, 0, speaker="ghost")]}] + with pytest.raises(annotate.AnnotateError): + chunks_of(make_work(tmp_path / "b", scenes)) + + +# ---------------------------------------------------------------- status / merge + + +def test_status_states(work, capsys): + one, two = chunks_of(work) + assert annotate.check_cache(work, one)[0] == "missing" + put_cache(work, good_cache(work, one)) + assert annotate.check_cache(work, one) == ("ok", []) + bad = good_cache(work, two) + bad["input_sha256"] = "c" * 64 + put_cache(work, bad) + assert annotate.check_cache(work, two)[0] == "stale" + (annotate.cache_dir(work) / "two_c01.json").write_text("{nope", encoding="utf-8") + assert annotate.check_cache(work, two)[0] == "invalid" + assert main(["--work", str(work.root), "annotate", "status"]) == 0 + out = capsys.readouterr().out + assert "one_c01: ok" in out and "two_c01: invalid" in out + assert "summary: 2 chunks: 1 ok, 0 missing, 0 stale, 1 invalid" in out + + +def merge_main(work, *extra): + return main(["--work", str(work.root), "annotate", "merge", *extra]) + + +def test_merge_ok_and_idempotent(work, capsys): + fill_all(work) + assert merge_main(work) == 0 + out = work.path("data/annotated.json") + first = out.read_bytes() + assert merge_main(work) == 0 + assert out.read_bytes() == first + doc = json.loads(first) + assert doc["fallback_chunks"] == [] + assert doc["parsed_sha256"] and doc["work"] == "t" + line = doc["scenes"][0]["lines"][0] + assert line["id"] == "one_0000" and line["text"] and line["ann"]["emotion"] == "joyful" + assert "id" not in line["ann"] and line["ann"]["music"] is None + assert first.endswith(b"\n") + + +def break_cache(work, mutate): + chunk = chunks_of(work)[0] + doc = good_cache(work, chunk) + mutate(doc) + path = annotate.cache_dir(work) / "one_c01.json" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(doc), encoding="utf-8") + + +@pytest.mark.parametrize( + ("mutate", "expect"), + [ + (lambda d: d.update(input_sha256="d" * 64), "stale"), + (lambda d: d["annotations"].pop(), "missing lines"), + (lambda d: d["annotations"].reverse(), "not in chunk order"), + (lambda d: d["annotations"][1].update(kind="narration"), "kind is 'narration'"), + (lambda d: d["annotations"][1].update(speaker="bob"), "speaker is 'bob'"), + (lambda d: d["annotations"][1].update(location="yard"), "location is 'yard'"), + (lambda d: d["annotations"][1].update(time_of_day="dawn"), "time_of_day is 'dawn'"), + ( + lambda d: d["annotations"][1].update( + on_stage=[{"character": "zed", "position": "left"}] + ), + "unknown character 'zed'", + ), + ( + lambda d: d["annotations"][1].update( + on_stage=[ + {"character": "bob", "position": "left"}, + {"character": "bob", "position": "right"}, + ] + ), + "more than once", + ), + ( + lambda d: d["annotations"][1].update( + on_stage=[{"character": "narrator", "position": "left"}] + ), + "unknown character 'narrator'", + ), + (lambda d: d["annotations"][1].update(emotion="happy"), "schema"), + (lambda d: d.update(chunk_id="two_c01"), "chunk_id"), + ], +) +def test_merge_rejects_bad_cache(work, capsys, mutate, expect): + two = chunks_of(work)[1] + put_cache(work, good_cache(work, two)) + break_cache(work, mutate) + assert merge_main(work) == 1 + err = capsys.readouterr().err + assert "one_c01" in err and expect in err + assert not work.path("data/annotated.json").exists() + + +def test_merge_without_cache_lists_all_problems(work, capsys): + assert merge_main(work) == 1 + err = capsys.readouterr().err + assert "one_c01: missing" in err and "two_c01: missing" in err + + +def test_merge_fallback(work, capsys): + put_cache(work, good_cache(work, chunks_of(work)[1])) + assert merge_main(work, "--fallback") == 0 + captured = capsys.readouterr() + assert "warning: one_c01: missing" in captured.err + doc = json.loads(work.path("data/annotated.json").read_text(encoding="utf-8")) + assert doc["fallback_chunks"] == ["one_c01"] + lines = {ln["id"]: ln["ann"] for s in doc["scenes"] for ln in s["lines"]} + # cast/direction line before anyone spoke: nobody on stage + assert lines["one_0000"]["on_stage"] == [] + assert lines["one_0000"]["emotion"] == "neutral" and lines["one_0000"]["music"] is None + # alice speaks first -> left; bob joins -> right, alice stays + assert lines["one_0001"]["on_stage"] == [{"character": "alice", "position": "left"}] + assert lines["one_0005"]["on_stage"] == [ + {"character": "alice", "position": "left"}, + {"character": "bob", "position": "right"}, + ] + # the ok chunk is kept as annotated by the LLM + assert lines["two_0001"]["emotion"] == "joyful" + first = work.path("data/annotated.json").read_bytes() + merge_main(work, "--fallback") + assert work.path("data/annotated.json").read_bytes() == first + + +def test_fallback_skips_characters_without_sprite(tmp_path): + lines = [_line("one", 1, 0, speaker="god"), _line("one", 2, 1, speaker="alice")] + work = make_work(tmp_path, [{"id": "one", "heading": "O", "lines": lines}]) + result = annotate.merge(work, fallback=True) + anns = [ln["ann"] for ln in result.document["scenes"][0]["lines"]] + assert anns[0]["on_stage"] == [] + assert anns[1]["on_stage"] == [{"character": "alice", "position": "left"}] + + +# ---------------------------------------------------------------- prompt + + +def test_prompt_fills_placeholders(work): + text = annotate.render_prompt(work, "one_c01") + assert "{{" not in text + root = work.root.resolve() + assert str(root / "annotations/chunks/one_c01.json") in text + assert str(root / "annotations/cache/one_c01.json") in text + assert "annotate status one_c01" in text + with pytest.raises(SystemExit): + annotate.render_prompt(work, "nope_c01") diff --git a/tests/test_annotation_schema.py b/tests/test_annotation_schema.py new file mode 100644 index 0000000..98ab978 --- /dev/null +++ b/tests/test_annotation_schema.py @@ -0,0 +1,150 @@ +import copy +import json + +import pytest + +from vnpipe import SCHEMA_DIR +from vnpipe.schema import SchemaError, validate + +SHA = "a" * 64 + + +def _ann(**over): + ann = { + "id": "s_0001", + "speaker": "faust", + "kind": "dialogue", + "emotion": "neutral", + "location": "study", + "time_of_day": "night", + "on_stage": [{"character": "faust", "position": "left"}], + "music": None, + } + ann.update(over) + return ann + + +def _cache(**over): + doc = {"chunk_id": "s_c01", "input_sha256": SHA, "annotations": [_ann()]} + doc.update(over) + return doc + + +def _load(name): + return json.loads((SCHEMA_DIR / f"{name}.schema.json").read_text(encoding="utf-8")) + + +def test_valid_annotation_cache(): + validate(_cache(), "annotation") + + +def test_music_is_optional(): + ann = _ann() + del ann["music"] + validate(_cache(annotations=[ann]), "annotation") + + +@pytest.mark.parametrize("key", ["chunk_id", "input_sha256", "annotations"]) +def test_cache_required_fields(key): + doc = _cache() + del doc[key] + with pytest.raises(SchemaError): + validate(doc, "annotation") + + +@pytest.mark.parametrize( + "key", ["id", "speaker", "kind", "emotion", "location", "time_of_day", "on_stage"] +) +def test_annotation_required_fields(key): + ann = _ann() + del ann[key] + with pytest.raises(SchemaError): + validate(_cache(annotations=[ann]), "annotation") + + +@pytest.mark.parametrize( + "over", + [ + {"emotion": "happy"}, + {"kind": "verse"}, + {"time_of_day": "noon"}, + {"music": "loud"}, + {"extra": 1}, + {"on_stage": [{"character": "faust", "position": "top"}]}, + {"on_stage": [{"character": "faust"}]}, + {"on_stage": [{"character": "faust", "position": "left", "scale": 2}]}, + ], +) +def test_annotation_bad_values(over): + with pytest.raises(SchemaError): + validate(_cache(annotations=[_ann(**over)]), "annotation") + + +def test_cache_rejects_extra_field_and_bad_hash(): + with pytest.raises(SchemaError): + validate(_cache(extra=1), "annotation") + with pytest.raises(SchemaError): + validate(_cache(input_sha256="xyz"), "annotation") + + +def _annotated(): + ann = _ann() + del ann["id"] + line = { + "id": "s_0001", + "kind": "verse", + "speaker": "faust", + "speaker_note": None, + "speech": 0, + "stanza": 0, + "indent": 0, + "text": "Hola", + "src_line": 1, + "ann": ann, + } + return { + "work": "w", + "parsed_sha256": SHA, + "fallback_chunks": [], + "scenes": [{"id": "s", "heading": "H", "lines": [line]}], + } + + +def test_annotated_valid(): + validate(_annotated(), "annotated") + + +def test_annotated_rejects_problems(): + doc = _annotated() + del doc["scenes"][0]["lines"][0]["ann"] + with pytest.raises(SchemaError): + validate(doc, "annotated") + doc = _annotated() + doc["scenes"][0]["lines"][0]["ann"]["emotion"] = "happy" + with pytest.raises(SchemaError): + validate(doc, "annotated") + doc = _annotated() + doc["scenes"][0]["lines"][0]["ann"]["id"] = "s_0001" + with pytest.raises(SchemaError): + validate(doc, "annotated") + doc = _annotated() + del doc["fallback_chunks"] + with pytest.raises(SchemaError): + validate(doc, "annotated") + + +def test_annotated_definitions_match_source_schemas(): + """annotated.schema.json duplicates definitions from the other schemas; keep them in sync.""" + annotated = _load("annotated")["$defs"] + source = _load("annotation")["$defs"] + expected = copy.deepcopy(source["annotation"]) + expected["required"].remove("id") + del expected["properties"]["id"] + assert annotated["ann"] == expected + assert annotated["position"] == source["position"] + + parsed_line = _load("parsed")["properties"]["scenes"]["items"]["properties"]["lines"]["items"] + line = copy.deepcopy(annotated["line"]) + assert line["required"] == [*parsed_line["required"], "ann"] + del line["properties"]["ann"] + assert line["properties"] == parsed_line["properties"] diff --git a/tests/test_renpy_gen.py b/tests/test_renpy_gen.py new file mode 100644 index 0000000..86130b8 --- /dev/null +++ b/tests/test_renpy_gen.py @@ -0,0 +1,393 @@ +import json +import os +import subprocess +from pathlib import Path + +import pytest + +from vnpipe import cli, renpy_gen +from vnpipe.config import load_work +from vnpipe.schema import validate + +ROOT = Path(__file__).resolve().parent.parent +FIXTURES = Path(__file__).parent / "fixtures" +SDK = Path(os.environ.get("RENPY_SDK") or ROOT / "tools/renpy-sdk") / "renpy.sh" + + +@pytest.fixture(scope="module") +def work(): + return load_work(FIXTURES / "mini_work") + + +@pytest.fixture(scope="module") +def annotated(): + data = json.loads((FIXTURES / "annotated_mini.json").read_text(encoding="utf-8")) + validate(data, "annotated") + return data + + +@pytest.fixture(scope="module") +def project(work, annotated, tmp_path_factory): + out = tmp_path_factory.mktemp("proj") + renpy_gen.generate(work, annotated, out) + return out + + +@pytest.fixture(scope="module") +def script(project) -> str: + return (project / "game/script.rpy").read_text(encoding="utf-8") + + +def scene_block(script: str, scene_id: str) -> list[str]: + lines = script.split("\n") + start = lines.index(f"label scene_{scene_id}:") + end = next((i for i in range(start + 1, len(lines)) if lines[i].startswith("label ")), None) + if end is None: + end = len(lines) + return [ln.strip() for ln in lines[start:end]] + + +def say_lines(block: list[str]) -> list[str]: + return [ln for ln in block if ln.startswith("c_")] + + +def test_escape_text(): + assert renpy_gen.escape_text("a [b] {c}") == "a [[b] {{c}" + assert renpy_gen.escape_text('say "hi"\\') == 'say \\"hi\\"\\\\' + assert renpy_gen.escape_text("a\nb") == "a\\nb" + + +def test_escaping_in_script(script): + assert "¿qué pensáis [[ahora]?" in script + assert "Es mi {{anhelo} preferente" in script + assert 'lo \\"mejor\\" que pueda.' in script + + +def test_title_card_and_end(script): + block = scene_block(script, "talk") + assert "show card_talk at truecenter" in block + assert "hide card_talk" in block + assert "with fade" in block + assert "scene bg theatre at tint_none" in block + assert script.rstrip().endswith("return") + assert "show card_end at truecenter" in script and "label the_end:" in script + + +def test_nvl_pages_per_stanza(script): + block = scene_block(script, "lyric") + says = say_lines(block) + # 9-line stanza -> pages of 8 and 1, then the 2-line second stanza + assert [s.count("\\n") + 1 for s in says] == [8, 1, 2] + assert all(s.startswith("c_poet_voice_nvl ") for s in says) + assert block.count("nvl clear") == 3 + assert block[-2:] == ["nvl hide dissolve", ""] + assert not any(ln.startswith("show ") and "vn_" in ln for ln in block) + + +def test_adv_grouping(script): + says = say_lines(scene_block(script, "talk")) + # director's 6 verse lines -> 4 + 2 + assert says[0].count("\\n") == 3 + assert says[1].count("\\n") == 1 + assert says[0].startswith("c_director ") + # split lines (indent >= 6) get their own boxes + assert says[2] == 'c_poet "¡Vete, profano!"' + assert says[3] == 'c_director "Calla, que oye."' + # stage direction: narrator, own box + assert says[4] == 'c_narrator "Se aleja."' + # poet's 3 lines in one box + assert says[5].count("\\n") == 2 + + +def test_cue_forces_box_break_and_emits_before_line(script): + block = scene_block(script, "talk") + cue_start = block.index("# talk_0014 .. talk_0015") + prefix = block[:cue_start] + # cue 1: slow bg change with dark tint and sprites hidden, before the Lord's lines + assert "show bg heaven at tint_dark" in prefix + assert prefix[prefix.index("show bg heaven at tint_dark") + 1] == "with vn_slow" + assert "hide poet" in prefix[-6:] + # Poet's box ended before the cue (box break at cue line) + assert any("y el ocaso llega." in ln for ln in prefix) + + +def test_mode_switch_and_flash_shake(script): + block = scene_block(script, "talk") + i_nvl = block.index("# talk_0016") + # nvl cue at 0016: sprites hidden (nothing changes the bg), director spoke in nvl mode + assert block[i_nvl + 1].startswith("c_director_nvl ") + assert "nvl clear" in block[i_nvl:] + # lyric voice lines in nvl are grouped into one page + pages = [ln for ln in block if ln.startswith("c_poet_voice_nvl")] + assert pages == ['c_poet_voice_nvl "Callan los pájaros;\\nla noche cae."'] + # cue 3: leave nvl, flash + shake, tint reset + i_cue = block.index("# talk_0019") + assert block[i_cue - 4 : i_cue] == [ + "nvl hide dissolve", + "show bg theatre at tint_none", + "with vn_flash", + "show layer master at vn_shake", + ] + + +def test_expression_mapping(script): + block = scene_block(script, "talk") + # first line of the first box is joyful -> director "pleased" + assert "show director pleased at vn_left" in block + # poet angry -> indignant (split box); director stays pleased/neutral as per his own lines + assert "show poet indignant at vn_right" in block + # poet melancholic -> neutral + assert "show poet neutral at vn_right" in block + + +def test_stable_positions(script): + block = scene_block(script, "talk") + shows = [ln for ln in block if ln.startswith("show poet ")] + assert shows and all(ln.endswith("at vn_right") for ln in shows) + assert not any("vn_center" in ln for ln in block) # annotated centre was never used + + +def test_sprite_false_never_shown(script): + assert "show lord" not in script + assert "show poet_voice" not in script + assert "c_lord " in script # still speaks, with name and colour + + +def test_characters_and_images(project): + chars = (project / "game/characters.rpy").read_text(encoding="utf-8") + assert 'define c_director = Character("El Director", who_color="#c9a25b")' in chars + assert 'define c_director_nvl = Character("El Director", kind=nvl' in chars + assert "define c_narrator = Character(None, what_color=" in chars + assert "what_italic=True" in chars + nameless_nvl = next(ln for ln in chars.split("\n") if ln.startswith("define c_poet_voice_nvl")) + assert "None" in nameless_nvl and "nvl_thought" in nameless_nvl + images = (project / "game/images.rpy").read_text(encoding="utf-8") + assert 'image bg dedication = "images/bg/dedication.webp"' in images + assert 'image director pleased = "images/sprites/director_pleased.webp"' in images + assert (project / "game/images/sprites/poet_indignant.webp").is_file() + assert (project / "game/images/bg/theatre.webp").is_file() + assert not (project / "game/images/sprites/lord_neutral.webp").exists() + + +def test_title_card_images(project): + images = (project / "game/images.rpy").read_text(encoding="utf-8") + assert 'image card_talk = Text("CONVERSACIÓN", size=60, text_align=0.5)' in images + assert 'image card_end = Text("Continuará…"' in images + + +def test_options_substitution(project): + options = (project / "game/options.rpy").read_text(encoding="utf-8") + assert 'config.name = _("Mini")' in options + assert 'build.name = "mini-vn"' in options + assert "@@" not in options + gui = (project / "game/gui.rpy").read_text(encoding="utf-8") + assert 'gui.main_menu_background = "bg dedication"' in gui + assert (project / "game/gui/textbox.png").is_file() + assert (project / "game/fonts/RobotoSlab-Regular.ttf").is_file() + + +def test_music_only_when_audio_exists(work, annotated, tmp_path): + out = tmp_path / "p" + renpy_gen.generate(work, annotated, out) + assert "play music" not in (out / "game/script.rpy").read_text(encoding="utf-8") + (out / "game/audio").mkdir() + (out / "game/audio/sacred.ogg").write_bytes(b"OggS") + renpy_gen.generate(work, annotated, out) + text = (out / "game/script.rpy").read_text(encoding="utf-8") + assert 'play music "audio/sacred.ogg" fadeout 1.0 fadein 1.0' in text + assert "stop music fadeout 1.0" in text # mood "none" on the Lord's first line + assert (out / "game/audio/sacred.ogg").is_file() # regeneration keeps user audio + + +def test_unknown_cue_target_fails(work, annotated): + broken = json.loads(json.dumps(annotated)) + broken["scenes"][1]["lines"] = broken["scenes"][1]["lines"][:5] + with pytest.raises(ValueError, match="unknown line ids"): + renpy_gen.render_script(work, broken, set()) + + +def test_unknown_speaker_fails(work, annotated): + broken = json.loads(json.dumps(annotated)) + broken["scenes"][1]["lines"][1]["ann"]["speaker"] = "ghost" + with pytest.raises(ValueError, match="ghost"): + renpy_gen.render_script(work, broken, set()) + + +def tree(root: Path) -> dict[str, bytes]: + return { + str(p.relative_to(root)): p.read_bytes() for p in sorted(root.rglob("*")) if p.is_file() + } + + +def test_deterministic(work, annotated, tmp_path): + a, b = tmp_path / "a", tmp_path / "b" + renpy_gen.generate(work, annotated, a) + renpy_gen.generate(work, annotated, b) + renpy_gen.generate(work, annotated, b) # regenerating over an existing tree + assert tree(a) == tree(b) + + +@pytest.mark.skipif(not SDK.exists(), reason="Ren'Py SDK not found (set RENPY_SDK)") +def test_renpy_lint(work, annotated, tmp_path): + out = tmp_path / "mini" + renpy_gen.generate(work, annotated, out) + env = {**os.environ, "HOME": str(tmp_path / "home")} + (tmp_path / "home").mkdir() + result = subprocess.run( + [str(SDK), str(out), "lint"], capture_output=True, text=True, env=env, timeout=300 + ) + report = result.stdout + result.stderr + assert result.returncode == 0, report + assert "Traceback" not in report and "error" not in report.lower(), report + + +def _with_cfg(work, **changes): + data = json.loads(json.dumps(work.data)) + for key, value in changes.items(): + data[key] = value + return type(work)(root=work.root, data=data) + + +def test_pinned_cast(work, annotated): + data = json.loads(json.dumps(work.data)) + data["staging"]["talk"]["cast"] = {"poet": "left", "director": "center"} + pinned = type(work)(root=work.root, data=data) + block = scene_block(renpy_gen.render_script(pinned, annotated, set()), "talk") + first_box = block.index("# talk_0002 .. talk_0005") + assert "show poet neutral at vn_left" in block[first_box:] + assert any(ln.startswith("show director") and ln.endswith("vn_center") for ln in block) + assert not any("vn_right" in ln for ln in block) # annotation position overridden + + +def test_stage_direction_keeps_on_stage(work, annotated): + ann = json.loads(json.dumps(annotated)) + direction = next(ln for ln in ann["scenes"][1]["lines"] if ln["id"] == "talk_0010") + direction["ann"]["on_stage"] = [] + block = scene_block(renpy_gen.render_script(work, ann, set()), "talk") + i = block.index('c_narrator "Se aleja."') + assert not any(ln.startswith("hide ") for ln in block[i - 3 : i]) + + +def test_cue_move(work, annotated): + data = json.loads(json.dumps(work.data)) + data["cues"][0]["move"] = {"poet": "left"} + moved = type(work)(root=work.root, data=data) + block = scene_block(renpy_gen.render_script(moved, annotated, set()), "talk") + # sprites are hidden by that cue's hide_all, so nothing to slide; position is updated + assert "with vn_move" not in block + data["cues"][0].pop("hide_all") + data["cues"][0]["move"] = {"poet": "left"} + moved = type(work)(root=work.root, data=data) + block = scene_block(renpy_gen.render_script(moved, annotated, set()), "talk") + i = block.index("with vn_move") + assert block[i - 1].startswith("show poet ") and block[i - 1].endswith("vn_left") + + +def test_overrides(work, annotated): + ov = [{"from": "talk_0011", "to": "talk_0013", "emotion": "angry"}] + block = scene_block( + renpy_gen.render_script(_with_cfg(work, overrides=ov), annotated, set()), "talk" + ) + assert "show poet indignant at vn_right" in block[block.index("# talk_0011 .. talk_0013") :] + + +@pytest.mark.parametrize( + "change, match", + [ + ({"overrides": [{"from": "talk_0011", "to": "nope", "emotion": "angry"}]}, "unknown line"), + ({"overrides": [{"from": "talk_0011", "to": "talk_0012", "emotion": "mad"}]}, "emotion"), + ({"overrides": [{"from": "talk_0011", "to": "lyric_0001", "emotion": "angry"}]}, "range"), + ({"overrides": [{"from": "talk_0012", "to": "talk_0011", "emotion": "angry"}]}, "range"), + ], +) +def test_invalid_overrides(work, annotated, change, match): + with pytest.raises(ValueError, match=match): + renpy_gen.render_script(_with_cfg(work, **change), annotated, set()) + + +def test_invalid_staging_cast_and_move(work, annotated): + data = json.loads(json.dumps(work.data)) + data["staging"]["talk"]["cast"] = {"ghost": "left"} + with pytest.raises(ValueError, match="ghost"): + renpy_gen.render_script(type(work)(root=work.root, data=data), annotated, set()) + data = json.loads(json.dumps(work.data)) + data["staging"]["talk"]["cast"] = {"poet": "up"} + with pytest.raises(ValueError, match="position"): + renpy_gen.render_script(type(work)(root=work.root, data=data), annotated, set()) + data = json.loads(json.dumps(work.data)) + data["cues"][0]["move"] = {"poet": "nowhere"} + with pytest.raises(ValueError, match="position"): + renpy_gen.render_script(type(work)(root=work.root, data=data), annotated, set()) + + +def test_every_gui_image_exists(project): + """Every gui/... path the template screens reference resolves to a shipped file.""" + import re + + game = project / "game" + text = "".join((game / n).read_text(encoding="utf-8") for n in ("gui.rpy", "screens.rpy")) + text = "\n".join(ln for ln in text.split("\n") if not ln.lstrip().startswith("#")) + refs = set(re.findall(r'"(gui/[^"]+\.png)"', text)) + assert len(refs) > 20 + missing = [] + for ref in sorted(refs): + # Ren'Py's prefix search ends with the un-prefixed name + candidates = [ref.replace("[prefix_]", "")] + if ref.endswith("confirm_frame.png"): + candidates.append("gui/frame.png") # listed fallback in screens.rpy + if not any((game / c).is_file() for c in candidates): + missing.append(ref) + assert not missing + # button_properties() backgrounds fall back to gui/button/background.png + assert (game / "gui/button/background.png").is_file() + assert (game / "gui/phone/button/background.png").is_file() + + +def test_with_test_flag(work, annotated, tmp_path): + plain, tested = tmp_path / "a", tmp_path / "b" + renpy_gen.generate(work, annotated, plain) + renpy_gen.generate(work, annotated, tested, with_test=True) + assert not (plain / "game/e2e_test.rpy").exists() + assert "testcase default" in (tested / "game/e2e_test.rpy").read_text(encoding="utf-8") + renpy_gen.generate(work, annotated, tested) # flag off removes it again + assert not (tested / "game/e2e_test.rpy").exists() + + +def run_e2e(project: Path, home: Path) -> str: + home.mkdir(exist_ok=True) + for name in ("traceback.txt", "errors.txt"): + (project / name).unlink(missing_ok=True) + env = { + **os.environ, + "HOME": str(home), + "SDL_VIDEODRIVER": "dummy", + "SDL_AUDIODRIVER": "dummy", + "RENPY_RENDERER": "sw", + } + result = subprocess.run( + [str(SDK), str(project), "test"], capture_output=True, text=True, env=env, timeout=900 + ) + report = result.stdout + result.stderr + for name in ("traceback.txt", "errors.txt"): + assert not (project / name).exists(), (project / name).read_text(encoding="utf-8") + assert result.returncode == 0, report + assert "Traceback" not in report and "FAIL" not in report, report + return report + + +@pytest.mark.skipif(not SDK.exists(), reason="Ren'Py SDK not found (set RENPY_SDK)") +def test_e2e_playthrough_mini(work, annotated, tmp_path): + out = tmp_path / "mini" + renpy_gen.generate(work, annotated, out, with_test=True) + run_e2e(out, tmp_path / "home") + + +def test_cli_defaults_to_current_directory(work, tmp_path, monkeypatch): + import shutil + + shutil.copytree(FIXTURES / "mini_work", tmp_path / "w") + (tmp_path / "w/data").mkdir() + shutil.copy(FIXTURES / "annotated_mini.json", tmp_path / "w/data/annotated.json") + monkeypatch.chdir(tmp_path / "w") + assert cli.main(["renpy"]) == 0 + assert (tmp_path / "w/vn/game/script.rpy").is_file() diff --git a/tests/test_schema.py b/tests/test_schema.py new file mode 100644 index 0000000..6c0f0dd --- /dev/null +++ b/tests/test_schema.py @@ -0,0 +1,27 @@ +import pytest + +from vnpipe.schema import SchemaError, validate + + +def test_valid_instance_passes(): + validate( + { + "work": "x", + "source_sha256": "a" * 64, + "scenes": [{"id": "s", "heading": "H", "lines": []}], + }, + "parsed", + ) + + +def test_reports_all_problems(): + with pytest.raises(SchemaError) as exc: + validate({"work": 1, "source_sha256": "bad", "scenes": []}, "parsed") + message = str(exc.value) + assert "3 problem(s)" in message + assert "/work" in message and "/source_sha256" in message and "/scenes" in message + + +def test_unknown_schema(): + with pytest.raises(FileNotFoundError): + validate({}, "nope") diff --git a/tests/test_text.py b/tests/test_text.py new file mode 100644 index 0000000..0c79920 --- /dev/null +++ b/tests/test_text.py @@ -0,0 +1,192 @@ +import json +from pathlib import Path + +import pytest + +from vnpipe import text +from vnpipe.schema import validate + +FIXTURE = Path(__file__).parent / "fixtures" / "mini_raw.txt" + +CFG = { + "work": {"id": "mini"}, + "scope": {"start_marker": "DEDICATORIA", "end_marker": "(_Llaman._)", "end_occurrence": 1}, + "speakers": { + "EL DIRECTOR": "director", + "EL POETA": "poet", + "MEFISTÓFELES": "mephisto", + "EL SEÑOR": "lord", + "FAUSTO": "faust", + "EL ESPÍRITU": "spirit", + }, + "scenes": [ + {"heading": "DEDICATORIA", "id": "dedicatoria"}, + {"heading": "PRÓLOGO EN EL TEATRO", "id": "prologo_teatro"}, + {"heading": "PRÓLOGO EN EL CIELO", "id": "prologo_cielo"}, + {"heading": "DE NOCHE", "id": "noche"}, + ], +} +SHA = "0" * 64 + + +@pytest.fixture(scope="module") +def raw() -> str: + return FIXTURE.read_text(encoding="utf-8") + + +@pytest.fixture(scope="module") +def parsed(raw): + return text.parse(text.clean(raw, CFG["scope"]), CFG, SHA) + + +def scene(parsed, scene_id): + return next(s for s in parsed["scenes"] if s["id"] == scene_id) + + +def test_scope_cut(raw): + lines = text.clean(raw, CFG["scope"]) + joined = "\n".join(t for _, t in lines) + assert lines[0][1] == "DEDICATORIA" + assert lines[0][0] == 8 # first whole-line match, not the indented TOC entry + assert "Gutenberg" not in joined + assert "TEODORO LLORENTE" not in joined + assert "Llaman" not in joined + assert "WAGNER" not in joined + assert "Ilustración" not in joined + assert "\n\n\n" not in joined + + +def test_scope_missing_marker(raw): + with pytest.raises(text.ParseError): + text.clean(raw, {**CFG["scope"], "start_marker": "NOPE"}) + with pytest.raises(text.ParseError): + text.clean(raw, {**CFG["scope"], "end_occurrence": 5}) + + +def test_crlf_is_normalised(raw): + crlf = raw.replace("\n", "\r\n") + assert text.clean(crlf, CFG["scope"]) == text.clean(raw, CFG["scope"]) + + +def test_scenes_in_order_with_ids(parsed): + assert [s["id"] for s in parsed["scenes"]] == [ + "dedicatoria", + "prologo_teatro", + "prologo_cielo", + "noche", + ] + first = scene(parsed, "noche")["lines"][0] + assert first["id"] == "noche_0001" + + +def test_dedicatoria_has_no_speaker(parsed): + lines = scene(parsed, "dedicatoria")["lines"] + assert all(ln["speaker"] is None and ln["kind"] == "verse" for ln in lines) + assert [ln["stanza"] for ln in lines] == [0, 0, 0, 0, 1, 1] + assert [ln["indent"] for ln in lines] == [2, 0, 0, 0, 2, 0] + + +def test_cast_list_detection(parsed): + teatro = scene(parsed, "prologo_teatro")["lines"][0] + assert teatro["kind"] == "cast" + assert teatro["text"] == "EL DIRECTOR, EL POETA DRAMÁTICO, EL GRACIOSO" + assert teatro["speaker"] is None + cielo = scene(parsed, "prologo_cielo")["lines"][0] + assert cielo["kind"] == "cast" + assert cielo["text"] == ( + "EL SEÑOR, los EJÉRCITOS CELESTIALES. Después MEFISTÓFELES. " + "Los tres ARCÁNGELES se adelantan" + ) + + +def test_setting_is_joined_direction(parsed): + first = scene(parsed, "noche")["lines"][0] + assert first["kind"] == "direction" + assert first["text"] == ( + "En un aposento gótico, estrecho, con elevada bóveda, FAUSTO " + "intranquilo sentado a su pupitre." + ) + + +def test_stanza_counting(parsed): + lines = [ln for ln in scene(parsed, "prologo_teatro")["lines"] if ln["speaker"] == "director"] + assert [ln["stanza"] for ln in lines] == [0, 0, 0, 1, 1] + assert {ln["speech"] for ln in lines} == {0} + + +def test_split_verse_indentation(parsed): + poet = [ln for ln in scene(parsed, "prologo_teatro")["lines"] if ln["speaker"] == "poet"] + assert poet[0]["indent"] == 26 + assert poet[1]["indent"] == 0 + assert poet[0]["speech"] == 1 + + +def test_indented_speaker_heading(parsed): + lines = scene(parsed, "prologo_cielo")["lines"] + mephisto = [ln for ln in lines if ln["text"] in ("¿A Fausto", "el Doctor?")] + assert [ln["speaker"] for ln in mephisto] == ["mephisto", "mephisto"] + assert [ln["indent"] for ln in mephisto] == [19, 0] + assert [ln["speech"] for ln in lines if ln["speaker"]] == [0, 1, 1, 2, 3, 3] + + +def test_speaker_note(parsed): + solo = [ln for ln in scene(parsed, "prologo_cielo")["lines"] if ln["speaker_note"]] + assert {ln["speaker_note"] for ln in solo} == {"solo"} + assert {ln["speaker"] for ln in solo} == {"mephisto"} + noche = scene(parsed, "noche")["lines"] + terrified = [ln for ln in noche if ln["speaker_note"] == "aterrado"] + assert len(terrified) == 2 + assert terrified[0]["speaker"] == "faust" + + +def test_multiline_stage_direction(parsed): + directions = [ln for ln in scene(parsed, "noche")["lines"] if ln["speaker"] is None][1:] + assert len(directions) == 1 + assert directions[0]["kind"] == "direction" + assert directions[0]["text"] == ( + "Toma el libro y pronuncia misteriosamente el nombre del Espíritu. " + "Enciéndese una luz rojiza y trémula. El Espíritu aparece en ella." + ) + assert directions[0]["src_line"] == 86 + inline = [ln for ln in scene(parsed, "prologo_cielo")["lines"] if ln["kind"] == "direction"] + assert inline[0]["text"] == "El cielo se cierra y los Arcángeles se dispersan." + + +def test_italics_stripped(parsed): + texts = [ln["text"] for ln in scene(parsed, "noche")["lines"]] + assert "la Razón lo nombra" in texts + assert not any("_" in t for s in parsed["scenes"] for t in (ln["text"] for ln in s["lines"])) + + +def test_src_lines_point_to_raw(raw, parsed): + raw_lines = raw.split("\n") + for s in parsed["scenes"]: + for ln in s["lines"]: + if ln["kind"] == "verse": + assert raw_lines[ln["src_line"] - 1].strip().replace("_", "") == ln["text"] + + +def test_unknown_speaker_fails(raw): + cfg = {**CFG, "speakers": {k: v for k, v in CFG["speakers"].items() if k != "FAUSTO"}} + with pytest.raises(text.ParseError, match="FAUSTO"): + text.parse(text.clean(raw, CFG["scope"]), cfg, SHA) + + +def test_unknown_scene_heading_fails(raw): + cfg = {**CFG, "scenes": CFG["scenes"][:3]} + with pytest.raises(text.ParseError, match="DE NOCHE"): + text.parse(text.clean(raw, CFG["scope"]), cfg, SHA) + + +def test_deterministic_and_schema_valid(raw, parsed): + again = text.parse(text.clean(raw, CFG["scope"]), CFG, SHA) + assert json.dumps(again) == json.dumps(parsed) + validate(parsed, "parsed") + + +def test_build_hashes_raw_bytes(): + data = FIXTURE.read_bytes() + _, result = text.build(data, CFG) + import hashlib + + assert result["source_sha256"] == hashlib.sha256(data).hexdigest() diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..7dc12da --- /dev/null +++ b/uv.lock @@ -0,0 +1,359 @@ +version = 1 +revision = 3 +requires-python = ">=3.12" + +[[package]] +name = "attrs" +version = "26.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/e1/2069291243c926a2ff1cd706c7f3eeb9b62144bf60f77c9fb9ff2fb26bd3/iniconfig-2.3.1.tar.gz", hash = "sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960", size = 21209, upload-time = "2026-10-06T22:48:38.076Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/56/43/4ca9e49d27a1fcf6bece6f6aec0ea46bb9112489b93d4b688fb415457bdb/iniconfig-2.3.1-py3-none-any.whl", hash = "sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7", size = 7552, upload-time = "2026-10-06T22:48:36.959Z" }, +] + +[[package]] +name = "jsonschema" +version = "4.26.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "jsonschema-specifications" }, + { name = "referencing" }, + { name = "rpds-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" }, +] + +[[package]] +name = "jsonschema-specifications" +version = "2025.9.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "referencing" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" }, +] + +[[package]] +name = "packaging" +version = "26.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" }, +] + +[[package]] +name = "pillow" +version = "13.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ce/a4/9cc30690a394a8305e8be4c9036aa16d0dfddadd09079860b582f562496d/pillow-13.0.0.tar.gz", hash = "sha256:cdcd1ba258178f7356d74170c9a81ba4eab6a5d55748bc402a5a2a6fe6be3510", size = 47058631, upload-time = "2026-10-16T22:18:09.718Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7a/b8/58d79332229482eb0d27c82973850808c19d37e5bdc14443d3417bd373f5/pillow-13.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:67c8d44ad89fa7eb88de5d6ef6199b1e03dd24974f85a67639fc8badb801fe79", size = 5568643, upload-time = "2026-10-16T22:15:44.474Z" }, + { url = "https://files.pythonhosted.org/packages/39/4b/f2ed53d83aa44ac19599ac0a54897f867fafb95f406980d1e24083f8cbe3/pillow-13.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc481f742ccda20e9ed760b8f978dff50f2a4e9bc253ac167fb0a05b0783ef52", size = 4852329, upload-time = "2026-10-16T22:15:46.284Z" }, + { url = "https://files.pythonhosted.org/packages/3b/bb/9e30e8ed18c20800ee327a12107d5249ad8dc444867b3adfcc21654e3c71/pillow-13.0.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8bf295fe459343bc6093c8e5e0df60bfa189e0fcb775a22e2c2488fdeccc6c0d", size = 6519309, upload-time = "2026-10-16T22:15:48.14Z" }, + { url = "https://files.pythonhosted.org/packages/e6/99/fdf65cc539e266ab93546c261bdf98411fe165c6e4e13f9dbf597097192b/pillow-13.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:42d63be3af4f9b951b199b0a9d23365d37ab14687e6d77b74940432c8515c4ca", size = 7144542, upload-time = "2026-10-16T22:15:50.093Z" }, + { url = "https://files.pythonhosted.org/packages/26/9b/f38b7c4d8f599537e2d1a6d546cec9beef7536ff8f5c49a3f9c78179d8ac/pillow-13.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4bd024d567eca931b668978d672dba914d4b8e2628e2c3073a2ad178de8a2620", size = 6618042, upload-time = "2026-10-16T22:15:52.054Z" }, + { url = "https://files.pythonhosted.org/packages/a8/7c/45ee28531f89ee4582967d8a17f7a26d71ca64cd902b93c269590cd60a00/pillow-13.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23edf4ec4b6f4f240e8df6e4985e9ee2ced86474632433e55fb1e2548744bf40", size = 7228137, upload-time = "2026-10-16T22:15:54.009Z" }, + { url = "https://files.pythonhosted.org/packages/01/bc/9c2a969cb1b70201d04fa17fd5aedf02a732870b8da86bceaaa30b0ca385/pillow-13.0.0-cp312-cp312-win32.whl", hash = "sha256:02464da86f561f410e13b061ec37c3068a9cb557a095494157742d07b3c24a27", size = 6515423, upload-time = "2026-10-16T22:15:56.25Z" }, + { url = "https://files.pythonhosted.org/packages/ff/cd/73a79ecdc822076002eb24b5e1e4a530b0bb5310fcb6d239abbec877110b/pillow-13.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:ff3fe9eb621fbb9db4c4be33ab946f6bac5f98ab50ca8d3260503653656c961b", size = 7272166, upload-time = "2026-10-16T22:15:58.597Z" }, + { url = "https://files.pythonhosted.org/packages/4a/a3/be5a1236efd085b3984e4305da8f179ae9dab80c991d2ad78f2bd5c4c843/pillow-13.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:c3bc8ee0271387e0b1e3ad0ff893645990a656e79bf9c42f4f734a3642b11d51", size = 2698943, upload-time = "2026-10-16T22:16:00.637Z" }, + { url = "https://files.pythonhosted.org/packages/82/e2/9132d38df320e8099e2642d9fa538f18a7dfebf68a875a31725dc2a115aa/pillow-13.0.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:e98b4f91f99b24b1da72e10621ba181f7281922384a7403094debb4199de6c00", size = 4190620, upload-time = "2026-10-16T22:16:02.527Z" }, + { url = "https://files.pythonhosted.org/packages/cb/be/436dac0996876f65ef1916ffb711c5ef4af2ebc57414b6f16642e07f6b47/pillow-13.0.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:34fb3db1149c879343861831728c243c432d4a5afc8f1878ca7612ef8de2a033", size = 4290286, upload-time = "2026-10-16T22:16:04.861Z" }, + { url = "https://files.pythonhosted.org/packages/60/16/7c1007162e4169ea0d5bec47e2e0b2174f56c50cf5b8c02a1dc23e41037e/pillow-13.0.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:2d50500a4a3bc6469adcdb319cf05d688b08ca3bf0f22a05339f3b25b433a599", size = 3723169, upload-time = "2026-10-16T22:16:06.956Z" }, + { url = "https://files.pythonhosted.org/packages/08/bc/578ab2eaa04705a8978bd9be0fe15c3d43a8fc95097c4f7e39540e79e4fa/pillow-13.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ef5fe6b7db3f501c56000ba8fe7c7e1a35ca1d45824fbeb95a67daa85cff4dbe", size = 5568469, upload-time = "2026-10-16T22:16:08.664Z" }, + { url = "https://files.pythonhosted.org/packages/98/c8/ccede3dcc4f274b80fb49199eed1ef34ba05566c8b71976b9d1f111da2e3/pillow-13.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f11a3c1358bb3c68012a7b1f41b223c3db9f7bfde90b481df028cfe1c3363313", size = 4852187, upload-time = "2026-10-16T22:16:10.693Z" }, + { url = "https://files.pythonhosted.org/packages/fb/3c/cd0770e96d20bfd990db024bcbd43897ff3e88da1f4782cf90ea231b1d4f/pillow-13.0.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:19b66ca0a4d25cc0200b381ce824c7ea090db61427315e73cfb05dbf1b35c369", size = 6515908, upload-time = "2026-10-16T22:16:12.896Z" }, + { url = "https://files.pythonhosted.org/packages/ef/fe/f5cdaa2d1c4086e757430f368c271a58ee29cfe7378e7ae7b9d964015c25/pillow-13.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5f56499c1a74d2b862beb0c33b8016f99d095858455df9d21583bbbc1c15b582", size = 7142544, upload-time = "2026-10-16T22:16:14.844Z" }, + { url = "https://files.pythonhosted.org/packages/fb/b5/a54f6d44adbcd23737c8c12953f42be107e4cca64e247c0ca3a5b563061c/pillow-13.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a2a14cd73d5e6c927f644b0110ee81f59c4ef506259ec9183904747f2caacc81", size = 6613097, upload-time = "2026-10-16T22:16:16.893Z" }, + { url = "https://files.pythonhosted.org/packages/e6/b4/9e6c1207c21b2e91db0d15c16d30f3701ce5add1bd4da0e787761e66cb6e/pillow-13.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:08b826a9bf1265c76de04a42061d61ea6b109418b7826f28ff1ecdfaa26c5502", size = 7224846, upload-time = "2026-10-16T22:16:19.195Z" }, + { url = "https://files.pythonhosted.org/packages/78/9f/d3c3cb0518f3dd1eee0ef501535f53d15597a53c5c4118d178086143397a/pillow-13.0.0-cp313-cp313-win32.whl", hash = "sha256:12b0fa15879fe5a9d9eebe66e4e2d74128a773b1a4448010c9c714f45e04b9d8", size = 6516013, upload-time = "2026-10-16T22:16:21.389Z" }, + { url = "https://files.pythonhosted.org/packages/d7/ed/1b16fb66a37e1b9e41370b93b2c614c7da761a5b2a41dc333f7af4639962/pillow-13.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:9dda0788a9932776a75d8bcc020076edc308ce2508b51f6739a45e3158b3fc42", size = 7284777, upload-time = "2026-10-16T22:16:23.393Z" }, + { url = "https://files.pythonhosted.org/packages/87/7d/8d02eba9f7ecc87f8e90f731e032cc4773802f2a843763afd0c66a535ff4/pillow-13.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:40a266371ece581e5de13b6635ef78d7487824af80561b6ca27694a88c19bc0f", size = 2698826, upload-time = "2026-10-16T22:16:25.382Z" }, + { url = "https://files.pythonhosted.org/packages/8e/45/fbad9c7f5e2f1745c373a434d46072bc84eddfefaa28b852425ac957fda6/pillow-13.0.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:44629d4498c9cb6b2051806155f22141df0d8a929c56134b166655232dfb2f8c", size = 4190721, upload-time = "2026-10-16T22:16:27.524Z" }, + { url = "https://files.pythonhosted.org/packages/a2/bf/2074902a259a90692c5dbf132885d21671644cbbd3f690047516243a55db/pillow-13.0.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:bf97ba1b5542050e9b0c74e632323b6d8136cc99d64e193abebee22fe6013c76", size = 4290236, upload-time = "2026-10-16T22:16:29.562Z" }, + { url = "https://files.pythonhosted.org/packages/ff/a5/3d1bb93b8ea38d15d21356c1b8e9f50971ac592aaa248f7fb71739094c0e/pillow-13.0.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:aa694c49787040943570d61c9b8fc01271bd2a2cfdd55f0d896f8aecdce1a981", size = 3723093, upload-time = "2026-10-16T22:16:31.249Z" }, + { url = "https://files.pythonhosted.org/packages/84/a1/be060135d85187b25fa8b2573786c0e45c62ae27527fff5257675eb97f4a/pillow-13.0.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:49c12af515073e9bf511e4ef736743bf70d531a643668722279314b937742ba4", size = 5572253, upload-time = "2026-10-16T22:16:33.103Z" }, + { url = "https://files.pythonhosted.org/packages/b5/f4/0bf6f1ac9ba7ee2ffe9914aeb410a1035a0c1a3c42f122388d7fc950bc4b/pillow-13.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d9b0a2bee3f3e03e9f29057aedb807dbf1e1d96ee1b9d0f422d9db6c8583271d", size = 4852269, upload-time = "2026-10-16T22:16:35.102Z" }, + { url = "https://files.pythonhosted.org/packages/83/16/b603274617b3e6728da3a0133d4fba1ea8d7fbe0c4ea5fef9cbffa398b8b/pillow-13.0.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5933fcea5a5ba64c686f55c886a115cbfd92f2900460784a1e79909fdbafd7b6", size = 6516058, upload-time = "2026-10-16T22:16:37.228Z" }, + { url = "https://files.pythonhosted.org/packages/1d/f2/1371707ce438ba9a43f9d24089828494ec6f9396e28cd7903aa704dd6306/pillow-13.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e91c2b1cbeae768c98752e67e717e283d68dae45717b41f2d91eaee648e37b7d", size = 7142574, upload-time = "2026-10-16T22:16:39.172Z" }, + { url = "https://files.pythonhosted.org/packages/b9/a9/62cf68587f910bc87c5951bcb6e9430c7643a65076adf5f18b4bf350e2bd/pillow-13.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7f6299e494e46253d40c34653cac369412f44ca53b5f85d848d3f95b1ed0546c", size = 6614295, upload-time = "2026-10-16T22:16:41.117Z" }, + { url = "https://files.pythonhosted.org/packages/6c/c9/9e9b48178649730299be0bafbf5f810a5b6977538f5a92d47e4ba5f5d608/pillow-13.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:f9bd7d260d986f3553518c5d723544346fa48031f8aef3265d786aeb59845bc0", size = 7224841, upload-time = "2026-10-16T22:16:43.118Z" }, + { url = "https://files.pythonhosted.org/packages/8f/48/c44e91384b1b6c072a714a63d00608acc16a6a968735e478e4be4384e5ac/pillow-13.0.0-cp314-cp314-win32.whl", hash = "sha256:2e31c4e68cffd7b1f116127626813b82fcba19edf6b940a7b0c266d6484d0055", size = 6508694, upload-time = "2026-10-16T22:16:45.883Z" }, + { url = "https://files.pythonhosted.org/packages/50/e2/7ad17747517e4c813dca78257d6bb593466f8231baf1384bc98d92745edb/pillow-13.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:f7cbb7a64e7ec664775195e4f81923bc8a93d9451b963f844e59118f63147a7a", size = 7281830, upload-time = "2026-10-16T22:16:47.725Z" }, + { url = "https://files.pythonhosted.org/packages/41/9f/e5b51f2ce8ef4563215334035403ce61a244f93a2e65c24a940131618f87/pillow-13.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:a6aaa7871aebca081eb5c45f83e845bbd9712ae99fa9286dbfdcee835e63f4b4", size = 2695468, upload-time = "2026-10-16T22:16:49.515Z" }, + { url = "https://files.pythonhosted.org/packages/97/73/a53502f731f6c84805a4ce87a8881e86d07a65aee64728b900d112dc703e/pillow-13.0.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7b999816b5850a35ada08443e6e03945f1f6488144a83afe2d37b240a552aafa", size = 5578196, upload-time = "2026-10-16T22:16:51.291Z" }, + { url = "https://files.pythonhosted.org/packages/21/50/7e949959a56b5559c78ef172b70fc6025706acb289f3f648a15329e4fa6f/pillow-13.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:67871a13cf47275201553b536c025da777f997fa562a19eb798af4ad4b97c18f", size = 4857276, upload-time = "2026-10-16T22:16:53.399Z" }, + { url = "https://files.pythonhosted.org/packages/c9/52/43ded0ac08e77e39d17bd6d894162572201b5e8fdc4a022b14c55a1960a4/pillow-13.0.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e8ca8f69b7c77fa96dad99f8638c1fc4f1c0bed4acaa1baf7a3c31bdb80a0ab1", size = 6607008, upload-time = "2026-10-16T22:16:55.525Z" }, + { url = "https://files.pythonhosted.org/packages/0d/2e/4a57ed216d5bf877387cba4d44c02aa87abe51ad2e06404aa6b597c4da39/pillow-13.0.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bce6a29c3898191f4c9998e4d4e8f69790caeabde46e54da4bc235ce5bde683", size = 7224281, upload-time = "2026-10-16T22:16:57.738Z" }, + { url = "https://files.pythonhosted.org/packages/5c/3d/2929b248e135752d63aaeabf53f6de797e905b7b6263f9c1e2adade20aba/pillow-13.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:816752a5ef76a80484c8c441c85593b7ea9304f6231fc5776ad1fbff7e773058", size = 6695600, upload-time = "2026-10-16T22:16:59.842Z" }, + { url = "https://files.pythonhosted.org/packages/bc/33/fb0da992cf084ed1ee6ee05e96b6191e35c351eb707ca2df874feb24ce47/pillow-13.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5bdb38ba220b61b4ec31dd1046dea6b016d3c6850a23f43ed8b58332b2fc668e", size = 7300589, upload-time = "2026-10-16T22:17:01.686Z" }, + { url = "https://files.pythonhosted.org/packages/bb/af/c30dd9ef6a3dce84ecb1b2393cac629047a32e66279056c6cb46c3ffd65c/pillow-13.0.0-cp314-cp314t-win32.whl", hash = "sha256:06903aac074d00c988e77a1fc435286dc498506d4ca8d6f69df9babddf4ecc15", size = 6517204, upload-time = "2026-10-16T22:17:03.722Z" }, + { url = "https://files.pythonhosted.org/packages/85/d5/ef3a8ae7609c8ab26570abf18194882534b480d245a9148b895a2262c004/pillow-13.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:9a635068d9793c7f0d929f39f18b58f1bd86c236e8e7b64167b86af9232ebca0", size = 7286695, upload-time = "2026-10-16T22:17:05.543Z" }, + { url = "https://files.pythonhosted.org/packages/84/3c/0861db0c69a03689ebe3e7599d35668a414deb5aaafd8255215e4e62e3d3/pillow-13.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0d1a9cf7bc6917538b20f8d06b9ab2147e542f68849e96fc58eb66bdf6acc692", size = 2698098, upload-time = "2026-10-16T22:17:07.674Z" }, + { url = "https://files.pythonhosted.org/packages/6e/eb/e86a41962a3a31ad495a3d6a912d9002b01bba4a6fa71c28703abdca7f69/pillow-13.0.0-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7d5e097eabd5d4915c27ac9f6e9325bb1e01a7c94d7348b5c4451d3fc30e8521", size = 4191213, upload-time = "2026-10-16T22:17:09.449Z" }, + { url = "https://files.pythonhosted.org/packages/dd/04/7e7445e706afec84ef06dc25b2c77f9cecff242c23730c62928ad1089d4a/pillow-13.0.0-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:51ebb529fc5e8abdd55302f6c3f8943037348ec2384329a3e55677f69ae2fdfc", size = 4290650, upload-time = "2026-10-16T22:17:11.196Z" }, + { url = "https://files.pythonhosted.org/packages/46/85/d534089068ac40c0f61f650389a296c812eab745a8a733f81feec39ae955/pillow-13.0.0-cp315-cp315-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:c87a04e7f152ee4db5dbe15f0bfa3fe628a1aeedbe66b81c43b87f52c813f9ac", size = 3723078, upload-time = "2026-10-16T22:17:12.772Z" }, + { url = "https://files.pythonhosted.org/packages/ce/2b/00b5c3b401df538b5dbe311d3899730fae5ba1e21cb8b80a128887ac6747/pillow-13.0.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:20722cd5375533ad754053363a80b8fb30c79d37930a6f7228030e237ce3bd5d", size = 5572292, upload-time = "2026-10-16T22:17:14.539Z" }, + { url = "https://files.pythonhosted.org/packages/72/f5/a6b0610f946e9b54ae888ba7ad29d6e2f8d9b11f69e212d70416b7186c09/pillow-13.0.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:04a63720f79e22fd54d897c233a68314c50ca0603360f54ce2bd5db8f0f43782", size = 4852222, upload-time = "2026-10-16T22:17:16.521Z" }, + { url = "https://files.pythonhosted.org/packages/1e/d0/c0ff25bb0427ec70f32aac995453321fc3c4494a46c7292ff02d9d260b04/pillow-13.0.0-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4f8db54177035a2b5f717f94475b74907e12a96dc74f6d487f3966b0a4694071", size = 6527349, upload-time = "2026-10-16T22:17:18.534Z" }, + { url = "https://files.pythonhosted.org/packages/85/11/e46fa0bcc0fc117f1eacc206b3d51f04d583fab328b4b740672d0438d83f/pillow-13.0.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f36aa77f74b14a2103622b196402c71330e4e7cf4122ee45c854e9a01e0eecf", size = 7152873, upload-time = "2026-10-16T22:17:20.415Z" }, + { url = "https://files.pythonhosted.org/packages/7c/53/2bdeca705f3a58679fa9201233193c86a30238340ca29b3a152c3fcc719b/pillow-13.0.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:149a1c323ba366f90b48e6f1a6db6582eb50512df374588de56fc909abc0f0f3", size = 6626871, upload-time = "2026-10-16T22:17:22.361Z" }, + { url = "https://files.pythonhosted.org/packages/14/de/3829030f209722ade3753bb456b805a0e7f885cf885b483407365c82e9ca/pillow-13.0.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:e892354a424b1e82a78ba16785822bdd40de06f19446a3d4a28047df1a4f8932", size = 7236439, upload-time = "2026-10-16T22:17:24.352Z" }, + { url = "https://files.pythonhosted.org/packages/44/b1/67fc37388382bc036a74f04da5bb6fcbf90ec3ac1f45893e06176c373fd3/pillow-13.0.0-cp315-cp315-win32.whl", hash = "sha256:8e459b613cf31f8980f584387b4fe47bf08e076e288d61aa8eba1f7fd4ddbb81", size = 6508688, upload-time = "2026-10-16T22:17:26.314Z" }, + { url = "https://files.pythonhosted.org/packages/44/05/fdb6a79aee10861165526b41b7b440e36ee1ff58613b2fbefe3acbf06d4f/pillow-13.0.0-cp315-cp315-win_amd64.whl", hash = "sha256:d4737f50d23ddd11d6685faacbb9252887dde0bc7997127757247983d74399d6", size = 7281107, upload-time = "2026-10-16T22:17:28.198Z" }, + { url = "https://files.pythonhosted.org/packages/e6/9c/6c6f7dc2a566467baf121394e83de25ac287cffe34cc030726beb4be0224/pillow-13.0.0-cp315-cp315-win_arm64.whl", hash = "sha256:2310e2adfc13c6d457d7d0f2ffdd5c56a74a317650cf765887df8d515a647ac0", size = 2695513, upload-time = "2026-10-16T22:17:30.013Z" }, + { url = "https://files.pythonhosted.org/packages/23/16/e9120defdb8bff693b582d035312acc6f530cdc2bc5238a87f410efccd82/pillow-13.0.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:21c32061a5512dc13f87cc7303e120e4d77c2f70df89a35af0e3ce246e5ac57f", size = 5578129, upload-time = "2026-10-16T22:17:31.642Z" }, + { url = "https://files.pythonhosted.org/packages/47/22/76faf2bb2448f48a84cf894c1e2bb1090d7d2b1aa521ece131cb2f05d631/pillow-13.0.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:1c774b9c0ba0d0b356f71530677b39028878a2cae5a93e0a13779cfd17120f88", size = 4857428, upload-time = "2026-10-16T22:17:33.43Z" }, + { url = "https://files.pythonhosted.org/packages/b3/64/0861ea4e03c50b14af9ed9dd8b9f388ab42f445c623a9fcbab19aef7aa55/pillow-13.0.0-cp315-cp315t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:20822140c9a2ba9c5e42df342b0a892ab2e102fc0e3db967a133bb9ce3f898bb", size = 6612582, upload-time = "2026-10-16T22:17:35.415Z" }, + { url = "https://files.pythonhosted.org/packages/5c/20/cd1e9b3f60a9f3d5ebe46da36955c26004092a501f7f2c42f9fcc26611bc/pillow-13.0.0-cp315-cp315t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ffea6b2986a797c84b6d1d27d4f43e0b83c73fc16281a930891cd237cf0d08fe", size = 7230176, upload-time = "2026-10-16T22:17:37.362Z" }, + { url = "https://files.pythonhosted.org/packages/b6/ef/ffb0a2fc85690714fb7ac662956949645d57f15bf4426f520da361e7b6e3/pillow-13.0.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:05cd2cd39055d0b9650060e4513ef4a9a0aea870083950bd046a0d6490f93a22", size = 6703640, upload-time = "2026-10-16T22:17:39.313Z" }, + { url = "https://files.pythonhosted.org/packages/e0/c2/6402ee3ccb3363aeed8fdb3f9fe56703ac5377a539f0b81b53999d7e121f/pillow-13.0.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:c6fd031333dedcad7ce3e03d244093f43504f209e86925ebdb2b868fa4037630", size = 7309231, upload-time = "2026-10-16T22:17:41.021Z" }, + { url = "https://files.pythonhosted.org/packages/fc/96/d6b82e8b8c06ad143b66b12e0b31051e4bf489b4fabca1f390a14fe1ebde/pillow-13.0.0-cp315-cp315t-win32.whl", hash = "sha256:c50c80e3591e5cf9a8dfa6007d4f10732f02e32263850999286e56ccd650cfb2", size = 6517200, upload-time = "2026-10-16T22:17:42.886Z" }, + { url = "https://files.pythonhosted.org/packages/60/d4/0062e6005e9b270b165015aafd343364ac378ec5a685431ea42baad33357/pillow-13.0.0-cp315-cp315t-win_amd64.whl", hash = "sha256:adb3c2124c68e480f4632d06cb7caa3b48a51678475f483b4edb1c6dee29ea43", size = 7287488, upload-time = "2026-10-16T22:17:45.56Z" }, + { url = "https://files.pythonhosted.org/packages/e4/81/b8eb349746be7bce47dd95337c6634e84910af91b59aaa9159c034c614fa/pillow-13.0.0-cp315-cp315t-win_arm64.whl", hash = "sha256:4a25756244bdcce3b50580baadf320fa48297f0eeb8e114ba64139a40d4d0fc8", size = 2698073, upload-time = "2026-10-16T22:17:47.556Z" }, + { url = "https://files.pythonhosted.org/packages/60/da/f6d644e631c5b370c5d0b899f3ccadd2780aab070b29a110527cf4e1fd2c/pillow-13.0.0-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:8619685cad8efc4c38c66d3b36aad854523297c43d748b3b6f0cc03c90ba3463", size = 5523188, upload-time = "2026-10-16T22:17:59.334Z" }, + { url = "https://files.pythonhosted.org/packages/e4/b0/2594f202d743a35d4fe80682bfd96f277e5ca7aecb27cf64ef5bfc1d000b/pillow-13.0.0-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:7e91e97a929232cdb828889ee6ad0e48d7f40f4ec38818f4e4a8968b2b1af22e", size = 4806808, upload-time = "2026-10-16T22:18:01.188Z" }, + { url = "https://files.pythonhosted.org/packages/8e/ed/d504165ef79af6fafe25c76726cf30f544cc236002f7ed054f1d51adc4ff/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:93ff9c9c3663ce23aaa5d0b6b6abac55359e2a0c06c7e30f3771829af816be63", size = 5464358, upload-time = "2026-10-16T22:18:02.779Z" }, + { url = "https://files.pythonhosted.org/packages/7b/fe/a10aba5503ca13e9e009b8bd0a1a4ce5584bdce246245fd6f3a83701369c/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e65dd6e75de67b2362a4fa3e16aa627595f65054dc4ec73d64680c84d592fa61", size = 6043514, upload-time = "2026-10-16T22:18:04.538Z" }, + { url = "https://files.pythonhosted.org/packages/c0/37/66b12dc476041fe523bca29c9d58fbf1ea92a4eaf73acfb9e993948f1191/pillow-13.0.0-pp312-pypy312_pp80-win_amd64.whl", hash = "sha256:567f20f1c75897d7663830da6ea8af719e03d712b1d9ee7f813319f9ece42e5a", size = 7366030, upload-time = "2026-10-16T22:18:06.638Z" }, +] + +[[package]] +name = "pluggy" +version = "1.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bf/db/7fc19e6f2dc92a966727031389fc2e08b558f0f25eb7403c1119ad4713cd/pluggy-1.7.0.tar.gz", hash = "sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8", size = 123304, upload-time = "2026-10-15T09:50:58.343Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/40/9e/2b38731e0fc536806f16490e1a12d7f0dc2a1235aa8cc07bcc75416a7daa/pluggy-1.7.0-py3-none-any.whl", hash = "sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec", size = 27082, upload-time = "2026-10-15T09:50:56.808Z" }, +] + +[[package]] +name = "pygments" +version = "2.21.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, +] + +[[package]] +name = "pytest" +version = "9.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e4/47/b9efed96c114afcfa3c9d3fe98a76a1d14c74a9e266d397cf6eb64be5e01/pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313", size = 1636369, upload-time = "2026-06-19T10:58:32.857Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/24/25/1de2678b631f5a49215c6c96fff41ba892b0a34df68d6d80292b1b48aa7f/pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c", size = 386536, upload-time = "2026-06-19T10:58:31.347Z" }, +] + +[[package]] +name = "referencing" +version = "0.37.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "rpds-py" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" }, +] + +[[package]] +name = "rpds-py" +version = "2026.9.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/42/68/3bd46b8a5e01d3c2ebdf9c5e9497912e3fe0cde02bac21a7130ca866e403/rpds_py-2026.9.1.tar.gz", hash = "sha256:4793ef7f78268b124b73fa933440f01d258bbae01de9fa53e9080c9ab0425a12", size = 63948, upload-time = "2026-10-04T16:32:36.469Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5d/34/a828586ea3329fbb50895b50e9cf98ca3d924a9f41a0b26d443bff1b3794/rpds_py-2026.9.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:50906f5aea24b5a865cbd0a589698288631d9f3a54c3a937c83aefa95a0d14af", size = 346822, upload-time = "2026-10-04T16:29:16.258Z" }, + { url = "https://files.pythonhosted.org/packages/90/81/ac6a0d064982251856ce009c9e1dd51a34110b3c055aa7d1aad18b4899a3/rpds_py-2026.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e21c1429e205828ea886a2293a4a2c8e01f4c25d9893ca330e97a6cf73f52e7b", size = 341380, upload-time = "2026-10-04T16:29:17.706Z" }, + { url = "https://files.pythonhosted.org/packages/42/ff/bf7d54f362748fd6a49277b9d6531c394074110fedf50ad791ec59133fbb/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2693b2728bbcc48d09a981a356954b0c47c53ff25b545856f28a889ea619f69a", size = 373053, upload-time = "2026-10-04T16:29:19.063Z" }, + { url = "https://files.pythonhosted.org/packages/60/de/74b0ccdbbd28687b9b5fdb34c1cabed88352182facaced9d6f5486b8b9ed/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8601470267d938bcb7f3ab1a336100af51a4fd5b6ed030ef52461bb3ef5e7e07", size = 377742, upload-time = "2026-10-04T16:29:20.543Z" }, + { url = "https://files.pythonhosted.org/packages/c2/6d/b979775a3057b2a5c26d75ecbff60a20a24ef081db6dd76836fca3f20247/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3890a6aa36e6baa53d5258a2a25d3ef8b37ad165a6ab27a892d7c3e3a432cd69", size = 487289, upload-time = "2026-10-04T16:29:21.958Z" }, + { url = "https://files.pythonhosted.org/packages/1d/5d/7c34734ce3ece943d9d6ee0122a74a21bbc75b47acb5b7053c83f6efb1ed/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6b5b393eda5ea42cca1c1a6665f2a4882b4fd5d1777e41ce0545a107fb008c9d", size = 390710, upload-time = "2026-10-04T16:29:23.378Z" }, + { url = "https://files.pythonhosted.org/packages/1d/6d/b26eb1e75395925b3a142ed351cbed2ec8212f5c9d937aee3df32c701baa/rpds_py-2026.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:addeda51556dac7c1a2f14cda62db8b621cd12afba3091d03a96c72932387eab", size = 371261, upload-time = "2026-10-04T16:29:25.1Z" }, + { url = "https://files.pythonhosted.org/packages/7c/98/b2fdfe10301a9e27af21e634337fbba7baac0bc17fe44619a17c26bba2cb/rpds_py-2026.9.1-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:d9edf30457d74eebfd76b045535e36f1cd89062566a128a0db2145ca042d787e", size = 376075, upload-time = "2026-10-04T16:29:26.748Z" }, + { url = "https://files.pythonhosted.org/packages/c5/b1/c4b8d954e49c3c69cf8063c0c9e0919c99f3d2cecc46311606a1cbe835dc/rpds_py-2026.9.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:815d26356930846a40c7bc1366e7b1b0320ab8a063e66c11298a208bed0fd237", size = 399358, upload-time = "2026-10-04T16:29:28.282Z" }, + { url = "https://files.pythonhosted.org/packages/b3/59/9559a7293c97dff0cbb293efffbd36644103883ecc27741af8ef90c84ca8/rpds_py-2026.9.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3b5a6f40f0a1486b4b36c888123afc67acdbd9f33235927acf5ff295429a0ba3", size = 550267, upload-time = "2026-10-04T16:29:29.851Z" }, + { url = "https://files.pythonhosted.org/packages/6c/9d/6dc60e49511de4c8b00e74f9c1d43aed4d27f712cdb1ade92f2c199cbf64/rpds_py-2026.9.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b5b8b0753718d258fd454283fbd57e14545d3b40583fa672e27cb4f987626bcc", size = 614018, upload-time = "2026-10-04T16:29:31.54Z" }, + { url = "https://files.pythonhosted.org/packages/fb/bc/92a4ecf27301b886232a413360f6b348a81d55ffef654f2ebda5970ebc3d/rpds_py-2026.9.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:46d80bc76b51a6c24f9944368c28d38b8bcbcea1da4f2f8d3ebc31a67e8c6ec6", size = 578509, upload-time = "2026-10-04T16:29:33.01Z" }, + { url = "https://files.pythonhosted.org/packages/08/53/efb97f2e6589b7ab8394385a73870e0b2ab2a195281c117b21fd6d7d4855/rpds_py-2026.9.1-cp312-cp312-win32.whl", hash = "sha256:befc2d6a953e563f8a7bfd87a42c22ebf8a3e980dcb7b6a4d17b70b0e914e8a3", size = 205401, upload-time = "2026-10-04T16:29:34.451Z" }, + { url = "https://files.pythonhosted.org/packages/1c/84/1700cc748d0eaa747486e4e82882d2575224e6e9a3148df583058850c629/rpds_py-2026.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:5ce8943f79c2210f7abcc28e86367b03b28d95027fd01c46d2472373ae70c86f", size = 222923, upload-time = "2026-10-04T16:29:35.709Z" }, + { url = "https://files.pythonhosted.org/packages/c3/89/0302215373c2f8b4408b0fdfee955368cc378a98ff59508d47a7e0dc2dbf/rpds_py-2026.9.1-cp312-cp312-win_arm64.whl", hash = "sha256:501909f2e4a1e2dee528ef766fe3c469060ebc17e54a8383d404ba07a81a6f02", size = 218415, upload-time = "2026-10-04T16:29:37.263Z" }, + { url = "https://files.pythonhosted.org/packages/83/ea/ee88fd9e756ff93fb6b1182a47ec09504a242620e33ce1d20679efefe841/rpds_py-2026.9.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:a36b70596407634ca82d4b989a3729074a008537a0522e4c8046a67c729103e9", size = 346229, upload-time = "2026-10-04T16:29:38.82Z" }, + { url = "https://files.pythonhosted.org/packages/57/71/a097d6552f837500fc36e6b23d09cfb9890c3cc47531f9ca64e149799615/rpds_py-2026.9.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:eba5d173f7d5708b22a93815017a4611873ed54db9f268077c0dd1ed99cfc858", size = 340514, upload-time = "2026-10-04T16:29:40.405Z" }, + { url = "https://files.pythonhosted.org/packages/bd/b7/497e85768bf4e0d8ddbaa096a4cac31d1509251dee2728a8490aa367e0b5/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:457866b85daf5034296666168b84a69e0b2e89dc4f1af102b46f6448a60b9063", size = 372611, upload-time = "2026-10-04T16:29:41.778Z" }, + { url = "https://files.pythonhosted.org/packages/52/4b/74ab4108916250b6e198e0d3af05bc6835eb046315f22f7a0ceb49667c5a/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a3a52a3ba86436ab3aef510fbe21512abc2ddd1993005dfe50514bd2284ef025", size = 377712, upload-time = "2026-10-04T16:29:43.242Z" }, + { url = "https://files.pythonhosted.org/packages/0c/8e/067e77d9d7b3cc793c9d909b7e97e7aadbbb1fb094093b6876902cc96d38/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d7841166b7fa64c9c56404617ae4341448847482d45933b13135d26c130519e5", size = 488106, upload-time = "2026-10-04T16:29:44.692Z" }, + { url = "https://files.pythonhosted.org/packages/3c/b4/c5aae6c2dde269bf955f6b7d35065c655a57e47750d9668052ad67e74dda/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:926bdd3e3b5998ddf70cc64bc8cf57209571f9044542913afb673799fec77dd0", size = 390795, upload-time = "2026-10-04T16:29:46.129Z" }, + { url = "https://files.pythonhosted.org/packages/a0/36/76fab39973ee11e7f9f357c55138197bb01c86f6502cb76487e3b4f42db0/rpds_py-2026.9.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7868b85224291c6cb6759f9b5adb9745f486d226f62b16a614dd5a2a5ab2b35b", size = 370794, upload-time = "2026-10-04T16:29:47.603Z" }, + { url = "https://files.pythonhosted.org/packages/3d/fe/cd2a80e6d7b871937a60e935c5d507aa390d143f4ff3636f640b9733d5df/rpds_py-2026.9.1-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:3cd182d7291d29b92c521a0069d9c01ba6193628a9a105531d11b40a6d731a33", size = 375673, upload-time = "2026-10-04T16:29:49.223Z" }, + { url = "https://files.pythonhosted.org/packages/6c/18/7464a9953724e55a3b3206062fa0ffdeaa519584c6aabf65d3956d94f131/rpds_py-2026.9.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e6ea1cda8d8c688278430e4268a42f5e5da3bdd74578dfadc0820c3f1766ce83", size = 398758, upload-time = "2026-10-04T16:29:50.601Z" }, + { url = "https://files.pythonhosted.org/packages/c0/86/1534b436700fd49ff411063b7c4d7e938adfabf90895b6cf1622d5a7d1f6/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5943980471829f6de242a20b109de3111ba6b77e3af0ffc587028ac854b05e6c", size = 550370, upload-time = "2026-10-04T16:29:52.002Z" }, + { url = "https://files.pythonhosted.org/packages/57/1c/e1fa82a8a01e3c5820f3ba98a8b2673f642128eb368fa88871b01dd2c909/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:76d3af9732d2dab69f28179b40ba2d87e2f1d5824b4a694780aa787d685e8f36", size = 613106, upload-time = "2026-10-04T16:29:53.655Z" }, + { url = "https://files.pythonhosted.org/packages/29/55/b20b8c4c3dde8755bfcd5b08492a02d0cd2e26929aedf6199ca2a377d42a/rpds_py-2026.9.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:78326f4cb4427a56ba4996c0762b63be45f06b85f086526420d2b3a66e40f84d", size = 578235, upload-time = "2026-10-04T16:29:55.157Z" }, + { url = "https://files.pythonhosted.org/packages/55/42/df3f7bbc3f7ab37a8a9db8d6c2ff2c985422899f1f7926afbf7ec3c0b8b4/rpds_py-2026.9.1-cp313-cp313-win32.whl", hash = "sha256:172e47169583f46ce118cbec68e6795d0da0f4606b488b6434f8276bca0a058c", size = 205293, upload-time = "2026-10-04T16:29:56.669Z" }, + { url = "https://files.pythonhosted.org/packages/31/9c/ba5a9569d719bfdd6ce863df4133ac6a1658cf1b07cc3534c31db729fbbc/rpds_py-2026.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:3e93b2cd69a9830be33e03945cd7cda940a0a8bfcfbff41d6144f0cb0d3d8bd9", size = 222409, upload-time = "2026-10-04T16:29:58.049Z" }, + { url = "https://files.pythonhosted.org/packages/35/72/f28ca566f6c23c35bbf7445f65eb0364577b25a026305995e24f78b83d94/rpds_py-2026.9.1-cp313-cp313-win_arm64.whl", hash = "sha256:d151e148117294133bf8af7eeace085e7e87432db15ab6adf640330298a47f6f", size = 217681, upload-time = "2026-10-04T16:29:59.449Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f2/67b94be1532767803415c1c5a1fd88ea487643d74a673cec1ba140af77bb/rpds_py-2026.9.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c9d1aca01f49170fdcf5c92761b1fafe97f554b721ca4570c5949fff778f0d4b", size = 347178, upload-time = "2026-10-04T16:30:00.865Z" }, + { url = "https://files.pythonhosted.org/packages/04/37/b751de2b59b0197a1d92a5dd491de88e8a5e928c2e6562581974f1e85263/rpds_py-2026.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:3f0e9ac28fc067d4d34b88ae43c48e9489455c97fee9633d851f7eeed5a05d35", size = 341878, upload-time = "2026-10-04T16:30:02.564Z" }, + { url = "https://files.pythonhosted.org/packages/72/e2/5873bc4643c250db9e05d48dc0c93763d4aa68bc3b81164cb1af3b45b284/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07deecbfce94c78473018bc7d10b337cc651d12df87a1eb2cb3e4024bc9c33d0", size = 373963, upload-time = "2026-10-04T16:30:04.026Z" }, + { url = "https://files.pythonhosted.org/packages/51/03/5acf7632158247f3f6386ff0af3a1ee48167d575037e8d0920594b76d92b/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:821b2755db9194409254012f429c56643416fb96ef9be090be82ec8826b7f477", size = 377975, upload-time = "2026-10-04T16:30:05.555Z" }, + { url = "https://files.pythonhosted.org/packages/e6/00/63fda451b8bffa5808fc8bb311ee7c073b340974b09f273c7b2a145d3d62/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c91c210ae7645626c608400e3519b4a642f837cce09ca830db3beb2e9f274d4", size = 490347, upload-time = "2026-10-04T16:30:07.156Z" }, + { url = "https://files.pythonhosted.org/packages/a1/ae/c093ffd070ba0fb02f76c565d06fecc65ad6e4afdbae78f7031076d3cdac/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:54ac2158a6f96cfbabff0b2eedaf94b90c5ec7ca8317fcadc61e1c2b2e0ff6ef", size = 392962, upload-time = "2026-10-04T16:30:08.77Z" }, + { url = "https://files.pythonhosted.org/packages/22/9d/d08a1128ab199b2f0cf25bfeb0639bd05119fff4b7c47bec24ef9a8ec23f/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eac2f5dbafd585dfe31f86a23ebf0d3ba480a9d49ebc87947267b5608d4ea0cd", size = 371623, upload-time = "2026-10-04T16:30:10.501Z" }, + { url = "https://files.pythonhosted.org/packages/53/c7/4758ddcbb75609414bbccfcb11d612436f9b3ee821bd2f33f0f1604ee648/rpds_py-2026.9.1-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:8aa5dda18d39b6143eb24809d158f9252c88f402749b6f1b62a506cc7d96cc35", size = 376997, upload-time = "2026-10-04T16:30:12.124Z" }, + { url = "https://files.pythonhosted.org/packages/87/e4/947bd7f608ff60faf46dc9d389c3dffd0e3d767d78a0be19978448ef0ce7/rpds_py-2026.9.1-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5c90e7fa02e8f5de0d10c17595c568ada48c5302e749462c0ea1a4c362111a86", size = 400169, upload-time = "2026-10-04T16:30:13.804Z" }, + { url = "https://files.pythonhosted.org/packages/4b/35/fe93e020a0543b5670472c18d7e6af3197c08da571240ce1965c84f85c0f/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e6d198bad4e49dd6732fbd636e2fc5c082f45c8cad0b4acb756b00c82c76072e", size = 551615, upload-time = "2026-10-04T16:30:15.332Z" }, + { url = "https://files.pythonhosted.org/packages/0d/4f/5d2a0136bb03b2a56a39dc6ff92d58a6e3e53a2e17079238b86228882f16/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:96beca19ec79de272e8668585380ff9092c47077c1d7a1e098e00bbd921f4785", size = 614655, upload-time = "2026-10-04T16:30:16.92Z" }, + { url = "https://files.pythonhosted.org/packages/09/1c/3f1025aaf70d9bf7272cc41f8b64ee76b48bf01726248138430e16f23b38/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a5cf77eb04f20b720be95265a3e00eb2a14814074255cc27069c551b2db53118", size = 579602, upload-time = "2026-10-04T16:30:18.555Z" }, + { url = "https://files.pythonhosted.org/packages/53/0d/5c72e6204f76610608706da32b6b7e11ef7e10317558a7bb15a122e008dc/rpds_py-2026.9.1-cp314-cp314-win32.whl", hash = "sha256:a03d57b86d2a51d0a66c92177e2be154ad015f357791d306e714569999cdb4cc", size = 206315, upload-time = "2026-10-04T16:30:20.05Z" }, + { url = "https://files.pythonhosted.org/packages/a4/0b/489d48abbcc7d70cf3fbf662d9d22abf1f4650761c0a9ae05260800800d3/rpds_py-2026.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:837c6b305e26fe0f75b15c92cf3b2ba29e0ae19dc40b1c557b026cb426347d0c", size = 222852, upload-time = "2026-10-04T16:30:21.604Z" }, + { url = "https://files.pythonhosted.org/packages/91/16/bbb05a7e6a10cf79ba639be7f799d770ee15f64175cc61d081b218dd402a/rpds_py-2026.9.1-cp314-cp314-win_arm64.whl", hash = "sha256:fce4b85234a0cbad67bf8e6e1201ee815d172c9aebad75f25645bc4d834f8e31", size = 218709, upload-time = "2026-10-04T16:30:23.036Z" }, + { url = "https://files.pythonhosted.org/packages/22/ac/ac507a0a4ec478ca470440a09583db4be5259ba7670aeba0620822f1e57a/rpds_py-2026.9.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:3a72c11530d71abfb66c8d7696a2f86c43e63fca8b948f1a784ac490f4ec688e", size = 349596, upload-time = "2026-10-04T16:30:24.558Z" }, + { url = "https://files.pythonhosted.org/packages/e9/f2/817a46b658d5070f477f722c298ee9a24525b0e4017347964146ef5fdd0e/rpds_py-2026.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:068c37bba854ec2fe42f7365c640af11dd9895890ccbf2df5070d0c059bd7f96", size = 343114, upload-time = "2026-10-04T16:30:26.048Z" }, + { url = "https://files.pythonhosted.org/packages/6c/42/6ade976b13ac1b4cb3bf2eb603f1be2fe74df19a29988d4c2b386be59d6f/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fca4eb6df565e2a928f1c7dad92d27db8f9df0f449e76423ed5d7e713ed445", size = 374197, upload-time = "2026-10-04T16:30:27.699Z" }, + { url = "https://files.pythonhosted.org/packages/d9/70/77cdf1d3f1a07faabe936016ae623aec7981f73108a8fe7a203ed2e21998/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c933c6678c6f116ff8af47a4c6db0868b8ace74af0343016c0ef00f00272ea69", size = 378025, upload-time = "2026-10-04T16:30:29.451Z" }, + { url = "https://files.pythonhosted.org/packages/3f/6b/18a44a3beaa9b7931acb04af7bd9539836477c630a794452d4826d6185d4/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:028ad274ea951dac64491b5d1e65712a4aeabfdbdb9fccf797b57bd899b0c495", size = 491969, upload-time = "2026-10-04T16:30:30.995Z" }, + { url = "https://files.pythonhosted.org/packages/73/27/fb39cfd6bddaf741b024f813890374578ff8ac1f1adc473659c048b03b05/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:740d0a99cf9de0b17a3943388e9294a59becf75e7c43421f387bd3c7a9901f7c", size = 393905, upload-time = "2026-10-04T16:30:32.628Z" }, + { url = "https://files.pythonhosted.org/packages/ed/71/0fa7bb77b57af0d710273964180d11b503f62b8a5c358eb2d8c3f62feff6/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0da298fb372dc192610a4b9ecbc68a0cd8b675bbbd1fc519d01b41cfd658333e", size = 374569, upload-time = "2026-10-04T16:30:34.257Z" }, + { url = "https://files.pythonhosted.org/packages/54/22/f41cfac269af3b449513ef1bc3d7f32fde52abbbd2d01c7e76b47743acd9/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:eb61be926bb81567c1f48bdc8aa22b9855048dc2efd53871f9f7e6e9a5632346", size = 377482, upload-time = "2026-10-04T16:30:35.997Z" }, + { url = "https://files.pythonhosted.org/packages/b4/fc/312b49006e7f8f9ca5f96647577b8aa6f3df30519c46bd448f5c425af0b2/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:42e75466f83cd43f6026c81eab74246efb2bdadafb307b85700632d06c68f299", size = 400040, upload-time = "2026-10-04T16:30:37.76Z" }, + { url = "https://files.pythonhosted.org/packages/cf/a6/18cca7a878dc7fa95165a83343fd4d7b65643fd22e54e47340a451121d5c/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:617f59cde379b4f648a09797b7f683d04b90a46344cddab85639da5aff0f5531", size = 551849, upload-time = "2026-10-04T16:30:39.443Z" }, + { url = "https://files.pythonhosted.org/packages/e4/6d/1f5685e20f39604691bdc3c05aaa6b8bd2f954e9e996477adf2376768e33/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3edae8c5ddfdb6985d49ae9d150516e5076888879022f91a26c2de9276ce0bdb", size = 614842, upload-time = "2026-10-04T16:30:41.231Z" }, + { url = "https://files.pythonhosted.org/packages/c6/25/98652109fd9f7e10268dd4571aa52b81987001b806f37ef1a18260de714a/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0f045bb053c9057720d72c56dffe30dffdc05997b2897a827b9325f0ab6623fa", size = 582606, upload-time = "2026-10-04T16:30:43.345Z" }, + { url = "https://files.pythonhosted.org/packages/19/03/11ca09099bab5f53373a80a334c424ec917c13d050760a59499d2af5171e/rpds_py-2026.9.1-cp314-cp314t-win32.whl", hash = "sha256:bf35d0568abda97233239ce32896d3ad53fccc537832c104e30c94aa5fb93569", size = 203341, upload-time = "2026-10-04T16:30:44.954Z" }, + { url = "https://files.pythonhosted.org/packages/6f/8a/88909e3ffd9f47f5b58211473875d8c3c09079f0058c46fb72c55a702a26/rpds_py-2026.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:1e8d4d79d828299bf44a55db22a9388ab967b49d17132c88eab0f4360b48da8e", size = 222843, upload-time = "2026-10-04T16:30:46.486Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b7/a662f367d4896dd0a10cef2fc91f10b7f08af1c10858e287e019563f338d/rpds_py-2026.9.1-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:1d77b649e6f7cdf12ca5c2a98dad0ad37f9ea9b6f960408a92f0cb12bb3d04d9", size = 347463, upload-time = "2026-10-04T16:30:48.203Z" }, + { url = "https://files.pythonhosted.org/packages/ae/3f/ad45d03df4f84ebae5439577ee81f3999d182711e82235c8037b6528890e/rpds_py-2026.9.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:00ba2d8c7dd4ee537978ddf4b3fbd712bef2d8751603f7f3146b3f4287768e25", size = 342051, upload-time = "2026-10-04T16:30:49.872Z" }, + { url = "https://files.pythonhosted.org/packages/7e/31/3dcd68c13d4bcc59c1f7eb33ac8e80698f06f3eb0d8a1e06419836071c20/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec450527cbf485e13c8d3602a54f428ab0432fdade0ede75efd74b735421c871", size = 374143, upload-time = "2026-10-04T16:30:51.508Z" }, + { url = "https://files.pythonhosted.org/packages/cf/0d/68c1f058a250fbd1380ebda9fc227cbf50117adf8ffe8161ef383ea79f68/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:306ee1850d8105b5baf977e78d45fcadd12c1a54678d614c9baf217708446e91", size = 378604, upload-time = "2026-10-04T16:30:53.206Z" }, + { url = "https://files.pythonhosted.org/packages/d7/d6/2d4c59b85397cb4800594fadf692688ccf5ce556adc930e7a5bf21061a5e/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ef6b65b03247c54692ad4fd9ee97cb772781927db72e3cb05e70b3db6d1ff14f", size = 490790, upload-time = "2026-10-04T16:30:54.925Z" }, + { url = "https://files.pythonhosted.org/packages/da/04/7e05dc3aebaf52f4e026766bd668fdd09a9d0e23f64a14686b36b3501892/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a575404ebc9cf2e91edd32eaf570ec1430eb900d4f56724ba7dd4bc1fc9c176d", size = 393146, upload-time = "2026-10-04T16:30:56.625Z" }, + { url = "https://files.pythonhosted.org/packages/57/ca/e2e9a0a46a74ed51a0498ba1fe10f4ea6b2d9a155f372a2f91e51f18cf10/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c16ab111bc27c646ba8aa005d0527754edc538ebb636f0b1bf8e244b48d1945", size = 372022, upload-time = "2026-10-04T16:30:58.295Z" }, + { url = "https://files.pythonhosted.org/packages/ba/cb/8f8774df5134e23424372838bcc5c7ed4127d723e1ff52f7bebd4dcb2563/rpds_py-2026.9.1-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:7664419f27db41d4f1c43a78dccda7dd6e8ef2428df3ee01d0c2a07a6b071297", size = 377092, upload-time = "2026-10-04T16:30:59.984Z" }, + { url = "https://files.pythonhosted.org/packages/90/02/8d7095d73bf9114219be40230baa5df00611e0a82ed9517779ff9c19f82b/rpds_py-2026.9.1-cp315-cp315-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b26b03d9d2658ee2fa234f8f4f19f38a09773fe5261028025032e26d4d35af0", size = 400830, upload-time = "2026-10-04T16:31:01.721Z" }, + { url = "https://files.pythonhosted.org/packages/ec/02/8206856f8f363cd042a8315dc86b3912f5dcb6d3c66bbb24b69c2bfb0775/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:be3e47e2d91aa3942ff9bf4077a505226005abfc39b6f7554a91c1b9393986b9", size = 551478, upload-time = "2026-10-04T16:31:03.472Z" }, + { url = "https://files.pythonhosted.org/packages/41/6b/36211f1bb1f0b0313f496d92f5905b74ea107f27cb16fa3355a82f04575e/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:6307a0da524939decb8ca4a3933b8ab62525794411d6984fca6726e732804af6", size = 615173, upload-time = "2026-10-04T16:31:05.281Z" }, + { url = "https://files.pythonhosted.org/packages/35/77/cda0c4a6f055446b692f0ed5692f73707cafd3dff82672ede31b1a9b59de/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:159a7aab5c5e8b112c8830f54717ce56da1252ebdbb526f5be2df2309280b9e7", size = 579653, upload-time = "2026-10-04T16:31:07.065Z" }, + { url = "https://files.pythonhosted.org/packages/74/ec/d8385f446240aed643b9e92a5055cff3015cc04a13c61f73b2883c478ed5/rpds_py-2026.9.1-cp315-cp315-win32.whl", hash = "sha256:dbc2673f9223d420c91145599b3ba45a8a50c207d1976908e5fb5ddb0c9b9429", size = 206498, upload-time = "2026-10-04T16:31:08.989Z" }, + { url = "https://files.pythonhosted.org/packages/6d/a5/71b5cd00e0521e3b6b81828baea368c62b6b700ebdd9554cd7d41ddf12fa/rpds_py-2026.9.1-cp315-cp315-win_amd64.whl", hash = "sha256:75c38c50ab9aca840225d9a9a3810bf11d04bd5c1f186cabbb8aee56db3e9b15", size = 223121, upload-time = "2026-10-04T16:31:10.84Z" }, + { url = "https://files.pythonhosted.org/packages/33/58/dba857c3bc8221b31b62eb170a3080f4f191de79f047200389b7ed1b06a7/rpds_py-2026.9.1-cp315-cp315-win_arm64.whl", hash = "sha256:a431156bb41865fc14cd5d79bb9d7bbed83110b0159e34e62ae30951f96c0009", size = 218741, upload-time = "2026-10-04T16:31:12.592Z" }, + { url = "https://files.pythonhosted.org/packages/5b/d0/320ab28ccc1415eeb509d68682b0014fb74690cd49f1c2d29a232475af50/rpds_py-2026.9.1-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:ef0d8c843e2827d6c120ab4687e9423fb1d893db1df27b7c1506615bcb9734a0", size = 349719, upload-time = "2026-10-04T16:31:14.48Z" }, + { url = "https://files.pythonhosted.org/packages/56/88/f5b12f1358f443c08b7ce3cc8391d82d335f4872580e2e097847fd36087a/rpds_py-2026.9.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:45bc6bccf78b20fd834237d18db64965d7ee68ba7f60440a26c7ab71e7b8d51a", size = 343267, upload-time = "2026-10-04T16:31:16.827Z" }, + { url = "https://files.pythonhosted.org/packages/f7/0c/c765b0059d532acb3b9c45d781ccc22f15a96dbe443d00903f643ba9df10/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d55198263bb51f557550c6ed2e6d1cb6a6fed6eb5c9120b741c5926bef8a45d", size = 374555, upload-time = "2026-10-04T16:31:18.931Z" }, + { url = "https://files.pythonhosted.org/packages/6b/8a/cafddfda77564a10cd21184640c3bffda6a2b8d20972fb5dedd5e0166328/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a8763f20692da7df39b0afdd1ba3042b004c50a45994f76c2d9a25641f7673db", size = 378346, upload-time = "2026-10-04T16:31:20.75Z" }, + { url = "https://files.pythonhosted.org/packages/b9/01/5e626016eff72c183bf6c96539240cace15d402468647a453ec08415b2fc/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e43d4a1f673e8a1cbd8533e809e02b4bf9d4f2280269bb640436556312121250", size = 492373, upload-time = "2026-10-04T16:31:22.614Z" }, + { url = "https://files.pythonhosted.org/packages/3b/9c/15a2469e9389242f46896b3f0a01d68caea8a5a35c011fcb05ef333aae73/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea394a937f17a54c51239348bdbe2e3518124c8d4a8951ba04a311d3095bd18f", size = 394371, upload-time = "2026-10-04T16:31:24.768Z" }, + { url = "https://files.pythonhosted.org/packages/63/f5/c100ff77e1e6366e947c75969c258fdfc4b7bc5bbfe7351e62ffbf2a1228/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdeaa99ce822dca76cfb1b993e9120c5ea212f2eb66d48950ad63c349668a018", size = 375132, upload-time = "2026-10-04T16:31:26.588Z" }, + { url = "https://files.pythonhosted.org/packages/dd/f4/fe0269c9de253e99c81cabc12b8971a5feaa083debdaff1221e06264d9e3/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:b4f062343e7ad3fa94f2c66e5ae667dee47ee74dd41a9057c4fbe163236a123d", size = 377642, upload-time = "2026-10-04T16:31:28.677Z" }, + { url = "https://files.pythonhosted.org/packages/05/65/b34a7b257baccff8f4a24a722933166d4941d5ebdc9c3f4bc4ffcd5ce4f4/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22ffd29a63d71fb1b81552c21f2c2b734949b7ac751a9be70675a939a900839b", size = 400855, upload-time = "2026-10-04T16:31:30.802Z" }, + { url = "https://files.pythonhosted.org/packages/98/32/844e54176b6071b90b38a564e6940bc6eb8f97b2890dc709c19db9dec0f4/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:08dae4a4095150a7c4545a1fb40b98e1ab1744fbc2770d92c977b9dadaa49ab6", size = 552573, upload-time = "2026-10-04T16:31:32.709Z" }, + { url = "https://files.pythonhosted.org/packages/17/73/6041d20729dffbfdf155c02d65be58bc225a1c1fb548fd87c23ef306138f/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:9a0460d43603d1fd9ef59c30278531e15d78581721ddb538fa560aa7817ea4ad", size = 615840, upload-time = "2026-10-04T16:31:34.565Z" }, + { url = "https://files.pythonhosted.org/packages/af/9e/418094adaee6b056ce199051b255448ed872829051e341b2294c80da0977/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:1c2d1f6da5128eabf34e963d7163a818846075a52568250d006c4c953b40f903", size = 582764, upload-time = "2026-10-04T16:31:36.665Z" }, + { url = "https://files.pythonhosted.org/packages/3d/9b/1698ebf6b840ddfe8b472198abbed6ace35c6e398faeecd6c47dae742a4e/rpds_py-2026.9.1-cp315-cp315t-win32.whl", hash = "sha256:5c6ee90dee3e85e055ddfd502d611643d9b0fd94c818220bda84ec3dacd9b27b", size = 203795, upload-time = "2026-10-04T16:31:38.53Z" }, + { url = "https://files.pythonhosted.org/packages/8a/e2/91f70d804c61f8eac39a417e82aa1024f655ab9e8bdd7393b196242bc41b/rpds_py-2026.9.1-cp315-cp315t-win_amd64.whl", hash = "sha256:fe5ad0664ec772b02c45859041aa17655709cced7a31005817fbbbd988c25567", size = 223037, upload-time = "2026-10-04T16:31:40.468Z" }, + { url = "https://files.pythonhosted.org/packages/a3/90/a9ba81408369d34c1aca73319c15adc91ed45c1d21e9e8ee4832ffb7fe0b/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6cdc537c8633d7fd92a82e2e0d2ab74320a3f63d5e59fb9cf08711e08fe151c4", size = 381109, upload-time = "2026-10-04T16:32:08.994Z" }, + { url = "https://files.pythonhosted.org/packages/b3/44/5192a0bed94cec86bd2a5e1cc5a1bb8f7eec3aec907eacd2deb13e87e326/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:10e208f2425d973938afcd56e28a7c4be32e27b6a60b5d381f49fb9d8acf9759", size = 388222, upload-time = "2026-10-04T16:32:11.321Z" }, + { url = "https://files.pythonhosted.org/packages/92/cd/5356549711448f18b52f7a11ffbe90f1228774996fbf3c6cd1b18d22abaf/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c0dbbcc19735fe5f8b0a54c07659d154a9e69f47e15d0a6ab7299215daf62cb", size = 500384, upload-time = "2026-10-04T16:32:13.478Z" }, + { url = "https://files.pythonhosted.org/packages/7a/88/ddda9d28adfe33119c75b2e733d4ba7e326f41d7e1b1093951771768ca48/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:684fd492fff4fead00587544e059be2bbcb6f93454f21fa2a91b66fc7508be82", size = 401661, upload-time = "2026-10-04T16:32:15.653Z" }, + { url = "https://files.pythonhosted.org/packages/32/c3/bb59ba16a6b4a57995d15b8c04c00f28df3b938c4dcdde48fbe0f73edb0c/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d1028417bb44037eb3069c1009bd7b7277212876cda22fbe565b0bca9fab6d2c", size = 380748, upload-time = "2026-10-04T16:32:17.727Z" }, + { url = "https://files.pythonhosted.org/packages/f5/b8/0580faa1c5a32ddc160130dd7ae54d2d007272a89a40a6b5db3e50f9f585/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:492e5e428cbe126221611f47e068f01660352feec4ad18bc0f5ea9b2ae88fb14", size = 385731, upload-time = "2026-10-04T16:32:19.855Z" }, + { url = "https://files.pythonhosted.org/packages/bf/70/f73564642bbe3322c7eeef2c2f258cf040b71c41a430b532e59d04a1b838/rpds_py-2026.9.1-pp312-pypy312_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:88b5268892fde430d5531f95bc560b6efbbd67c929662c586afd729a96e7461c", size = 412131, upload-time = "2026-10-04T16:32:22.285Z" }, + { url = "https://files.pythonhosted.org/packages/8c/5d/17fff2e1f8f68721a2afb5cb48f7e442c751bb6b4883157c5abaf618cd08/rpds_py-2026.9.1-pp312-pypy312_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:01445c8d194aa032a08e944f16567672da1c62dbdbefd8b6d0693032e290cf68", size = 558193, upload-time = "2026-10-04T16:32:24.4Z" }, + { url = "https://files.pythonhosted.org/packages/2a/d0/869ab6fb08531f97aae4a780b4d61b4190d8aef48fe054ee28bcf7114466/rpds_py-2026.9.1-pp312-pypy312_pp73-musllinux_1_2_i686.whl", hash = "sha256:eef6a03b0b6d08d0835ccfa8ec8d1bc70525e3801387567137b50c557695e6da", size = 622448, upload-time = "2026-10-04T16:32:26.844Z" }, + { url = "https://files.pythonhosted.org/packages/ba/a5/9672e532fe02cd3b92c78cfd8743abca939d96853006c63835009a1ecb6f/rpds_py-2026.9.1-pp312-pypy312_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:6b9bf3135b4ad5981df9a73d71a35272d650a2985ae9c2746357b24d59de2448", size = 591126, upload-time = "2026-10-04T16:32:29.274Z" }, + { url = "https://files.pythonhosted.org/packages/80/ef/3a9f8e4279c7920af561deed4cb7ebebed2794a8f608cf404d5eef14a105/rpds_py-2026.9.1-pp312-pypy312_pp80-macosx_10_12_x86_64.whl", hash = "sha256:56c6952a9b15047466d0c2347c446a761d4527f89976156341e68f0ce5cc08b0", size = 357108, upload-time = "2026-10-04T16:32:31.641Z" }, + { url = "https://files.pythonhosted.org/packages/b7/55/4b2fa381a583760aea5c92841e4e928a358e1c6511b129219e9c2826a226/rpds_py-2026.9.1-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:b242c27c8f836305a4a72df9cdd564386ac57b807bd252a063223331c9316b37", size = 346877, upload-time = "2026-10-04T16:32:34.061Z" }, +] + +[[package]] +name = "ruff" +version = "0.17.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e7/e6d5749983b020e6cb1055abec0a6f361a8e94f0184cdcf56d4760995f02/ruff-0.17.1.tar.gz", hash = "sha256:5bb796c5112e9fb9527f2ef2faa0a130d6312d19de92bcfaddd70dbb2d41020f", size = 5323349, upload-time = "2026-10-15T15:23:18.64Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2e/78/90c46ca6250709f7c37e397b60d06061adee8d0f7d13959ed6a8e49b14fd/ruff-0.17.1-py3-none-linux_armv6l.whl", hash = "sha256:1796c41eafec66f4635125dd1e074a7aa27b8d20c187d484360acf11d247fc4a", size = 10147528, upload-time = "2026-10-15T15:22:33.667Z" }, + { url = "https://files.pythonhosted.org/packages/aa/d2/a2e28bc35b083ae51fa07dfba5280a667c8b01ecaee7802fc8849dcd5c46/ruff-0.17.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:8eadb09a788010be29c895418bdfa513e4e1c65e64b94e5b19e4cd381f6cc7fb", size = 10225974, upload-time = "2026-10-15T15:22:36.328Z" }, + { url = "https://files.pythonhosted.org/packages/8e/71/7a9029a81c8206ee01a98f6cfeeb56e6c095af86857581a37045c46d7e94/ruff-0.17.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:29b454f18ca3eeaf37fbf140841dcf27d36109e29dee9aae8acecb68c26c6f74", size = 9270361, upload-time = "2026-10-15T15:22:38.651Z" }, + { url = "https://files.pythonhosted.org/packages/c0/8c/e075e9c917cb0575297880c96768304e881240171c870cbd8d9b7b54bec2/ruff-0.17.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:872e03dd231744d6c5ec5c8af6be52b71323fc6ee096e4c8b34d9f844ee3b978", size = 9938300, upload-time = "2026-10-15T15:22:41.284Z" }, + { url = "https://files.pythonhosted.org/packages/87/27/0b4bb926a49de2383f161272b4d863571a4c7ecdbf595a6bc58813a13367/ruff-0.17.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4c0d6cb5f8fbac77eec9af49f4fc0eaf856b05545e372b0694d24b4e76b1c640", size = 9948464, upload-time = "2026-10-15T15:22:43.681Z" }, + { url = "https://files.pythonhosted.org/packages/14/27/518d57e0e02aecb8ea4acac6b57b51a53173d25fa734952bfdd7d531e88e/ruff-0.17.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78beced4a3c94dfedbee4b999b95b6a27b35820fdc0afbacc6d37a8da26c1cd1", size = 10638639, upload-time = "2026-10-15T15:22:46.081Z" }, + { url = "https://files.pythonhosted.org/packages/01/82/d89a4e498ade59e6cee52d67f8da569019372212b87468c1fdeae884601c/ruff-0.17.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7feefc63921202894f0e158b0e32f45a5950d70a7fb693ccb9264816c25b1c05", size = 11337238, upload-time = "2026-10-15T15:22:48.894Z" }, + { url = "https://files.pythonhosted.org/packages/a2/7c/3b0fdef9352656317c977086fe1d802902406e4f2a0d8578da90c0e6d1c5/ruff-0.17.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:684154861a819bf1f433669d2a0ce9c3e54677c65b8ebb866cc2a7ec86345785", size = 10896327, upload-time = "2026-10-15T15:22:51.45Z" }, + { url = "https://files.pythonhosted.org/packages/62/86/5566290219708ce2928f3a29c4f843a1185b341ec6111c4631a33c5ceced/ruff-0.17.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6ef98e51de8ef38082f90653ceeb84944bd7673783eea13e1647c5b9b064189", size = 10350811, upload-time = "2026-10-15T15:22:54.401Z" }, + { url = "https://files.pythonhosted.org/packages/ad/d2/ca8462dabb3c413990d49703ba306c30c862195a75448d080fa8fcce9775/ruff-0.17.1-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:8f9aa5b5bd5fa1937803ea609c8f153b8de39bf3e0e149897ae34b0c5b52f467", size = 10569994, upload-time = "2026-10-15T15:22:57.142Z" }, + { url = "https://files.pythonhosted.org/packages/e3/ad/dd1864c1f1db17c8cfb297ce70b352388e6977620f66f7182c52855407df/ruff-0.17.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:80e53b0e5faa3c5667f035daaa032893ae42b7cfe708c886d39ed131e54688ab", size = 10059672, upload-time = "2026-10-15T15:23:00.084Z" }, + { url = "https://files.pythonhosted.org/packages/65/45/3f56cf1d2168c2165cdd5ac6f9668aee66a4cfdd4caf2b2cc5ccb2b1d568/ruff-0.17.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:056c5d5fa0ac790051ae165d7035c7bf956d02de2db557f2e9b31d877a505fca", size = 9947803, upload-time = "2026-10-15T15:23:03.132Z" }, + { url = "https://files.pythonhosted.org/packages/aa/4b/5457cb2be4c1d1ea5e919558131a0f197a4a454a0530d9e30820e8206e4c/ruff-0.17.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bd8f5a55b10f371642eacd0e8665a42a8b97da15c9a7187c79e697b77b5e0ce4", size = 10351807, upload-time = "2026-10-15T15:23:05.628Z" }, + { url = "https://files.pythonhosted.org/packages/49/fb/db15b4f8fa24a1e36b99e1401f42ef6df16ee299a48670d5d262b771e7d7/ruff-0.17.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ce05e6f3973611d9550a600e04bb531061e368baba31610eb57c1509a8f21a0a", size = 10765716, upload-time = "2026-10-15T15:23:08.092Z" }, + { url = "https://files.pythonhosted.org/packages/0a/e8/1e186578076aff7a80735f625005fde678412ab609cd323ed182eb7d6b87/ruff-0.17.1-py3-none-win32.whl", hash = "sha256:1de0030a8aa78c65c5fecb84b2e5c390ac684c0452875a02afc7c083d49a496a", size = 9895093, upload-time = "2026-10-15T15:23:10.582Z" }, + { url = "https://files.pythonhosted.org/packages/6a/2e/da3d9589bae8e8b58f3a48bd5bc0b980232fb14a83bf02c3be7660f87c1b/ruff-0.17.1-py3-none-win_amd64.whl", hash = "sha256:5df76f16580fab58d0f6c98a3ac254a4abceb7b2489b8b678335869cff77b3d7", size = 10097955, upload-time = "2026-10-15T15:23:13.309Z" }, + { url = "https://files.pythonhosted.org/packages/df/c9/0f2a4dea06a5e12c1191ee3d96b1e1233797d0d5e18f97a2b909a95a9836/ruff-0.17.1-py3-none-win_arm64.whl", hash = "sha256:42400b9a6ff8515ff27796f07f92e0195be011c86e81e381606f58ea5502fef4", size = 9853542, upload-time = "2026-10-15T15:23:16.05Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, +] + +[[package]] +name = "vnpipe" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "jsonschema" }, + { name = "pillow" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [ + { name = "jsonschema", specifier = ">=4.23" }, + { name = "pillow", specifier = ">=11.0" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.3" }, + { name = "ruff", specifier = ">=0.8" }, +]