From c00b8a526e2cec8124ea35c019201a107a236563 Mon Sep 17 00:00:00 2001 From: Craig Barratt <19445341+craigbarratt@users.noreply.github.com> Date: Fri, 4 Sep 2020 21:54:10 -0700 Subject: [PATCH] updates for allow_all_imports --- README.md | 14 +++++++++----- info.md | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7c4bf81..97121fc 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,9 @@ Pyscript implements a Python interpreter using the ast parser output, in a fully allows several of the "magic" features to be implemented in a seamless Pythonic manner, such as binding of variables to states and functions to services. Pyscript supports imports, although the valid import list is restricted for security reasons. Pyscript does not (yet) support some language -features like declaring new objects, list comprehensions, generators and some syntax like `with` -and `yield`. Pyscript provides a handful of additional built-in functions that connect to HASS -features, like logging, accessing state variables as strings (if you need to compute their names -dynamically), sleeping and waiting for triggers. +features like generators and some syntax like `with` and `yield`. Pyscript provides a handful of +additional built-in functions that connect to HASS features, like logging, accessing state variables +as strings (if you need to compute their names dynamically), sleeping and waiting for triggers. Pyscript also provides a kernel that interfaces with the Jupyter front-ends (eg, notebook, console and lab). That allows you to develop and test pyscript code interactively. Plus you can interact @@ -85,7 +84,12 @@ this [README](https://github.com/craigbarratt/hass-pyscript-jupyter/blob/master/ ## Configuration -* Add `pyscript:` to `/configuration.yaml`; pyscript doesn't have any configuration settings +* Add `pyscript:` to `/configuration.yaml`; pyscript has one optional +configuration parameter that allows any python package to be imported if set, eg: +```yaml +pyscript: + allow_all_imports: true +``` * Create the folder `/pyscript` * Add files with a suffix of `.py` in the folder `/pyscript`. * Restart HASS. diff --git a/info.md b/info.md index 62f675c..55ce7f9 100644 --- a/info.md +++ b/info.md @@ -23,7 +23,7 @@ See the documentation if you want to install pyscript manually. ## Configuration -* Add `pyscript:` to `/configuration.yaml`; pyscript doesn't have any configuration settings +* Add `pyscript:` to `/configuration.yaml`; there is one optional parameter (see docs) * Create the folder `/pyscript` * Add files with a suffix of `.py` in the folder `/pyscript`. * Whenever you change a script file, make a `reload` service call to `pyscript`.