New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add python_script response #97937
Add python_script response #97937
Conversation
Thanks for the hint. I have adjusted the code to comply with the service rules for the Silver integration quality: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Added a breaking changes paragraph as raising exceptions will stop scripts/automations. |
Now that you mention it. That would best be handled as it always has. I.e. the exceptions should only be passed on when providing service responses ( |
That could be an option as well. I'll leave that for the core team to decide, as it would be easy to implement (but from my understanding the raising exceptions is the desired path, even when not returning a response). |
This comment was marked as resolved.
This comment was marked as resolved.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
8345c6c
to
68fff76
Compare
I suggest we keep the existing behavior around logging and exceptions for the existing features in this PR and only raise when a service response is requested. Then in another PR we can make a breaking change. It's good to limit breaking changes PRs to as little scope as possible. |
55d0fa4
to
f5f8d43
Compare
I have added some additional code to keep the existing logging possible if no response is required. I am now also creating an issue to point users to the new behavior. Is 3 releases a good timeframe for this? |
This reverts commit a61dd86.
The issue has been removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @RoboMagus 👍
Breaking change
Service calls to
python_script
no longer silently fail and will raise an exception instead of being logged. This will stop scripts or automations instead of ignoring the error.continue_on_error
must be set for scripts and automations usingpython_script
that may fail.Proposed change
Adds the new
ServiceResponse
topython_script
services to allow for cases where we don't need to persist data from a python script.The changes in
core.ServiceRegistry.register
where required aspython_script
discovers the files and registers the services in a non-async function.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: