Skip to content

feat: add --json/--out flags to lappa path resample + CLI smoke tests (Fixes #52) - #100

Open
laurentketterle-hub wants to merge 1 commit into
mergeos-bounties:masterfrom
laurentketterle-hub:feat/resample-fixture-rewrite-52
Open

feat: add --json/--out flags to lappa path resample + CLI smoke tests (Fixes #52)#100
laurentketterle-hub wants to merge 1 commit into
mergeos-bounties:masterfrom
laurentketterle-hub:feat/resample-fixture-rewrite-52

Conversation

@laurentketterle-hub

Copy link
Copy Markdown

Summary

Implements the CLI lappa path resample --step-m fixture rewrite for bounty #52.

Changes

CLI additions (packages/server/src/lappa/cli.py)

  • --json flag on path stats: emits a single JSON object with points, path_length_m, net_displacement_m to stdout
  • --json flag on path resample: same machine-readable output, plus step_m, original_points, original_length_m
  • --out / -o flag on path resample: writes resampled points as a valid JSON fixture with name, points, path_length_m, step_m; creates parent directories automatically
  • When both --json and --out are used, the JSON output includes the out key with the resolved path

Tests (packages/server/tests/test_resample_cli_fixture_rewrite.py)

43 new CLI smoke tests:

  • 3 stats --json tests (line, square loop, hexagon fixtures)
  • 6 resample --json tests (default step, 0.5m, 1.0m, diamond, L-shape, large step)
  • 5 resample --out tests (file validity, round-trip, combined --json, custom step, parent dir creation)
  • 1 fixture naming test
  • 28 parametrized tests (14 fixtures x 2: parseable via --json and writable via --out)

Evidence

$ lappa path stats --file tests/fixtures/sample_path_square_loop.json --json
{"points": 5, "path_length_m": 20.0, "net_displacement_m": 0.0}

$ lappa path resample --file tests/fixtures/sample_path_line.json --step-m 0.5 --json
{"points": 9, "path_length_m": 4.0, "net_displacement_m": 4.0, "step_m": 0.5, "original_points": 3, "original_length_m": 4.0}
$ python -m pytest tests/test_resample_cli_fixture_rewrite.py tests/test_resample.py tests/test_path_stats_cli.py -v
============================= 53 passed in 2.64s ==============================

Closes #52

@laurentketterle-hub

Copy link
Copy Markdown
Author

/attempt 52

@laurentketterle-hub

Copy link
Copy Markdown
Author

Friendly ping 👋 — this PR has been open for 3 days. Is there anything needed for review? Thanks!

@laurentketterle-hub
laurentketterle-hub force-pushed the feat/resample-fixture-rewrite-52 branch from 8410469 to c349af4 Compare August 7, 2026 01:10
Implements the CLI lappa path resample --step-m fixture rewrite for bounty mergeos-bounties#52.

- --json flag on path stats: emits a single JSON object with points, path_length_m, net_displacement_m
- --json flag on path resample: machine-readable output including step_m, original_points, original_length_m
- --out / -o flag on path resample: writes resampled points as a valid JSON fixture
- 43 CLI smoke tests covering json output, out writing, round-trip validation, and all fixture types

Fixes mergeos-bounties#52

Signed-off-by: laurentketterle-hub <noreply@users.noreply.github.com>
@laurentketterle-hub
laurentketterle-hub force-pushed the feat/resample-fixture-rewrite-52 branch from c349af4 to b623cea Compare August 7, 2026 01:11
@laurentketterle-hub

Copy link
Copy Markdown
Author

/claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[50 MRG] CLI: lappa path resample --step-m fixture rewrite

1 participant