Repository navigation
Setting helpers: a search box for plugin settings (M5 part 3c, 1 of 2) - #268
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…> (txoof) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… note; more planned) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt 3c) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…values, size limits, HelperProblem only for searches, more tests) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oof) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Changes after txoof tried the weather demo (2026-10-10), in 3 commits:
Also from the demo: issue #270 (portrait layouts are drawn as landscape). Now +1484 / -156; 1528 tests pass on the Pi. 🤖 Generated with Claude Code |
txoof
approved these changes
Oct 10, 2026
3 of 4 tasks
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.
Part of #238 (M5 part 3c, first half). Design:
docs/decisions/setting-helpers.md(new, agreed with txoof on 2026-10-10).What changed
A plugin can now offer a setting helper: a search box under one of its settings on the settings page. You type something, PaperPi shows a list of choices, and Use puts the chosen values into the form. Nothing is saved until Save.
setting-helpers.md: PaperPi owns the page, the plugin owns its settings. A helper is a function of the plugin. It returns choices as dictionaries whose keys are kinds:fill(settings for the form),show(texts to help pick),link(http/https addresses), plusnotefor the whole result. Planned kinds (add,next,disabled,picture,waitfor log-ins) are described but not built. Rejected and why: plugin-sent HTML, a map, helpers written in the web code. The command line comes later (see the new issue below).paperpi/helper.py(Helper,Query,HelperProblem,clean),Plugin.helperswith checks (a setting naming a helper the plugin doesn't have fails the plugin check),runner.run_helper. A search runs in its own process with a 30 s time limit, like an update; the runner's process code is now shared by updates and searches.fillvalues must be plain (text, numbers, true/false, lists) and can't fill secrets; API keys are replaced with****in everything a search returns; a helper'sHelperProblemmessage is only used for searches (in an update it is an ordinary failure).debuggingplugin'stextsetting has awordshelper (each word becomes a choice;crash,hang,problemandmanymisbehave on purpose).docs/writing-plugins.md, including the rule not to send a saved secret to an address taken from the settings.Size: +1484 / -156 (after the demo fixes), over the usual 800. txoof chose one PR over a core/web split (2026-10-10). About 120 lines only moved (the field template went into
_field.html, so Use can reuse it), and the review fixes added about 190.Next (PR 2): the
locationhelper with Open-Meteo formet_noandmoon_phase, andaltitudeformet_no(closes #176).Area
core (
helper.py,plugin.py,runner.py,limits.py,plugins/debugging/), web (src/paperpi/web/), docs.plugin.pychanges thePluginclass, notPluginEntry; no other open PR changes these files.Tests
New:
tests/test_helper.py(result rules, plugin check, real plugin processes: choices, problem, crash, hang, API key hidden,HelperProblemin an update) andtests/test_web_helpers.py(search box and its own form, choices and escaping, failures,needs, button-only helper, one at a time, stop, Use and what it refuses, the log of left-out kinds, one real search).uv run pytestpasses: 1528 passed (-n auto, 97 s on the Pi)uv run ruff check .passesImages
No browser on the Pi for screenshots. A demo is running: http://192.168.1.224:8091/plugins/1/settings?id=met_no-4b8e2f61 (login off). It runs this PR plus the start of PR 2 (weather place search).
Review
HelperProblemfrom an update, plainfillvalues, API keys in choices, secret fills, size limits, deeply nested Use data, the Use route not checking its setting,typed=Falsestill getting typed text, missing tests, doc wording. Left as follow-ups: a minimum wait between searches and one shared lock for searches and previews (today each has its own lock, so one search and one preview can run at the same time).Only txoof approves and merges this PR.
🤖 Generated with Claude Code