Repository navigation
fix: package eigdemo/tripleangledemo/twistdemo entry points correctly - #600
Merged
Merged
Conversation
2 tasks done
…box.demo The three demo console-scripts (pyproject.toml [project.scripts]) pointed at roboticstoolbox.examples.*, a module path that hasn't existed since the demos were relocated to a top-level examples/ dir outside the packaged src/roboticstoolbox tree (wheel.packages = ["src/roboticstoolbox"]) -- every installed entry point 404'd at import time. - Move the three scripts into src/roboticstoolbox/demo/ (new package, mirroring the existing bin/ pattern used by rtbtool). - twistdemo.py: wrap its previously flat top-level code in main(), matching the other two. - tripleangledemo.py/twistdemo.py: replace `while True: env.step(0)` with `env.run(duration=...)` -- besides enabling a --test smoke-test mode (bounded duration instead of running forever), this is a genuine fix on its own: the raw loop never noticed the browser tab closing, so closing it just left the process spinning forever; run() already has disconnect-awareness built in. - eigdemo.py: fix `-h`/`--help`, which compared the whole sys.argv list against a string and so could never match; add the repo's standard hashbang line. - pyproject.toml: repoint the three [project.scripts] entries; fix the matching coverage omit path (also stale, pointing at the same never-existed src/roboticstoolbox/examples/*).
eigdemo runs to completion under MPLBACKEND=Agg as-is. tripleangledemo and twistdemo need --test (bounds env.run() to a short sim-time duration) plus SWIFT_HEADLESS=1 (swift jhavl/swift#122) to run without a browser; skipped when swift isn't installed, matching test_backend_capabilities.py's existing swift-optional pattern.
petercorke
force-pushed
the
feat/package-demo-scripts
branch
from
August 16, 2026 22:50
829cc27 to
e0de788
Compare
eigdemo() prints λ1/λ2 (literal Greek chars). Windows defaults stdout to the legacy cp1252 console codepage whenever it isn't a real console -- piped/redirected output included -- and cp1252 has no mapping for λ, so print() raised UnicodeEncodeError. Caught by test_demo.py's new subprocess-based smoke tests on windows-latest (both 3.10 and 3.11): the exact case of capturing eigdemo's stdout through a pipe. A real Windows user piping or redirecting eigdemo's output would hit the same crash outside of CI. sys.stdout.reconfigure(encoding="utf-8") (3.7+) forces UTF-8 regardless of the console's codepage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #600 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 142 142
Lines 13891 13891
=====================================
Misses 13891 13891 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eigdemo,tripleangledemo,twistdemo) pointed atroboticstoolbox.examples.*, a module path that hasn't existed since the demos were relocated to a top-levelexamples/dir outside the packaged tree (wheel.packages = ["src/roboticstoolbox"]) -- every installed entry point 404'd at import time.src/roboticstoolbox/demo/(mirrors the existingbin/pattern used byrtbtool), updated[project.scripts]accordingly.twistdemo.pywrapped inmain()(was flat top-level code).tripleangledemo.py/twistdemo.py: replacedwhile True: env.step(0)withenv.run(duration=...)-- also fixes a real bug, the raw loop never noticed the browser tab closing and spun forever;run()has disconnect-awareness built in. A--testflag bounds the duration for smoke testing instead of running until disconnect.eigdemo.py: fixed-h/--help(compared the wholesys.argvlist against a string, could never match); added the repo's standard hashbang line.coverage.run.omitpath inpyproject.toml(same never-existedsrc/roboticstoolbox/examples/*).tests/test_demo.py: smoke tests for all three entry points. The two Swift-based ones useSWIFT_HEADLESS=1(new in jhavl/swift#122, merged) +--testto run headless with a bounded duration; skipped when swift isn't installed (matchestest_backend_capabilities.py's existing pattern), sotest-core(no swift) still passes.Test plan
eigdemo(default +--help+ custom matrix),tripleangledemo --test,twistdemo --test(both headless)pytest tests/test_demo.py: 5/5 passpytest tests/ --ignore=tests/test_blocks.py): 716 passed, 3 skipped -- unchanged frommain(confirmed via stash-compare; pre-existing spatialgeometry deprecation warnings noted separately, not touched here)