Skip to content
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

Load user-provided descriptions for python_scripts #26069

merged 5 commits into from Aug 22, 2019


Copy link

commented Aug 19, 2019


For the python_script integration, load user-provided service descriptions from <config>/python_scripts/services.yaml. This is a a different implementation of #26050.

Related issue (if applicable): fixes the python_script portion of home-assistant/architecture#275

Pull request with documentation for (if applicable): home-assistant/


  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
for fil in glob.iglob(os.path.join(path, "*.py")):
name = os.path.splitext(os.path.basename(fil))[0], name, python_script_service_handler)

if name in services_dict:["service_description_cache"]["{}.{}".format(DOMAIN, name)] = {
@@ -9,8 +9,10 @@

from homeassistant.const import SERVICE_RELOAD
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.service import SERVICE_DESCRIPTION_CACHE

This comment has been minimized.

Copy link

balloob Aug 20, 2019


no no, don't import the constant. Create a function inside helpers.service. Things inside are owned by the file and are not allowed to be directly edited.

Note, we will also need tests for this.

@MartinHjelmare MartinHjelmare moved this from Needs review to Review in progress in Dev Aug 21, 2019

@JeffLIrion JeffLIrion referenced this pull request Aug 21, 2019
3 of 6 tasks complete

@JeffLIrion JeffLIrion force-pushed the JeffLIrion:python-script-descriptions2 branch from 8af98fe to ed3e66c Aug 21, 2019


This comment has been minimized.

Copy link
Contributor Author

commented Aug 21, 2019

@balloob thanks for reviewing and merging #26056! I rebased this branch off the updated dev and made this pull request analagous to the previous one.

@balloob balloob added this to the 0.98 milestone Aug 22, 2019

Dev automation moved this from Review in progress to Reviewer approved Aug 22, 2019

@balloob balloob merged commit aff151c into home-assistant:dev Aug 22, 2019

11 checks passed

CI Build #20190822.39 succeeded
CI (FullCheck Mypy) FullCheck Mypy succeeded
CI (FullCheck Pylint) FullCheck Pylint succeeded
CI (Overview CheckFormat) Overview CheckFormat succeeded
CI (Overview Lint) Overview Lint succeeded
CI (Overview Validate) Overview Validate succeeded
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 7090970...5f4ea86
codecov/project 94% (target 90%)

Dev automation moved this from Reviewer approved to Done Aug 22, 2019

balloob added a commit that referenced this pull request Aug 23, 2019
Load user-provided descriptions for python_scripts (#26069)
* Load user-provided descriptions for python_scripts


* Use async_set_service_schema to register service descriptions

* Add python_script tests for loading service descriptions

* Use async/await in test

This comment has been minimized.

Copy link
Contributor Author

commented Aug 23, 2019

@balloob thanks for including this in the 0.98 release! 👍

@lock lock bot locked and limited conversation to collaborators Aug 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.