Repository navigation
Second batch of pyscript fixes (#808, #726, del obj.attr, two docs fixes) - #5
honeybeartech-homelab-automation[bot] wants to merge 7 commits into
Conversation
Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
|
@HoneyBearTech The plan for the second batch of pyscript fixes is ready. Only 2 open issues turned out to be real, still-broken bugs, so the five are 2 bug fixes, 1 small bug found while checking, and 2 docs fixes. Please approve this PR (or comment "approve") to start the work. |
User decorators got the raw EvalFunc, so functools.wraps() copied the wrapped function's EvalFunc fields over the wrapper's and the wrapper ran the wrapped body instead of its own (custom-components#808). Decorators now get an EvalFuncVar, whose own fields are slots that wraps() can't overwrite, the EvalFuncVar a decorator returns is kept so __wrapped__ and other attributes survive, and __name__ and __doc__ work like Python's. Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
ast_delete passed every dotted target to State.delete, so del a.x on a normal object, or del self.x in a method, raised NameError. As with assignment, a dotted name is now a state only if its first part isn't defined; otherwise the attribute is deleted from the object, and a pyscript module's class is marked undefined in place. Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
The logging docs only showed the "file" path, so apps (and modules and scripts) were hard to configure, and they claimed Jupyter shows log output regardless of the logger settings, which isn't true. Add a table of logging paths per location, a full logger example, note where internal trigger messages are logged, and correct the Jupyter note in the reference and tutorial. Refs custom-components#821, custom-components#520, custom-components#265. Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
@state_trigger and its watch= argument only evaluate when a watched value or attribute changes, so a sensor that repeats the same value (for example with force_update) never fires them. The docs read as if every update did. Say so, and show watching the last_updated attribute to trigger on every update. Refs custom-components#864. Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
A module imported from a subfolder (from .subfolder.b import x) got its parent folder as the base for its own relative imports, so a sibling import (from .a import foo) failed, and imports from plain modules were registered under phantom contexts such as apps.myapp.subfolder.b.a that were unloaded on the next reload. Use the module's own folder as the base and resolve a plain module's relative imports against its package. Fixes custom-components#726. Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
Signed-off-by: Sean Stoube <31805425+HoneyBearTech@users.noreply.github.com>
|
@HoneyBearTech The second batch of pyscript fixes is built and checked, with nothing open. It's ready for your approval. DoneFive fixes are ready, each as one commit that applies on its own to upstream's latest code:
Checks
Rejected findings
To approveApprove this PR (or comment "approve") to finish. Close it to throw the work away. |
|
@HoneyBearTech Thanks for approving. The five fixes are on their own clean branches on this fork, cut from upstream's latest code ( Click each link, check that the title and description are filled in, then click Create pull request. Each one opens from your account against custom-components/pyscript:
One small update was needed for custom-components#808: upstream custom-components#909 renamed a field that our fix also touches, so I adjusted that one line. |
This PR holds the second batch of pyscript fixes. It stays on this fork and is never merged. Plan and record:
docs/plans/issues-batch-2.md. Its base is a copy of upstream's latestmaster, so this PR shows only our changes.What we found. We went through all 138 open upstream issues. Only two are real, still-broken bugs that a small fix can solve, so the five are two bug fixes, one small bug we found while checking, and two docs fixes.
functools.wrapslost its own code, so itstry/exceptnever caught the error.from .a import foo) failed, and a reload could unload part of the app.del obj.attron a normal object failed, because pyscript treated it as deleting a Home Assistant state.watch=only fires when a value changes.Left out: generator expressions (custom-components#564), which need the maintainer's buy-in.
How it's sent. After your approval, each fix becomes its own upstream PR on a clean branch cut from upstream
master, with a prefilled link for you to open it.Team: three Engineers, then QA, Security Officer and Auditor. The plan check and the plain-English check were skipped because their reviewer's monthly quota is used up.
Contribution rules followed:
docs/contributing.rstandtests/README.md(there's no CONTRIBUTING.md or PR template), pre-commit (ruff, codespell, pylint, mypy), CI on Python 3.14, one small fix per PR with tests, commits signed off.Approve this PR (or comment "approve") to finish. Close it to throw the work away.