Commit Graph

3645 Commits

Author SHA1 Message Date
Fabio Manganiello 0483fbac0b
Bump version: 1.0.5 → 1.0.6
continuous-integration/drone/push Build is passing Details
2024-06-01 11:00:43 +02:00
Fabio Manganiello afabbb3606
Merge branch '384/assistant-openai' 2024-06-01 10:59:11 +02:00
Fabio Manganiello 29700e42b5
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 10:56:02 +02:00
Fabio Manganiello 86410f9c34
Merge branch '384/assistant-openai'
continuous-integration/drone/push Build is passing Details
2024-06-01 10:50:02 +02:00
Fabio Manganiello 12d1ff1b5e
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 10:47:53 +02:00
Fabio Manganiello ff60896625
[Automatic] Updated components cache
continuous-integration/drone/push Build is passing Details
2024-05-31 23:55:27 +00:00
Fabio Manganiello 67b6e3a608
Bump version: 1.0.4 → 1.0.5
continuous-integration/drone/push Build is passing Details
2024-06-01 01:43:12 +02:00
Fabio Manganiello 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
Fabio Manganiello 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
Fabio Manganiello 06f0ac4545
[Automatic] Updated components cache
continuous-integration/drone/push Build is passing Details
2024-05-31 17:59:06 +00:00
Fabio Manganiello 944fd45f9f
Bump version: 1.0.3 → 1.0.4
continuous-integration/drone/push Build is passing Details
2024-05-31 19:57:51 +02:00
Fabio Manganiello 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
Fabio Manganiello 4513bb9569
Set a `plugin` argument on `AssistantEvent`s 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
Fabio Manganiello 23e02de1d7
Bump version: 1.0.2 → 1.0.3
continuous-integration/drone/push Build is passing Details
2024-05-31 02:57:08 +02:00
Fabio Manganiello ce1525e786
[Automatic] Updated components cache
continuous-integration/drone/push Build is passing Details
2024-05-31 00:53:37 +00:00
Fabio Manganiello 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
Fabio Manganiello c18768e61f Replaced deprecated usages of `datetime.utcnow()` with `datetime.now(UTC)`. 2024-05-31 00:52:48 +00:00
Fabio Manganiello 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
Fabio Manganiello 5b3c0ad1cf
Bump version: 1.0.1 → 1.0.2
continuous-integration/drone/push Build is passing Details
2024-05-26 11:09:51 +02:00
Fabio Manganiello de2bbc53c6
Support both `@procedure` and `@procedure(name)` notations.
continuous-integration/drone/push Build is passing Details
2024-05-26 11:02:19 +02:00
Fabio Manganiello a4a776986b
Bump version: 1.0.0 → 1.0.1
continuous-integration/drone/push Build is passing Details
2024-05-26 04:27:27 +02:00
Fabio Manganiello 0f6f119089
Bump version: 0.99.11 → 1.0.0
continuous-integration/drone/push Build is passing Details
2024-05-26 04:15:52 +02:00
Fabio Manganiello c64ff40dd3
Bump version: 0.99.10 → 0.99.11
continuous-integration/drone/push Build is passing Details
2024-05-26 04:06:15 +02:00
Fabio Manganiello e6702398dc
Bump version: 0.99.9 → 0.99.10
continuous-integration/drone/push Build is passing Details
2024-05-26 03:46:51 +02:00
Fabio Manganiello 8d26721040
Bump version: 0.99.8 → 0.99.9
continuous-integration/drone/push Build is passing Details
2024-05-26 03:32:49 +02:00
Fabio Manganiello 0ffff854d3
Bump version: 0.99.7 → 0.99.8
continuous-integration/drone/push Build is passing Details
2024-05-26 03:18:16 +02:00
Fabio Manganiello 42174b31bc
Bump version: 0.99.6 → 0.99.7
continuous-integration/drone/push Build is passing Details
2024-05-26 03:12:26 +02:00
Fabio Manganiello 3642d1ffa4
Added `dns` to mocked modules. 2024-05-26 03:02:57 +02:00
Fabio Manganiello 104457a302
Bump version: 0.99.5 → 0.99.6
continuous-integration/drone/push Build is passing Details
2024-05-26 01:47:22 +02:00
Fabio Manganiello 751d719b04
Bump version: 0.99.4 → 0.99.5
continuous-integration/drone/push Build encountered an error Details
2024-05-26 01:46:29 +02:00
Fabio Manganiello cc670f9d4a
Bump version: 0.99.3 → 0.99.4
continuous-integration/drone/push Build is passing Details
2024-05-26 01:26:46 +02:00
Fabio Manganiello ee3933dc77
Bump version: 0.99.2 → 0.99.3
continuous-integration/drone/push Build is passing Details
2024-05-26 00:56:29 +02:00
Fabio Manganiello 0537815721
Bump version: 0.99.1 → 0.99.2
continuous-integration/drone/push Build is passing Details
2024-05-26 00:50:37 +02:00
Fabio Manganiello d3562f4d20
Bump version: 0.99.0 → 0.99.1
continuous-integration/drone/push Build is passing Details
2024-05-26 00:44:30 +02:00
Fabio Manganiello 1911c05afe
Bump version: 0.50.3 → 0.99.0
continuous-integration/drone/push Build is passing Details
2024-05-26 00:25:34 +02:00
Fabio Manganiello 6de0b2e041
[Automatic] Updated components cache
continuous-integration/drone/push Build is passing Details
2024-05-25 18:12:49 +00:00
Fabio Manganiello 35751da068
Added web hooks section to README.
continuous-integration/drone/push Build is passing Details
2024-05-25 20:11:07 +02:00
Fabio Manganiello 3a4d7afcf0
Clean up all package manager caches after Docker build. 2024-05-25 14:15:13 +02:00
Fabio Manganiello e071e99dab
Remove all cached/compiled Python files after Docker build. 2024-05-25 13:36:52 +02:00
Fabio Manganiello 2e0246413c
Replaced an old `for ... in ... yield` loop with `yield from ...` 2024-05-25 10:35:23 +02:00
Fabio Manganiello b1dd484704
A more corner-case-proof logic for `wants_break_system_packages`.
continuous-integration/drone/push Build is passing Details
2024-05-25 10:33:05 +02:00
Fabio Manganiello 05c6449d8b
Always add --break-system-packages to pip when the Docker context is active.
This fixes the case where Platydock is called within the context of a
virtual environment, but it needs to generate a Docker image - and
therefore, unless the host virtual environment, it needs
--break-system-packages to write to /usr.
2024-05-25 10:30:52 +02:00
Fabio Manganiello 5e52741986
[Automatic] Updated components cache
continuous-integration/drone/push Build is passing Details
2024-05-25 08:19:19 +00:00
Fabio Manganiello 7d8a00696c
Adapted Platydock to the new Dockerfile format.
continuous-integration/drone/push Build is passing Details
2024-05-25 10:17:45 +02:00
Fabio Manganiello 254604e404
py3-vlc has not been merged upstream in Alpine Linux yet. 2024-05-25 10:17:19 +02:00
Fabio Manganiello 8e05a7f4c9
Make Dockerfiles work both within and outside a Platypush source dir.
If the Platypush setup.py is found in the current directory, then use
that directory as the base for the new image.

Otherwise, clone the repo on the fly and build the image from there.
2024-05-25 00:42:30 +02:00
Fabio Manganiello 0fd2992894
Added `platypush.events` alias for `platypush.message.event` package. 2024-05-24 23:16:15 +02:00
Fabio Manganiello 3ccdd4d179
Updated `pip ... --break-system-packages` configuration.
All the latest versions of Alpine, Debian, Ubuntu and Fedora now require
`--break-system-packages` when installing packages via `pip` outside of
a virtual environment, even if it's within a container.
2024-05-24 22:59:42 +02:00
Fabio Manganiello d20cd4b058
Added a nice ASCII-art logo at application startup. 2024-05-24 22:57:50 +02:00
Fabio Manganiello c49b4ca273
`platypush.run` should also support procedures in the format `procedure.<name>`.
continuous-integration/drone/push Build is passing Details
2024-05-24 20:20:25 +02:00