Commit graph

4558 commits

Author SHA1 Message Date
5fc9c1199b Fixed the root cause of the failure on the time module.
The previous commit prompted a new error:

```
2024-06-01 10:54:08,310|ERROR|platypush:plugin:bluetooth|module 'platypush.entities.time' has no attribute 'time'
Traceback (most recent call last):
  File "/usr/lib/python3.9/dist-packages/platypush/plugins/__init__.py", line 247, in _runner
    self.main()
  File "/usr/lib/python3.9/dist-packages/platypush/plugins/bluetooth/__init__.py", line 590, in main
    self._refresh_cache()
  File "/usr/lib/python3.9/dist-packages/platypush/plugins/bluetooth/__init__.py", line 146, in _refresh_cache
    get_entities_engine().wait_start()
  File "/usr/lib/python3.9/dist-packages/platypush/entities/__init__.py", line 48, in get_entities_engine
    time_start = time.time()
AttributeError: module 'platypush.entities.time' has no attribute 'time'
```

Which explains even the previous error: `import time` in that module
won't use the `time` module from the Python library, but the `.time`
module within the same directory.

This error only happens when the current directory is part of PYTHONPATH
(and usually it shouldn't), but for sake of keeping things safe I've
replaced `time()` with `utcnow().timestamp()`, with `utcnow` imported
from `platypush.utils`.
2024-06-01 09:01:07 +00:00
b067430cd5 Weird fix for a weird error that suddenly started on one of my machines.
```
Traceback (most recent call last):
  File "/usr/lib/python3.9/dist-packages/platypush/plugins/__init__.py", line 247, in _runner
    self.main()
  File "/usr/lib/python3.9/dist-packages/platypush/plugins/bluetooth/__init__.py", line 590, in main
    self._refresh_cache()
  File "/usr/lib/python3.9/dist-packages/platypush/plugins/bluetooth/__init__.py", line 146, in _refresh_cache
    get_entities_engine().wait_start()
  File "/usr/lib/python3.9/dist-packages/platypush/entities/__init__.py", line 48, in get_entities_engine
    time_start = time()
TypeError: 'module' object is not callable
```

There isn't a single reason in this world for this error to happen.

If I do `from time import time`, then `t = time()` is 100% valid Python.

I have no clue of what may be causing it, but I hope that this will fix
it.
2024-06-01 08:50:30 +00:00
ff60896625
[Automatic] Updated components cache 2024-05-31 23:55:27 +00:00
67b6e3a608
Bump version: 1.0.4 → 1.0.5 2024-06-01 01:43:12 +02:00
c61a1b89d6
Updated CHANGELOG 2024-06-01 01:42:21 +02:00
c9a5c29a4a
🐛 A proper cross-version solution for the utcnow() issue.
No need to maintain two different pieces of logic - a `utcnow()` for
Python < 3.11 and `now(datetime.UTC)` for Python >= 3.11.

`datetime.timezone.utc` existed long before datetime.UTC and that's what
the `utcnow` facade should use.

This means that all the `utcnow()` will always have `tzinfo=UTC`
regardless of the Python version.

There's still a problem with the `utcnow()`-generated timestamps that
have been generated by previous versions of Python and stored on the db.

Therefore, when the code performs comparisons with timestamps fetched
from the db, it should always explicitly do a `.replace(tzinfo=utc)` to
ensure that we always compare offset-aware datetime representations.

See blog post for technical details:
https://manganiello.blog/wheres-my-time-again
2024-06-01 01:34:47 +02:00
1067ab04d9
[tts.picovoice] Adapted to the new orca.synthesize API.
The new API no longer returns a list of numeric values alone. Instead,
it returns a tuple where the first element is the raw audio, and the
second element contains extra info on the rendered phonemes.
2024-05-31 21:10:48 +02:00
709b90fa4b
Merge branch 'master' into 384/assistant-openai 2024-05-31 21:07:06 +02:00
06f0ac4545
[Automatic] Updated components cache 2024-05-31 17:59:06 +00:00
944fd45f9f
Bump version: 1.0.3 → 1.0.4 2024-05-31 19:57:51 +02:00
6acdde6164
Updated CHANGELOG 2024-05-31 19:57:43 +02:00
3583dafbc3
🐛 Partial revert of c18768e61f
`datetime.utcnow` may be deprecated on Python >= 3.12, but
`datetime.UTC` isn't present on older Python versions.

Added a `platypush.utils.utcnow()` method as a workaround compatible
with both.
2024-05-31 19:55:19 +02:00
4513bb9569
Set a plugin argument on AssistantEvents besides assistant.
`assistant` contains the assistant plugin object that triggered the
event, but you can't create event hook conditions on attributes that are
plugins.

The event should also store a `plugin` attribute which contains the
unique plugin name, so hooks like these can be built:

```
from platypush import hook
from platypush.events.assistant import ConversationStartEvent

@when(ConversationStartEvent, plugin="assistant.google")
def on_google_conversation_start():
  ...
```

It wouldn't be possible to construct a hook condition like the one above
on the plugin object reported on the `assistant` attribute.
2024-05-31 19:55:19 +02:00
4e82dd17bb
🐛 Partial revert of c18768e61f
`datetime.utcnow` may be deprecated on Python >= 3.12, but
`datetime.UTC` isn't present on older Python versions.

Added a `platypush.utils.utcnow()` method as a workaround compatible
with both.
2024-05-31 19:52:32 +02:00
e982c02524
Set a plugin argument on AssistantEvents besides assistant.
`assistant` contains the assistant plugin object that triggered the
event, but you can't create event hook conditions on attributes that are
plugins.

The event should also store a `plugin` attribute which contains the
unique plugin name, so hooks like these can be built:

```
from platypush import hook
from platypush.events.assistant import ConversationStartEvent

@when(ConversationStartEvent, plugin="assistant.google")
def on_google_conversation_start():
  ...
```

It wouldn't be possible to construct a hook condition like the one above
on the plugin object reported on the `assistant` attribute.
2024-05-31 19:29:50 +02:00
d9a5ea1e53
Merge branch 'master' into 384/assistant-openai 2024-05-31 02:58:08 +02:00
23e02de1d7
Bump version: 1.0.2 → 1.0.3 2024-05-31 02:57:08 +02:00
4d0b63a155
Updated CHANGELOG 2024-05-31 02:57:08 +02:00
ce1525e786
[Automatic] Updated components cache 2024-05-31 00:53:37 +00:00
67478e7ca1 🐛 Fixed proper support for event package alias platypush.events.
Even though `platypush.events` is just a symlink to
`platypush.message.event`, imports from those two modules will be
treated as different imports, thus hook conditions build on
`platypush.events` imports will never match.
2024-05-31 00:52:48 +00:00
c18768e61f Replaced deprecated usages of datetime.utcnow() with datetime.now(UTC). 2024-05-31 00:52:48 +00:00
30362b89e3 [assistant] tts_plugin_args should include join=True by default.
The assistant by default should be configured to wait for response audio
to be fully rendered before proceeding.
2024-05-31 00:52:48 +00:00
826a3fa55c CHANGELOG update 2024-05-31 00:52:48 +00:00
3986549326
🐛 Fixed proper support for event package alias platypush.events.
Even though `platypush.events` is just a symlink to
`platypush.message.event`, imports from those two modules will be
treated as different imports, thus hook conditions build on
`platypush.events` imports will never match.
2024-05-31 02:50:00 +02:00
fa318882a5
Replaced deprecated usages of datetime.utcnow() with datetime.now(UTC). 2024-05-31 02:30:48 +02:00
d6185ddb1e
[assistant] tts_plugin_args should include join=True by default.
The assistant by default should be configured to wait for response audio
to be fully rendered before proceeding.
2024-05-30 01:33:56 +02:00
snyk-bot
fee12951d6
fix: upgrade cronstrue from 2.49.0 to 2.50.0
Snyk has created this PR to upgrade cronstrue from 2.49.0 to 2.50.0.

See this package in npm:
cronstrue

See this project in Snyk:
https://app.snyk.io/org/blacklight/project/96bfd125-5816-4d9e-83c6-94d1569ab0f1?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-05-27 17:30:57 +00:00
d2caa989ac
CHANGELOG update 2024-05-27 00:18:27 +02:00
fa3c804b71 [#368] Added Ubuntu release logic to update-apt-repo step too. 2024-05-26 20:57:10 +00:00
4cd0761e78
[#368] Added Ubuntu release logic to update-apt-repo step too. 2024-05-26 22:56:23 +02:00
16f7b7e12a Merge pull request '[#368] Added Ubuntu packages' (#402) from 368/ubuntu-packages into master
Reviewed-on: platypush/platypush#402

Closes: #368
2024-05-26 22:41:44 +02:00
22222fab65
[#368] Added Ubuntu packages 2024-05-26 22:38:22 +02:00
5b3c0ad1cf
Bump version: 1.0.1 → 1.0.2 2024-05-26 11:09:51 +02:00
3758a8d759
Updated CHANGELOG 2024-05-26 11:09:42 +02:00
de2bbc53c6
Support both @procedure and @procedure(name) notations. 2024-05-26 11:02:19 +02:00
a4a776986b
Bump version: 1.0.0 → 1.0.1 2024-05-26 04:27:27 +02:00
9fef73a746
Bumped version in setup.py (for some reason bumpversion missed it) 2024-05-26 04:27:03 +02:00
0f6f119089
Bump version: 0.99.11 → 1.0.0 2024-05-26 04:15:52 +02:00
c64ff40dd3
Bump version: 0.99.10 → 0.99.11 2024-05-26 04:06:15 +02:00
5c0f85c311
Don't provide git+https:// dependencies in setup.py extras.
Otherwise Twine will complain with errors like this:

```
HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
Can't have direct dependency: pybluez@
git+https://github.com/pybluez/pybluez ; extra == "bluetooth". See
https://packaging.python.org/specifications/core-metadata for more
information.
```
2024-05-26 04:04:58 +02:00
e6702398dc
Bump version: 0.99.9 → 0.99.10 2024-05-26 03:46:51 +02:00
983bcc240a
[Docs] A more robust interceptor for the grid rendering. 2024-05-26 03:46:25 +02:00
d6d9d7a8e7
[CI/CD] Added extra dependencies to update-pip-package step. 2024-05-26 03:40:10 +02:00
8d26721040
Bump version: 0.99.8 → 0.99.9 2024-05-26 03:32:49 +02:00
96f265a4a2
[CI/CD] Use a base Alpine image instead of python:3.11-alpine.
Weird errors seem to happen on Twine on that image:

```
Traceback (most recent call last):
  File "/usr/bin/twine", line 5, in <module>
    from twine.__main__ import main
  File "/usr/lib/python3.11/site-packages/twine/__init__.py", line 32, in <module>
    import importlib.metadata
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 17, in <module>
    from . import _adapters, _meta
  File "/usr/lib/python3.11/importlib/metadata/_adapters.py", line 3, in <module>
    import email.message
  File "/usr/lib/python3.11/email/message.py", line 15, in <module>
    from email import utils
  File "/usr/lib/python3.11/email/utils.py", line 28, in <module>
    import random
  File "/usr/lib/python3.11/random.py", line 49, in <module>
    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: Error relocating /usr/lib/python3.11/lib-dynload/math.cpython-311-x86_64-linux-musl.so: _PyModule_Add: symbol not found
```
2024-05-26 03:31:25 +02:00
0ffff854d3
Bump version: 0.99.7 → 0.99.8 2024-05-26 03:18:16 +02:00
020804fd1c
Don't link wiki/Home.md to wiki/index.md 2024-05-26 03:16:32 +02:00
42174b31bc
Bump version: 0.99.6 → 0.99.7 2024-05-26 03:12:26 +02:00
3642d1ffa4
Added dns to mocked modules. 2024-05-26 03:02:57 +02:00
104457a302
Bump version: 0.99.5 → 0.99.6 2024-05-26 01:47:22 +02:00