Skip to content

Commit 06cffad

Browse files
committed
updated new features based on commits and issues
1 parent c637adb commit 06cffad

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

docs/new_features.rst

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,30 @@ The new features since 1.1.0 in master include:
3636
(ie, not available as function calls), and decorators on classes are not yet supported. (See #43.)
3737
- New functions ``task.create``, ``task.current_task``, ``task.cancel``, ``task.name2id``, ``task.wait``,
3838
``task.add_done_callback``, ``task.remove_done_callback`` allow new background (async) tasks to be
39-
created, canceled, waited on, and completion callbacks to be added or deleted (see #112).
39+
created, canceled, waited on, and completion callbacks to be added or deleted. Proposed by @dlashua
40+
and @valsr; see #112, #130, #143, #144.
41+
- Added support for ``now`` to ``@time_trigger`` time specifications, which means the current date and
42+
time when the trigger was first evaluated (eg, at startup or when created as an inner function or closure),
43+
and remains fixed for the lifetime of the trigger. This allows time triggers of the form ``once(now + 5min)``
44+
or ``period(now, 1hr)``.
4045
- New function decorator ``@pyscript.compile`` compiles a native Python function inside pyscript, which
4146
is helpful if you need a regular function (all pyscript functions are coroutines) for callbacks or
4247
other uses like ``map()``, or if you have code you want to run at compiled speed (see #71). The
4348
function body can't contain any pyscript-specific features, and closure of variables for an inner
4449
function that uses ``@pyscript.compile`` won't work either, since in pyscript local variables with
4550
scope binding are objects, not their native types. Note also that this is an experimental feature
4651
and the decorator name or other features might change prior to release; feedback welcome.
52+
Proposed by @dlashua (#71).
4753
- A new variable ``pyscript.app_config`` is available in the global address space of an app's main
4854
file (ie, ``apps/YOUR_APP.py`` or ``apps/YOUR_APP/__init__.py``) and is set to the YAML configuration
4955
for your app (ie, ``pyscript.config["apps"][YOUR_APP]``). The latter is still available, but is
5056
deprecated and the ``apps`` entry in ``pyscript.config`` will be removed in a future release to
5157
prevent wayward applications from seeing configuration settings for other apps.
58+
- Updated ``croniter`` to 1.0.2.
59+
- Updated docs to explain how secret parameter values can be stored and retrieved from yaml
60+
configuration (
61+
- Report parsing errors on invalid ``@time_active`` arguments; by @dlashua (#119).
62+
- ``task.executor`` raises an exception when called with a pyscript function.
5263

5364
Breaking changes since 1.1.0 include:
5465

@@ -60,17 +71,24 @@ apps. The new ``pyscript.app_config`` variable should be used instead - it is se
6071

6172
Bug fixes since 1.1.0 include:
6273

63-
- Fixed shutdown trigger for case where it calls ``task.unique()`` (#117).
74+
- Fixed shutdown trigger for case where it calls ``task.unique()``; reported by @dlashua (#117).
6475
- Duplicate ``@service`` function definitions (ie, with the same name) now correctly register
6576
the service, reported by @wsw70 (#121)
6677
- Added error message for invalid ``@time_active`` argument, by @dlashua (#118).
6778
- The ``scripts`` subdirectory is now recursively traversed for ``requirements.txt`` files.
6879
- Inner functions and classes (defined inside a function) are added to global symbol table
6980
if declared as global.
70-
- Calls to ``open()`` now set ``encoding=utf-8`` so Windows platforms use the correct encoding
71-
(see #145).
81+
- Reload all scripts if global settings ``allow_all_imports`` or ``hass_is_global`` change; see #74.
82+
- Methods bound to class instances use weakrefs so that ``__del__`` works; reported by @dlashua (#146).
83+
- Inner functions and classes are added to global symbol table if declared as ``global``.
7284
- Pyscript user-defined functions (which are all async) can now be called from native python async
7385
code (see #137).
86+
- Calls to ``open()`` now set ``encoding=utf-8`` so Windows platforms use the correct encoding
87+
(see #145).
7488
- On Windows, python is missing ``locale.nl_langinfo``, which caused startup to fail when the
7589
locale-specific days of week were extracted. Now the days of week in time trigger expressions
7690
are available on Windows, but only in English (see #145).
91+
- ``task.name2id()`` raises ``NameError`` if task name is undefined. Also added ``kwargs`` to ``task.wait()``.
92+
- Added ``"scripts/**" to ``REQUIREMENTS_PATHS``, so deeper directories are searched.
93+
- Fixed typos in task reaper code, @dlashua (#116).
94+
- Fixed exception on invalid service call positional arguments, reported by @huonw (#131).

docs/reference.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ with the following features:
556556
- ``{h|hr|hour|hours}`` for hours,
557557
- ``{d|day|days}`` for days,
558558
- ``{w|week|weeks}`` for weeks.
559+
559560
That allows things like ``sunrise + 30m`` to mean 30 minutes after sunrise, or ``sunday sunset - 1.5 hour``
560561
to mean 1.5 hours before sunset on Sundays. The ``number`` can be floating point. (Note, there is no
561562
i18n support for those offset abbreviations - they are in English.)

0 commit comments

Comments
 (0)