Pyscript 0.30 release
The 0.30 release contains a number of new features, and several bug fixes.
The main new features are:
- support for apps and importable modules and packages below the
<config>/pyscriptdirectory - support for trigger functions as closures, allowing factory functions to create multiple similar trigger functions
- added a variable
pyscript.configthat allows access toyamlconfiguration settings - added
task.executor()for functions that block (eg, doing I/O) or have long running times - added support for
with,async for,lambdaand named expressions - use the
croniterpackage for cron functions - improved exception handling and reporting
Breaking changes:
task.unique()now only applies within the current global context; the same name used in other global contexts will not be affected- accessing an undefined state variable now throws a
NameErrorexception, instead of returningNone, except in@state_triggeror@state_active, where undefined state variables, attributes or the.oldvalue will still evaluate toNoneif not defined
Infrastructure:
- moved documentation from README to hacs-pyscript.readthedocs.io and added more material
- added precommit checks for
black,isort,flake8andpytest - set line-length to 109 for
black/flake8/isort - revamped
pytestsetup - improved test coverage
Bug fixes include:
- variable scoping in function closures now works correctly
- fixed augmented assignments
- list/set/dict comprehension looping vars are now in implicitly nested scope
delworks correctly for non-locally scoped variables- sunrise and sunset times now correct for dates other than today
Thanks to @fleXible for several PRs (adding croniter, fixing sunset/sunrise, revamping test infrastructure, refactoring and precommits, among others) and @dlashua for extensive testing, various bug reports and feature requests.
Enjoy!